Joern RENNECKE wrote:
In a single-threaded environment, you treat the trampoline pool as a
stack, and
when you allocate a new one, check first if there are any trampolines
left at the
top that have a static chain pointer that points into deallocated data
stack.
Yes, but that avoids the difficulty, that's obvious so far.
The problem is to know exactly when to pop the stack, and that is
not trivial (longjmp, exceptions, non local gotos).
In (possibly) multithreaded environments, you could treat the
trampolines as objects
with a destructor. Exception handling already knows how to call
destructors while
unwinding the stack.
That's possible but expensive