⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quick2.doc3.html

📁 Jvm 规范说明。The Java Virtual Machine was designed to support the Java programming language. Some concep
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</Table>
; dispatch based on class<p>
<a name="instanceof_quick.Forms"></a>
<b>Forms</b><br>
<a name="12460"></a>
<i>invokevirtual_quick</i> = 214 (0xd6)<p>
<a name="instanceof_quick.Stack"></a>
<b>Stack</b><br>
<a name="5162"></a>
...<em>, </em><i>objectref</i><em>, [</em><i>arg1</i><em>, [</em><i>arg2</i><em> </em>...<em>]] </em><img src="chars/arrwdbrt.gif"> ...<p>
<a name="instanceof_quick.Description"></a>
<b>Description</b><br>
<a name="11507"></a>
The <i>objectref</i> must be of type <code>reference</code> and must reference a class instance. The <i>index</i> operand is an unsigned byte, and the <i>nargs</i> operand is an unsigned byte, which must not be zero. The <i>index</i> is an index into the method table of the class of the type of <i>objectref</i>. The table entry at that index includes the method's code and its modifier information (see <a href="ClassFile.doc.html#12725">Table 4.4, "Method access and modifier flags"</a>).<p>
<a name="18595"></a>
If the method is <code>synchronized</code>, the monitor associated with <i>objectref</i> is acquired.<p>
<a name="22239"></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="22259"></a>
 invokevirtual_quick	 (cont.)	invokevirtual_quick (cont.)<p>
<a name="22241"></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="instanceof_quick.Linking"></a>
<b>Linking Exception</b><br>
<a name="12125"></a>
If the specified method is <code>native</code> and the code that implements the method cannot be loaded or linked, the <i>invokevirtual_quick</i> instruction throws an <code>UnsatisfiedLinkError</code>.<p>
<a name="instanceof_quick.Runtime"></a>
<b>Runtime Exception</b><br>
<a name="5166"></a>
Otherwise, if <i>objectref</i> is <code>null</code>, the <i>invokevirtual_quick</i> instruction throws a <code>NullPointerException</code>. <p>
<a name="instanceof_quick.Notes"></a>
<b>Notes</b><br>
<a name="5168"></a>
The opcode of this instruction was originally <i>invokevirtual</i>, with <i>objectref</i> not referring to an instance of <code>java.lang.Object</code> and with operands determined dynamically to represent a method with a method table index of 255 or less. When the constant pool entry referenced by an <i>invokevirtual</i> instruction is resolved, a one-byte index for the method it references is generated. That index replaces the first operand byte of the original <i>invokevirtual</i> instruction. The second operand byte of the <i>invokevirtual</i> instruction is replaced by <i>nargs</i>, the number of argument words expected by the method.<p>
<a name="12640"></a>
An <i>invokevirtual</i> instruction referring to an instance of <code>java.lang.Object</code> and with operands representing a constant pool index of 255 or less will instead be converted into an <i>invokevirtualobject_quick</i> instruction. Any <i>invokevirtual</i> instruction with operands representing a constant pool index greater than 255 will be converted into an <i>invokevirtual_quick_w</i> instruction.<p>
<a name="12635"></a>
 invokevirtual_quick_w		invokevirtual_quick_w<p>
<a name="instanceof_quick.Operation"></a>
<b>Operation</b><br>
<a name="6740"></a>
Invoke instance method<p>
<Table Border="0">
<tr><td><a name="6735"></a>
 <i>invokevirtual_quick_w</i>
<td><a name="638"></a>
 

<tr><td><a name="6737"></a>
 <i>indexbyte1</i>
<td><a name="645"></a>
 

<tr><td><a name="6739"></a>
 <i>indexbyte2</i>
<td><a name="652"></a>
 

</Table>
, dispatching on class (wide index)<p>
<a name="instanceof_quick.Forms"></a>
<b>Forms</b><br>
<a name="12461"></a>
<i>invokevirtual_quick_w</i> = 226 (0xe2)<p>
<a name="instanceof_quick.Stack"></a>
<b>Stack</b><br>
<a name="6741"></a>
...<em>, </em><i>objectref</i><em>, [</em><i>arg1</i><em>, [</em><i>arg2</i><em> </em>...<em>]] </em><img src="chars/arrwdbrt.gif"> ...<p>
<a name="instanceof_quick.Description"></a>
<b>Description</b><br>
<a name="8709"></a>
The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The constant pool item at the index must be a <code>CONSTANT_Methodref</code> <a href="ClassFile.doc.html#4723">(&#167;4.4.2)</a> which must already have been resolved successfully. The constant pool entry representing the resolved method includes an unsigned <i>index</i> into the method table of the resolved class and an unsigned byte <i>nargs</i> which must not be zero.<p>
<a name="11542"></a>
The <i>objectref</i> must be of type <code>reference</code>. The <i>index</i> is used as an index into the method table of the class of the type of <i>objectref</i>. If the <i>objectref</i> is an array type, then the method table of class <code>Object</code> is used. The table entry at that index includes the method's code and its modifier information (see <a href="ClassFile.doc.html#12725">Table 4.4, "Method access and modifier flags"</a>).<p>
<a name="18603"></a>
If the method is <code>synchronized</code>, the monitor associated with <i>objectref</i> is acquired.<p>
<a name="22268"></a>
 invokevirtual_quick_w	 (cont.)	invokevirtual_quick_w (cont.)<p>
<a name="18604"></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="18605"></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="instanceof_quick.Linking"></a>
<b>Linking Exception</b><br>
<a name="12154"></a>
If the specified method is <code>native</code> and the code that implements the method cannot be loaded or linked, the <i>invokevirtual_quick_w</i> instruction throws an <code>UnsatisfiedLinkError</code>.<p>
<a name="instanceof_quick.Runtime"></a>
<b>Runtime Exception</b><br>
<a name="6745"></a>
Otherwise, if <i>objectref</i> is <code>null</code>, the <i>invokevirtual_quick_w</i> instruction throws a <code>NullPointerException</code>. <p>
<a name="instanceof_quick.Notes"></a>
<b>Notes</b><br>
<a name="6747"></a>
The opcode of this instruction was originally <i>invokevirtual</i>, with operands determined dynamically to represent a method with a method table index greater than 255. The operands of the <i>invokevirtual</i> instruction are not modified.<p>
<a name="9000"></a>
The <i>invokevirtual_quick</i> and <i>invokevirtualobject_quick</i> instructions only support a one-byte offset into the method table of <i>objectref</i>. The <i>invokevirtual_quick_w</i> instruction can be used to for invocations of methods that cannot be represented using <i>invokevirtual_quick</i>.<p>
<a name="11936"></a>
 invokevirtualobject_quick		invokevirtualobject_quick<p>
<a name="instanceof_quick.Operation"></a>
<b>Operation</b><br>
<a name="9288"></a>
Invoke instance method<p>
<Table Border="0">
<tr><td><a name="9283"></a>
 <i>invokevirtualobject_quick</i>
<td><a name="78"></a>
 

<tr><td><a name="9285"></a>
 <i>index</i>
<td><a name="85"></a>
 

<tr><td><a name="9287"></a>
 <i>nargs</i>
<td><a name="92"></a>
 

</Table>
 of class <code>java.lang.Object</code><p>
<a name="instanceof_quick.Forms"></a>
<b>Forms</b><br>
<a name="12462"></a>
<i>invokevirtualobject_quick</i> = 219 (0xdb)<p>
<a name="instanceof_quick.Stack"></a>
<b>Stack</b><br>
<a name="9289"></a>
...<em>, </em><i>objectref</i><em>, [</em><i>arg1</i><em>, [</em><i>arg2</i><em> </em>...<em>]] </em><img src="chars/arrwdbrt.gif"> ...<p>
<a name="instanceof_quick.Description"></a>
<b>Description</b><br>
<a name="9068"></a>
The <i>objectref</i> must be of type <code>reference</code>. The <i>index</i> operand is an unsigned byte, and the <i>nargs</i> operand is an unsigned byte which must not be zero. The <i>index</i> is an index into the method table of the class of the type of <i>objectref</i>. If the <i>objectref</i> is an array type, then the method table of class <code>Object</code> is used. The table entry at that index includes the method's code and its modifier information (see <a href="ClassFile.doc.html#12725">Table 4.4, "Method access and modifier flags"</a>).<p>
<a name="18607"></a>
If the method is <code>synchronized</code>, the monitor associated with <i>objectref</i> is acquired.<p>
<a name="22862"></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="22863"></a>
 invokevirtualobject_quick	 (cont.)	invokevirtualobject_quick (cont.)<p>
<a name="22864"></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="instanceof_quick.Linking"></a>
<b>Linking Exception</b><br>
<a name="12194"></a>
If the specified method is <code>native</code> and the code that implements the method cannot be loaded or linked, <i>invokevirtual_quick</i> throws an <code>UnsatisfiedLinkError</code>.<p>
<a name="instanceof_quick.Runtime"></a>
<b>Runtime Exception</b><br>
<a name="12078"></a>
Otherwise, if <i>objectref</i> is <code>null</code>, the <i>invokevirtualobject_quick</i> instruction throws a <code>NullPointerException</code>.<p>
<a name="instanceof_quick.Notes"></a>
<b>Notes</b><br>
<a name="9302"></a>
The opcode of this instruction was originally <i>invokevirtual</i>, and it referred to a method of the class <code>java.lang.Object</code> determined dynamically to have a method table index of 255 or less. The <i>invokevirtualobject_quick</i> instruction is specifically for the benefit of arrays.<p>
<a name="5908"></a>
When the constant pool entry referenced by an <i>invokevirtual</i> instruction is resolved, a one-byte index for the method it references is generated. That index replaces the first operand byte of the original <i>invokevirtual</i> instruction. The second operand byte of the <i>invokevirtual</i> instruction is replaced by <i>nargs</i>, the number of argument words expected by the method.<p>
<a name="28017"></a>
The <i>invokevirtualobject_quick</i> instruction only supports a one-byte index into the method table of <i>objectref</i>. Objects with large numbers of methods may not be able to have all their methods referenced with <i>_quick</i> variants. It is always correct, if less efficient, to re-fuse to convert an instance of an <i>invokevirtual</i> instruction to <i>invokevirtualobject_quick</i>.<p>
<a name="12643"></a>
An <i>invokevirtual</i> instruction not referring to an instance of <code>java.lang.Object</code> and with operands representing a constant pool index of 255 or less will instead be converted into an <i>invokevirtual_quick</i> instruction. Any <i>invokevirtual</i> instruction with operands representing a constant pool index greater than 255 will be converted into an <i>invokevirtual_quick_w</i> instruction.<p>


<hr>
<!-- This inserts footnotes--><p><br>
<a href="Copyright.doc.html">Contents</a> | <a href="Quick2.doc2.html">Prev</a> | <a href="Quick2.doc4.html">Next</a> | <a href="Lindholm.INDEX.html">Index</a>
<p>
<font size=-1>Java Virtual Machine Specification (HTML generated by chsieh on March 13, 1997)<br>
<i><a href="Copyright.doc.html">Copyright &#169 1996, 1997 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 + -