[Mono-devel-list] Trampolines...

Ben Maurer bmaurer at ximian.com
Wed Feb 23 10:27:08 EST 2005


>
> Hi Ben!
>
>>>>SomeStruct s = new SomeStruct ();
>>>>s.ToString ();
>>>>object o = s;
>>>>o.ToString ();
>>>
>>>[..idea..]
>>>addq 0x10, %r_this	;unbox start
>>>pushq %rbp		;normal start
>>>movq  %rsp, %rbp
>>>....
>>
>> Totally not needed. If you call s.ToString (), the compiler does *not*
>> emit a box instruction, provided that typeof (s) provided an override
>> for .ToString.
>
> It's not about s.ToString, but o.ToString. s.ToString would enter at
> pushq, whereas o.ToString would enter at addq... Or do I have missed
> something?

I guess that would work. Is the cost of doing an unbox trampoline showing
up in any sort of profile on a non-pendantic test case?

-- Ben





More information about the Mono-devel-list mailing list