(fwd) Re: Is self-modifying code possible?

M Sweger (mikesw@whiterose.net)
Thu, 28 Oct 1999 12:10:46 -0400


Path: news.dhp.com!newsfeed.srv.cs.cmu.edu!newsfeed.berkeley.edu!news.maxwell.syr.edu!news.shore.net!not-for-mail
Sender: meissner@tiktok.cygnus.com
Newsgroups: comp.os.linux.development.apps
Subject: Re: Is self-modifying code possible?
References: <7ui5cq$4b8$1@cnn.Princeton.EDU> <38139ACD.44F94436@gte.net> <sy3dv086s5.fsf@tiktok.cygnus.com> <38150194.3E86349B@home.com> <sypuy27nk7.fsf@tiktok.cygnus.com> <7v6lqb$ri0$4@stronghold.dhp.com>
From: Michael Meissner <meissner@cygnus.com>
Message-ID: <syemeg7b1f.fsf@tiktok.cygnus.com>
Organization: Cygnus Solutions
Lines: 22
X-Newsreader: Gnus v5.5/Emacs 20.3
Date: 27 Oct 1999 17:23:40 -0400
NNTP-Posting-Host: 209.192.197.34
X-Complaints-To: abuse@shore.net
X-Trace: news.shore.net 941059421 209.192.197.34 (Wed, 27 Oct 1999 17:23:41 EDT)
NNTP-Posting-Date: Wed, 27 Oct 1999 17:23:41 EDT
Xref: news.dhp.com comp.os.linux.development.apps:69653

mikesw@whiterose.net (M Sweger) writes:

> So isn't this what FORTRAN does? It allows one to declare subroutine within
> subroutines with the inner most subroutine being able to access outer most
> subroutine local variables. I thought this was implemented using a heap.

While I haven't looked at the G77 front end, I would be surprised if it used a
heap (there are architectures out there where the stack is allocated from the
heap as well, but these are rare for the C/C++ family of languages). I can say
the way the GCC back end does scoped procedures is by passing the address of
the lexically enclosing function in a hidden register, and if the language
allows taking the address of a function, it usually involves a trampoline (on
some architectures and ABI's it doesn't, since function pointers are already
'FAT' -- for example, under the AIX/Mac environment, a function pointer
actually points to a 3 word quantity that contains the actual function pointer,
the GOT address to load up into r2, and the static chain to be loaded up into
r11).

-- 
Michael Meissner, Cygnus Solutions
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886
email: meissner@cygnus.com	phone: 978-486-9304	fax: 978-692-4482

--
	Mike,
	mikesw@whiterose.net

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/