1 Object and VTable layout
2 ========================
4 The first pointer inside an Object points to a MonoClass structure. Objects
5 also contains a MonoThreadsSync structure which is used by the mono Thread
10 MonoThreadsSync synchronisation;
12 /* object specific data goes here */
15 The MonoClass contains all Class infos, the VTable and a pointer to static
19 /* various class infos */
22 const char *name_space;
26 /* interface offset table */
27 gint *interface_offsets;
29 gpointer data; /* a pointer to static data */
31 /* the variable sized vtable is included at the end */
32 gpointer vtable [vtable_size];
36 Calling virtual functions:
37 ==========================
39 Each MonoMethod (if virtual) has an associated slot, which is an index into the
40 VTable. So we can use the following code to compute the address of a virtual
43 method_addr = object->class->vtable [method->slot];
46 Calling interface methods:
47 ==========================
49 Each interface class is associated with an unique ID. The following code
50 computes the address of an interface function:
52 offset_into_vtable = object->class->interface_offsets [interface_id];
53 method_addr = object->class->vtable [offset_into_vtable + method->slot];