The Virtual Method Table (VMT) for each object type consists of 2 check fields (containing the size of the data), a pointer to the object's anchestor's VMT (Nil if there is no anchestor), and then the pointers to all virtual methods. The VMT layout is illustrated in table (5.2).
The VMT is constructed by the compiler. Every instance of an object receives a pointer to its VMT.
Offset | What |
+0 | Size of object type data |
+4 | Minus the size of object type data. Enables determining of valid VMT pointers. |
+8 | Pointer to ancestor VMT, Nil if no ancestor available. |
+12 | Pointers to the virtual methods. |
... |