"Peter T. Breuer" <ptb@it.uc3m.es> said:
[...]
> Nesting functions is a syntactic problem, not an implementation
> problem.
Think about calling a nested function from somewhere outside it's "home",
it'll have to carry its definition environment around somehow. And this
"somehow" isn't given with plain C function pointers which just point at
the code to run. To set the stack up properly for such a function (with the
right parent) requires a code snippet that becomes the target of the
function pointer, and after building the environment calls the original
code, and then cleans up. Note that this code has to depend on the exact
invocation that created the function pointer (as it provides the definition
environment), so the snippet isn't constant; and there might even be
several of those active for the same nested function for different
invocations of the parent at a given point in time. Thus, put it on the
stack, i.e., a trampoline.
To understand what is going on here knowledge of Pascal and its
implementation helps ;-)
-- Horst von Brand vonbrand@sleipnir.valparaiso.cl Casilla 9G, Viņa del Mar, Chile +56 32 672616- 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/
This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:19 EST