vtables/itables in .NET and MOSA

Nov 15, 2009 at 10:52 AM

There is a hint in file CodeGenerationStage.cs in line 663 about Microsoft does not use vtables, but instead allocates trampolines.

Could anyone explain this technique? Will MOSA use it?

Nov 18, 2009 at 2:20 AM

Hi! I was hoping someone else with more knowledge on this subject would jump in and answer your question.

MOSA has not reach the stage of being able to compile code that use objects yet.  It's next on our to-do list!

My knowledge on this is still limited except I believe that trampolines attempt to resolve the inefficiencies of traversing vtables by using dynamically created dispatch tables for each type. I hope someone else can elaborate more.

Trampolines are also used to stub/intercept a method call when the method has not yet been JIT compiled. The trampoline call into the JIT to have the method compiled, then the trampoline would be patched to call the method (instead of the compiler), and finally call the compiled method.