Contents | Prev | Next | Index

invokeinterface

The result of the search is a method table entry, which includes a direct reference to the code for the interface method and the method's modifier information (see Table 4.4, "Method access and modifier flags"). The method table entry must be that of a public method.

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.

Linking Exceptions
During resolution of the CONSTANT_InterfaceMethodref constant pool item, any of the exceptions documented in §5.3 can be thrown.

Otherwise, if no method matching the resolved name and descriptor can be found in the class of objectref, invokeinterface throws an IncompatibleClassChangeError.

Otherwise, if the selected method is a class (static) method, the invokeinterface instruction throws an IncompatibleClass-ChangeError.


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