Re: Caller/Callee saved Registers

hbaker@netcom.com (Henry G. Baker)
Thu, 24 Mar 1994 20:41:39 GMT

          From comp.compilers

Related articles
[8 earlier articles]
Re: Caller/Callee saved Registers bart@cs.uoregon.edu (1994-03-23)
Re: Caller/Callee saved Registers robertsw@agcs.com (1994-03-23)
Re: Caller/Callee saved Registers Peter-Lawrence.Montgomery@cwi.nl (1994-03-24)
Re: Caller/Callee saved Registers pdp8@ai.mit.edu (1994-03-24)
Re: Caller/Callee saved Registers ghiya@flo.cs.mcgill.ca (1994-03-24)
Re: Caller/Callee saved Registers paulb@travis.csd.harris.com (1994-03-24)
Re: Caller/Callee saved Registers hbaker@netcom.com (1994-03-24)
Re: Caller/Callee saved Registers bart@cs.uoregon.edu (1994-03-25)
Re: Caller/Callee saved Registers hbaker@netcom.com (1994-03-25)
Re: Caller/Callee saved Registers pardo@cs.washington.edu (1994-03-25)
Re: Caller/Callee saved Registers zsh@cs.princeton.edu (1994-03-25)
Re: Caller/Callee saved Registers law@fast.cs.utah.edu (1994-03-26)
Re: Caller/Callee saved Registers hbaker@netcom.com (1994-03-26)
[15 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: hbaker@netcom.com (Henry G. Baker)
Keywords: registers, optimize, comment
Organization: nil
References: 94-03-054 94-03-106
Date: Thu, 24 Mar 1994 20:41:39 GMT

bart@cs.uoregon.edu (Barton Christopher Massey) writes:
[good points deleted]


>I know of no C-based systems
>whose calling conventions support multiple entry points to a procedure,


Actually, this may not be quite true. I've been told that the C compilers
for several machines implement at least two different entry points for
some functions. The case that seems to be special is that of a function
which is passed as an argument (or stored into a data structure). I've
been told that the HP Snake C compiler apparently makes a little 'stub'
procedure for this case. I have not personally verified this, so I don't
know what this stub is used for. Apparently this 'feature' is not
documented, so this person found it out only by assembly language
debugging, and by trying to find out why his code was slower than he
expected.
[I doubt that has anything to do with register saving. Typically the code
for a procedure and the static data are stored separately. If a procedure
is in a shared library, the addresses of the code and the data often vary
among the processes into which the procedure is mapped, so it would be bad
news to embed addresses of static data into the code. The usual direct
calling sequence generally loads up a pointer to the static data (usually
from a constant pool in the caller's static data), then calls the
proocedure. This means that a procedure has two addresses, its code
address and its data address, so a function pointer would be two words
long. But large amounts of badly written C code will crash and burn if
all pointers aren't the same size, so compiler writers finesse it by
making a procedure pointer actually point to a little stub that loads up
the data pointer and jumps to the code. That's the second entry point.
Frequently the stubs are written by the linker so that it only makes them
for procedures actually referred to from a pointer. Two-address procedures
go way back; I first ran into them in TSS/360 in about 1969. -John]
--


Post a followup to this message

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