[Mono-dev] How to create trampolines for mono_marshal_get_vtfixup_ftnptr?

Kornél Pál kornelpal at gmail.com
Thu Jun 5 04:33:03 EDT 2008


Hi,

Current implementation of mono_image_fixup_vtable calls
mono_marshal_get_vtfixup_ftnptr that JITs a wrapper. The problem
however is that the wrapper has to know the types uses used as
arguments and return value that means that the assembly has to be
loaded before mono_marshal_get_vtfixup_ftnptr is called.

mono_image_fixup_vtable should be called when loading the image and
the assembly should not be loaded by LoadLibray to any AppDomain.

I would like to only create a trampline in mono_image_fixup_vtable
that will load the assembly and will create a wrapper using
mono_marshal_get_vtfixup_ftnptr. This should also enable implementing
proper AppDomain handling for VTFIXUP_TYPE_FROM_UNMANAGED and
VTFIXUP_TYPE_FROM_UNMANAGED_RETAIN_APPDOMAIN.

I have no problem in creating a trampoline function for calling
mono_marshal_get_vtfixup_ftnptr but I don't know how to replace the
trampline with the actual wrapper with respect to concurency handling.

Could you please point me to some existing code in the runtime already
doing similar things?

Thanks.

Kornél


More information about the Mono-devel-list mailing list