[Mono-devel-list] Question CEE_CALLVIRT

Paolo Molaro lupus at ximian.com
Wed Dec 15 09:18:05 EST 2004

On 12/15/04 Christoph Stiedl wrote:
> I am currently trying to understand how callvirt  
> works. I figured out that the CEE_CALLVIRT instruction 
> is somehow mapped to OP_*CALL_MEMBASE finally.   
> Could anybody tell me where to find the  
> place in the code where this mapping happens? 
> I "grepped" for CEE_CALLVIRT and didn't find any 
> #define statemtent for it. Where is it coming from? 

CEE_CALLVIRT is the value corresponding to the IL callvirt opcode.
They are generated from the file mono/cil/opcode.def which is
included inside an enum in mini.h.
We create additional call opcodes to differentiate between
different return types, so if the method returns void we use
OP_VOIDCALL*, if it returns a double we use OP_FCALL etc.
We reuse the CEE_CALL values to mean: it returns a register-sized 
The function mini_emit_virtual_call() in mini/inssel.brg is
used to emit the low-level opcode (virtual and interface calls
load the function pointer to call from a vtable, which is
a base register + offset load, so we use the OP_*CALL_MEMBASE
to represent it).


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

More information about the Mono-devel-list mailing list