------- Comment #14 from rth at gcc dot gnu dot org 2009-09-09 21:23 ------- Not working on it yet, but I think it should be possible to have the static chain pushed to the stack by the trampoline. Direct calls to the nested function would have to pass the static chain in a call saved register. The nested function would have to be emitted like:
nested_func: push %esi .Lnested_func_tramp_entry: push %ebp movl %esp, %ebp ... trampoline: pushl $static_chain jmpl .Lnested_func_tramp_entry Thankfully, "pushl $const" and "movl $const, reg" are the same size. This involves adjusting a number of elimination offsets, rearranging the middle-end such that it allows different static chain locations based on the target function, rearranging the INITIALIZE_TRAMPOLINE macro so that it passes in the target function. Hopefully with all the macros turned into proper target hooks at the same time. The one potential problem with this approach is that -fno-omit-frame-pointer backtraces break. However, dwarf2 unwinding would still work. -- rth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41246