From: Neville Dempsey on 17 Jul 2010 06:35
There is an issue when taking the address of a nested function.
Somehow the stack frame of the parent function must also be stored
> GCC implements taking the address of a nested function using a technique called trampolines. This technique was described in Lexical Closures for C++ (Thomas M. Breuel, USENIX C++ Conference Proceedings, October 17-21, 1988).
> In the GCC compiler, trampoline refers to a technique for implementing pointers to nested functions. The trampoline is a small piece of code which is constructed on the fly on the stack when the address of a nested function is taken. The trampoline sets up the static link pointer, which allows the nested function to access local variables of the enclosing functions. The function pointer is then simply the address of the trampoline. This avoids having to use "fat" function pointers for nested functions which carry both the code address and the static link.
I suspect that algol68toc (A68RS) uses "fat" function pointers instead
of "Trampolines" because (IIRC) algol68toc generates standard "C" code
where no gcc extensions are required.
To download Linux's Algol68 Compiler, Interpreter & Runtime: