[Mono-dev] How to create a JIT trampoline?

Paolo Molaro lupus at ximian.com
Fri Oct 10 19:41:18 EDT 2008

On 10/10/08 Kornél Pál wrote:
> Currently mono_image_fixup_vtable actually compiles methods that causes 
> type loads as well and requires the assembly to be loaded.
> Please help with letting me know how could I avoiding this by using JIT 
> trampolines. I have no idea how to create them and late fixup their address.

You can use mono_runtime_create_jump_trampoline (), though it's not
really clear what domain you should use, I guess the root domain would
work in most cases. If this is to work for other domains as well, you
will need more work, I don't know the details of how the methods
exported this way are supposed to behave.
To optimize the calls after the first something like the current
jump_target_got_slot_hash hash may be used so the function address is
replaced with the compiled method's code instead of going through the
trampoline every time.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list