Questions about trampolines

Joern RENNECKE joern.rennecke@st.com
Wed Mar 16 19:54:00 GMT 2005


Clifford Wolf wrote:

>Hi,
>
>On Wed, Mar 16, 2005 at 01:50:32PM +0000, Joern RENNECKE wrote:
>  
>
>>These can be provided in a separate module of the static libgcc, together
>>with allocation and deallocation of individual trampolines from the pool
>>(the latter has to be called from the epilogue of functions that use
>>initialize (and thus allocate) trampolines).
>>    
>>
>
>I also thought about that already.
>It's a good idea, but not good enough.  :-(
>
>what's about longjmp(), gotos from nested functions to their surrounding
>functions (with a complex calltree inbetween) and (c++) exceptions?
>
>always preserving frame pointers, unrolling the stack frame by frame and
>executing this epilogues might be possible - but I don't think that we
>really want to go this way..
>

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.

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.
   



More information about the Gcc mailing list