📄 instructions2.doc108.html
字号:
<html><head><title>VM Spec </title></head><body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000> <a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc107.html">Prev</a> | <a href="Instructions2.doc109.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><hr><br> <a name="invokespecial"></a><h2>invokespecial</h2><a name="138168"></a>If the method is not <code>native</code>, the <i>nargs </i>- 1 words of arguments and <i>objectref</i> are popped from the operand stack. A new stack frame is created for the method being invoked, and <i>objectref</i> and the words of arguments are made the values of its first <i>nargs</i> local variables, with <i>objectref</i> in local variable <i>0</i>, <i>arg1</i> in local variable <i>1</i>, and so on. The new stack frame is then made current, and the Java Virtual Machine <code>pc</code> is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.<p><a name="138169"></a>If the method is <code>native</code> and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. The <i>nargs </i>- 1 words of arguments and <i>objectref</i> are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.<p><a name="invokespecial.Linking"></a><b>Linking Exceptions</b><br><a name="158759"></a>During resolution of the <code>CONSTANT_Methodref </code>constant pool item, any of the exceptions documented in <a href="ConstantPool.doc.html#49425">§5.2</a> can be thrown.<p><a name="68877"></a>Otherwise, if the specified method exists but is a class (<code>static</code>) method, the <i>invokespecial</i> instruction throws an <code>Incompatible</code><code>ClassChangeError</code>.<p><a name="68878"></a>Otherwise, if the specified method is <code>abstract</code>, <i>invokespecial</i> throws an <code>AbstractMethodError</code>.<p><a name="68879"></a>Otherwise, if the specified method is <code>native</code> and the code that implements the method cannot be loaded or linked, <i>invokespecial</i> throws an <code>UnsatisfiedLinkError</code>.<p><a name="invokespecial.Runtime"></a><b>Runtime Exception</b><br><a name="68881"></a>Otherwise, if <i>objectref</i> is <code>null</code>, the <i>invokespecial</i> instruction throws a <code>NullPointerException</code>. <p><hr><!-- This inserts footnotes--><p><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc107.html">Prev</a> | <a href="Instructions2.doc109.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><p><font size=-1>Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)<br><i><a href="Copyright.doc.html">Copyright © 1996 Sun Microsystems, Inc.</a>All rights reserved</i><br>Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a></font></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -