Waldek Hebisch wrote:
But there is no need to generate trampolines on the stack. Namely, one can generate code in a separate area. In C this causes problems
with garbage collection, which IMHO can be solved, but requre alloca-like
tricks. On the other hand trampolines in separate area may provide
extra functionality, beyond what nested functions give. For example
they can be used to "partially apply" a function, giving it some
frozen arguments, and providing the rest at call time.
Trampolines do of course have to be handled in a stack like fashion (to get recursion right), so you have to be very careful about allocation and deallocation in this separate area. And you still have the cache problem, so I don't see what it buys.