Article View: comp.arch
Article #12917Re: subroutine frequency
From: sundar
Date: Sun, 01 Feb 1987 04:19
Date: Sun, 01 Feb 1987 04:19
19 lines
1597 bytes
1597 bytes
do compilers take the time to keep track of which registers have
been used and only save the 'dirty' ones or do most call and
return mechanisms save the entire register set on the stack?
It depends on the architecture and the compiler, the three easy ways
to do it are
a) save all register
b) have the caller save only the registers it is using
c) have the callee save only the registers it will use
pdp-11's use "a" since they only have 3 register variables anyway. Most
68k compilers use "c" since you get about 12 register variables. I don't
know of anyone who uses "b" but it should be about as efficient as "c".
I am just curious. Isn't it a security hole to use the method c)
above? If the caller is a system routine and the callee is my program
and I am supposed to save and restore registers that I intend to use,
I can have some fun by not saving the registers in the first place and
in addition destroying them.
sri
Technical Details
Message-ID:
<1859@cwruecmp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cwruecmp!sundarReferences:
<1881@homxc.UUCP> <898@moscom.UUCP> <476@mntgfx.MENTOR.COM>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cwruecmp!sundar From: sundar@cwruecmp.UUCP Newsgroups: comp.arch Subject: Re: subroutine frequency Message-ID: <1859@cwruecmp.UUCP> Date: Sat, 31-Jan-87 23:19:21 EST Article-I.D.: cwruecmp.1859 Posted: Sat Jan 31 23:19:21 1987 Date-Received: Sun, 1-Feb-87 07:41:59 EST References: <1881@homxc.UUCP> <898@moscom.UUCP> <476@mntgfx.MENTOR.COM> Reply-To: sundar@cwruecmp.UUCP (Sundar Iyengar) Organization: CWRU Dept. of Computer Engineering, Cleveland, Ohio Lines: 19 Keywords: register stack frame variable