[Mono-devel-list] Trampolines...

Zoltan Varga vargaz at gmail.com
Tue Feb 22 17:41:56 EST 2005


> Second question: Why do we have those unbox trampolines? I understand
> that virtual methods of value types need to get an unboxed 'this'
> pointer, but why generating a trampoline for this kind of code? Can't
> this be done when the method is JITed? (As a function prologue?)
> These unbox trampolines are a pain in the arse, as you have constantly
> to check for this case and it limits code patching: I can not recompile
> virtual methods of value types..

It is possible to call the same virtual method with boxed and
non-boxed arguments,

SomeStruct s = new SomeStruct ();
s.ToString ();
object o = s;
o.ToString ();

Both calls end up calling the same method, but in the second case, the argument
needs to be unboxed, since the this pointer points to a boxed instance, but the
method requires an unboxed one.


More information about the Mono-devel-list mailing list