invokevirtual_quick_w

Invoke instance method

Bytecode

Type Description
u1 invokevirtual_quick_w opcode = 0xE2 (226)
u2 index

Stack ..., objectref, [arg1, [arg2 ...]] => ...

Description

The unsigned indexpoints to a method entry. The constant pool entry representing the resolved method includes an unsigned index into the method table of the resolved class and an unsigned byte nargs which must not be zero.

The objectref must be of type reference. The index is used as an index into the method table of the class of the type of objectref. If the objectref is an array type, then the method table of class Object is used. The table entry at that index includes the method's code and its 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 and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. 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

Notes

The opcode of this instruction was originally invokevirtual, with operands determined dynamically to represent a method with a method table index greater than 255. The operands of the invokevirtual instruction are not modified.

The invokevirtual_quick and invokevirtualobject_quick instructions only support a one-byte offset into the method table of objectref. The invokevirtual_quick_w instruction can be used to for invocations of methods that cannot be represented using invokevirtual_quick.