Invoke a superclass method, dispatching based on compile-time type
Bytecode
Type | Description |
u1 | invokesuper_quick opcode = 0xD8 (216) |
u1 | index |
u1 | nargs |
Stack ..., objectref, [arg1, [arg2 ...]] => ...
The unsigned index points to a method entry. The specified method table entry includes a direct reference to the code for the method, an unsigned byte nargs which must be greater than zero, and the method's modifier information.
If the method is synchronized
, the monitor associated
with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref
are popped from the operand stack. A new stack frame is created for the method being
invoked, and objectref and the words of arguments are made the values of its first nargs
local variables, with objectref in local variable 0, arg1 in local
variable 1, and so on. The new stack frame is then made current, and the Java
Virtual Machine pc
is set to the opcode of the first instruction of the
method to be invoked. Execution continues with the first instruction of the method.
If the method is native
, the nargs - 1 words
of arguments and objectref are popped from the operand stack; the code that
implements the method is invoked in an implementation-dependent manner.
Exceptions
NullPointerException - objectref is null
The opcode of this instruction was originally invokespecial, and the method it invoked was determined dynamically to be a method in a superclass of the current object. The operands of the invokespecial instruction are not modified.
The difference between the invokesuper_quick and the invokevirtual_quick_w instructions is that invokevirtual_quick_w invokes a method based on the class of the object. The invokesuper_quick instruction is used to invoke methods in a superclass of the current class.
The invokesuper_quick instruction was introduced in Sun's JDK 1.0.2 release to fix a bug in earlier versions of the Java Virtual Machine. Prior to that release, the invokespecial instruction (then named invokenonvirtual) would always be converted to the invokenonvirtual_quick instruction.