Contents | Prev | Next | Index

invokeinterface

Operation
Invoke interface method

invokeinterface
indexbyte1
indexbyte2
nargs
0

Forms
invokeinterface = 185 (0xb9)

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

Description
The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The item at that index in the constant pool must have the tag CONSTANT_InterfaceMethodref (§4.4.2), a reference to an interface name, a method name, and the method's descriptor (§4.3.3). The constant pool item is resolved (§5.3). The interface method must not be <init>, an instance initialization method (§3.8), or <clinit>, a class or interface initialization method (§3.8).

The nargs operand is an unsigned byte which must not be zero. The objectref must be of type reference and must be followed on the operands stack by nargs - 1 words of arguments. The number of words of arguments and the type and order of the values they represent must be consistent with the descriptor of the selected interface method.

The method table of the class of the type of objectref is determined. If objectref is an array type, then the method table of class Object is used. The method table is searched for a method whose name and descriptor are identical to the name and descriptor of the resolved constant pool entry.


Contents | Prev | Next | Index

Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com