Invoke an instance initialization method or a private method, dispatching based on compile-time type
Bytecode
Type | Description |
u1 | invokenonvirtual_quick opcode = 0xD7 (215) |
u2 | index |
Stack ..., objectref, [arg1, [arg2 ...]] => ...
Description
The unsigned index points at method entry . The constant pool entry representing the resolved method 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.
Exception
NullPointerException - objectref is null
Notes
The opcode of this instruction was originally invokespecial, and the method it
invoked was determined dynamically to be either an instance initialization method <init>
or a private
method. The operands of the invokespecial instruction are
not modified.
The difference between the invokenonvirtual_quick and the invokevirtual_quick_w
instructions is that invokevirtual_quick_w invokes a method based on the actual
(runtime) type of the object. The invokenonvirtual_quick instruction invokes an
instance initialization method or private
method based on the compile-time
type of the object.