Related articles |
---|
nested functions reji_thomas@symantec.com (2006-08-29) |
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-08-30) |
Re: nested functions ian@airs.com (Ian Lance Taylor) (2006-08-30) |
Re: nested functions torbenm@app-0.diku.dk (2006-08-30) |
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-08-30) |
Re: nested functions reji_thomas@symantec.com (2006-08-31) |
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-08-31) |
[7 later articles] |
From: | reji_thomas@symantec.com |
Newsgroups: | comp.compilers |
Date: | 29 Aug 2006 22:46:50 -0400 |
Organization: | http://groups.google.com |
Keywords: | code, question |
Posted-Date: | 29 Aug 2006 22:46:50 EDT |
I have a doubt regarding the nested functions and how the same is
supported in languages. I don't have much knowledge in compilers
except for the occasional reading.
Please correct me if my understanding is wrong.
From my understanding, a compiler uses
1. Lambda lifting where the nested function is hoisted to global level
passing free variables through an env pointer or as explicit arguments.
2.Static chaining or displays which uses pointers to the corresponding
stackframe in which the non local variable is defined.
One of my questions is
whether lambda lifting cannot solve any cases which chaining/displays
can only solve?.
My next doubt is regarding the nested function support from GCC using
trampolines. I could see that in case of function pointers of nested
functions GCC was generating the code on the stack to move the frame
pointer of the function in which the nested function is nested to ECX
and then to do a jump to the nested function.
My question is
Whether GCCs support for nested functions is similar to nested function
support in functional languages like haskell/scheme and do trampolines
provide any advantage other than access time.?
I realise that you cannot return a nested func pointer and pass it
around since theres no way GCC associates state with the ptr.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.