[llvm-commits] Trampoline changes

Duncan Sands baldrick at free.fr
Fri Sep 28 14:38:49 PDT 2007


Hi Chris,

> > Also
> > 5. Within foo, you need to check that nothing too complicated is
> > done to P1, for example it isn't stored in a global or passed to
> > some other function.
> 
> Actually, worse case, you could just make a trampoline in foo.   
> However, you're right that this is only worth doing if there are  
> calls to the fn pointer in foo.  OTOH, propagating the trampoline  
> creation site down to foo will allow it to be further propagated into  
> functions that foo might call.

that could be very costly.  Initializing a trampoline is not very
costly.  What is costly is using it and then modifying the stack
contents where the trampoline was, because you get an icache flush.
Eg: if you push the trampoline down into a function called in a loop,
then you risk calling the trampoline then dirtying that part of the
stack (after function return, due to other local variables using that
part of the stack) and thus taking a large hit on every iteration.

Ciao,

Duncan.



More information about the llvm-commits mailing list