SLIDE 36 COMP 520 Winter 2019 Virtual Machines (36)
Method Operations
invokespecial m sig [...:o:a1:...:an] -> [...] Internally
// Overloading is already resolved: signature of m is known! entry = lookupClassOnly(m, sig, class(o)); block = block(entry); push stack frame of size: block.locals + block.stacksize; local[0] = o; // local 0 points to "this" local[1] = a_1; ... local[n] = a_n; pc = block.code;
For which method calls is invokespecial used? <init>(..), private, super method calls. invokevirtual uses the class of the object itself, whereas invokespecial calls a specific class in the hierarchy. There are also bytecode instructions invokestatic and invokeinterface