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/