Hard
BTB behavior for monomorphic vs. megamorphic virtual calls
A hot call site invokes a virtual function through a vtable pointer (an indirect branch whose target address, not just its taken/not-taken outcome, must be predicted). Case A: the call site is monomorphic, always resolving to the same concrete override at runtime. Case B: the call site is megamorphic, alternating unpredictably among several different concrete overrides across calls. What does the branch target buffer (BTB) do in each case?
4 of 47 in Computer Architecture