Intermediate
Compilers & Programming Language Theory
Q77 / 100
What is the difference between a virtual method table (vtable) and inline caching?
Correct! Well done.
Incorrect.
The correct answer is D) A vtable is a fixed per-class table of function pointers for dynamic dispatch; inline caching remembers a call site's last lookup result to speed up future dispatches
D
Correct Answer
A vtable is a fixed per-class table of function pointers for dynamic dispatch; inline caching remembers a call site's last lookup result to speed up future dispatches
Explanation
Statically typed OOP languages resolve dynamic dispatch through per-class vtables built at compile time. Dynamic-language runtimes (V8, Smalltalk VMs) instead use inline caches that remember which method was found for a given receiver shape, avoiding repeated lookups for monomorphic call sites.
Progress
77/100