Re: How to handle qualified identifiers such as x.y in a Pascal-like language

torbenm@diku.dk (Torben Ęgidius Mogensen)
Thu, 07 Jul 2011 10:27:51 +0200

          From comp.compilers

Related articles
[13 earlier articles]
Re: How to handle qualified identifiers such as x.y in a Pascal-like l cr88192@hotmail.com (BGB) (2011-06-29)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l cr88192@hotmail.com (BGB) (2011-06-29)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l cr88192@hotmail.com (BGB) (2011-07-01)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l anton@mips.complang.tuwien.ac.at (2011-07-02)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l gneuner2@comcast.net (George Neuner) (2011-07-02)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l cr88192@hotmail.com (BGB) (2011-07-03)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l torbenm@diku.dk (2011-07-07)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l cr88192@hotmail.com (BGB) (2011-07-07)
| List of all articles for this month |

From: torbenm@diku.dk (Torben Ęgidius Mogensen)
Newsgroups: comp.compilers
Date: Thu, 07 Jul 2011 10:27:51 +0200
Organization: SunSITE.dk - Supporting Open source
References: 11-06-037 11-06-039 11-06-045 11-07-004 11-07-008 11-07-011
Keywords: code
Posted-Date: 07 Jul 2011 13:44:34 EDT

> [It is my impression that a lot of languages that allow closures and the
> like end up with their own calling sequences. -John]


Not surprising, since most vendor procedure call standards are
targeted for C-like languages: Flat scope, single result, no
exceptions, no tail call optimisation, and so on. Once you go beyond
that you will need to either extend the calling standard or do
something quite different.


For example, most modern call standards are almost exclusively
callee-saves: While some registers are designated as caller-saves,
these are often only used for variables that are not live across any
call, so they are never saved. Variables live across calls are all
stored in callee-saves registers (or spilled).


This makes both tail call optimisation and exceptions more costly. The
first because you have to restore the callee-saves registers before the
tail-call jump (unless it is to the same procedure, which is why many
compilers only support tail recursion and not general tail calls) and
the latter because the registers you have to restore at an exception
will be stored in many different frames, so you will have to unwind the
stack to restore them, where a pure caller-saves strategy will allow you
to go directly to the frame of the exception handler and take the saved
live registers from this.


Sure, at leaf calls a callee-saves strategies might avoid saving
registers at all, but inlining will get you the same (and other)
benefits, though it will increase code size.


Torben


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.