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

📄 instructions2.doc6.html

📁 A Java virtual machine instruction consists of an opcode specifying the operation to be performed, f
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</Table><br></blockquote><p><a name="iload.Forms"></a><p><b>Forms</b><br><blockquote><a name="68640"></a><i>iload</i> = 21 (0x15)</blockquote><p><a name="iload.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68641"></a>... <img src="chars/arrwdbrt.gif"> ..., <i>value</i></blockquote><p><a name="iload.Description"></a><p><b>Description</b><br><blockquote><a name="68642"></a>The <i>index</i> is an unsigned byte that must be an index into the local variable array of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The local variable at <i>index</i> must contain an <code>int</code>. The <i>value</i> of the local variable at <i>index </i>is pushed onto the operand stack.</blockquote><p><a name="iload.Notes"></a><p><b>Notes</b><br><blockquote><a name="68646"></a>The <i>iload</i> opcode can be used in conjunction with the <i>wide</i> instruction to access a local variable using a two-byte unsigned index.</blockquote><p><a name="iload_n"></a><hr><h2>iload_&lt;n&gt;</h2><a name="iload_n.Operation"></a><p><b>Operation</b><br><blockquote><a name="68656"></a>Load <code>int</code> from local variable<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68655"></a> <i>iload_&lt;n&gt;</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="iload_n.Forms"></a><p><b>Forms</b><br><blockquote><a name="68657"></a><i>iload_0</i> = 26 (0x1a) <i>iload_1</i> = 27 (0x1b) <i>iload_2</i> = 28 (0x1c) <i>iload_3</i> = 29 (0x1d)</blockquote><p><a name="iload_n.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68658"></a>... <img src="chars/arrwdbrt.gif"> ..., <i>value</i></blockquote><p><a name="iload_n.Description"></a><p><b>Description</b><br><blockquote><a name="68659"></a>The <i>&lt;n&gt;</i> must be an index into the local variable array of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The local variable at <i>&lt;n&gt;</i> must contain an <code>int</code>. The <i>value</i> of the local variable at <i>&lt;n&gt;</i> is pushed onto the operand stack.</blockquote><p><a name="iload_n.Notes"></a><p><b>Notes</b><br><blockquote><a name="68663"></a>Each of the <i>iload_&lt;n&gt;</i> instructions is the same as <i>iload</i> with an <i>index</i> of <i>&lt;n&gt;</i>, except that the operand <i>&lt;n&gt;</i> is implicit.</blockquote><p><a name="imul"></a><hr><h2>imul</h2><a name="imul.Operation"></a><p><b>Operation</b><br><a name="68676"></a><blockquote> Multiply <code>int</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68675"></a> <i>imul</i><td><a name="87568"></a> </Table><br><p><a name="imul.Forms"></a></blockquote><p><b>Forms</b><br><blockquote><a name="68677"></a><i>imul</i> = 104 (0x68)</blockquote><p><a name="imul.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68678"></a>..., <i>value1</i><em>, </em><i>value2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="imul.Description"></a><p><b>Description</b><br><blockquote><a name="68679"></a>Both <i>value1</i> and <i>value2</i> must be of type <code>int</code>. The values are popped from the operand stack. The <code>int</code> <i>result</i> is <i>value1</i> * <i>value2</i>. The <i>result</i> is pushed onto the operand stack.</blockquote><p><blockquote><a name="448651"></a>The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type <code>int</code>. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical sum of the two values.</blockquote><p><blockquote><a name="448652"></a>Despite the fact that overflow may occur, execution of an <i>imul</i> instruction never throws a runtime exception.</blockquote><p><blockquote><a name="448649"></a></blockquote><p><a name="ineg"></a><hr><h2>ineg</h2><a name="ineg.Operation"></a><p><b>Operation</b><br><blockquote><a name="68687"></a>Negate <code>int</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68686"></a> <i>ineg</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="ineg.Forms"></a><p><b>Forms</b><br><blockquote><a name="68688"></a><i>ineg</i><em> </em>= 116 (0x74)</blockquote><p><a name="ineg.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68689"></a>..., <i>value</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="ineg.Description"></a><p><b>Description</b><br><blockquote><a name="68690"></a>The <i>value</i> must be of type <code>int</code>. It is popped from the operand stack. The <code>int</code> <i>result</i> is the arithmetic negation of <i>value</i>, -<i>value</i>. The <i>result</i> is pushed onto the operand stack.</blockquote><p><blockquote><a name="68691"></a>For <code>int</code> values, negation is the same as subtraction from zero. Because the Java virtual machine uses two's-complement representation for integers and the range of two's-complement values is not symmetric, the negation of the maximum negative <code>int</code> results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown. </blockquote><p><blockquote><a name="68692"></a>For all <code>int</code> values <code>x</code>, -<code>x</code> equals (~<code>x</code>) + <code>1</code>.</blockquote><p><a name="instanceof"></a><hr><h2>instanceof</h2><a name="instanceof.Operation"></a><p><b>Operation</b><br><blockquote><a name="68727"></a><p>Determine if object is of given type<Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68722"></a> <i>instanceof</i><td><a name="87568"></a> <tr><td><a name="68724"></a> <i>indexbyte1</i><td><a name="87568"></a> <tr><td><a name="68726"></a> <i>indexbyte2</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="instanceof.Forms"></a><p><b>Forms</b><br><blockquote><a name="68728"></a><i>instanceof</i> = 193 (0xc1)</blockquote><p><a name="instanceof.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68729"></a>..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="instanceof.Description"></a><p><b>Description</b><br><blockquote><a name="68730"></a>The <i>objectref</i>, which must be of type <code>reference</code>, is popped from the operand stack. The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the runtime constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the value of the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The runtime constant pool item at the index must be a symbolic reference to a class, array, or interface type. The named class, array, or interface type is resolved <a href="ConstantPool.doc.html#71636">(&#167;5.4.3.1)</a>.</blockquote><p><blockquote><a name="140275"></a>If <i>objectref</i> is not <code>null</code> and is an instance of the resolved class or array or implements the resolved interface, the <i>instanceof</i> instruction pushes an <code>int</code> <i>result</i> of <i>1</i> as an int on the operand stack. Otherwise, it pushes an <code>int</code> <i>result</i> of <i>0</i>.</blockquote><p><blockquote><a name="68740"></a>The following rules are used to determine whether an <i>objectref</i> that is not <code>null</code> is an instance of the resolved type: If S is the class of the object referred to by <i>objectref</i> and T is the resolved class, array, or interface type, <i>instanceof</i> determines whether <i>objectref</i> is an instance of T as follows:</blockquote><p><ul><li>If S is an ordinary (nonarray) class, then:<p><ul><li>If T is a class type, then S must be the same class <a href="Concepts.doc.html#20389">(&#167;2.8.1)</a> as  T or a subclass of T.<p><li>If T is an interface type, then S must implement <a href="Concepts.doc.html#16432">(&#167;2.13)</a> interface T.</ul></ul><ul><li>If S is an interface type, then:<p><ul><li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.7)</a>.<p><li>If T is an interface type, then T must be the same interface as  S, or a superinterface of S <a href="Concepts.doc.html#20603">(&#167;2.13.2)</a>.<p></ul><li>If S is a class representing the array type SC<code>[]</code>, that is, an array  of components of type SC, then:<p><ul><li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.7)</a>.<p><li>If T is an array type TC<code>[]</code>, that is, an array of components of type TC, then one of the following must be true:<p><ul><li>TC and SC are the same primitive type <a href="Concepts.doc.html#19511">(&#167;2.4.1)</a>.<p><li>TC and SC are reference types <a href="Concepts.doc.html#29375">(&#167;2.4.6)</a>, and type SC can be cast to TC by these runtime rules. <p></ul><li>If T is an interface type, T must be one of the interfaces implemented by arrays <a href="Concepts.doc.html#16446">(&#167;2.15)</a>. </ul></ul><a name="instanceof.Linking"></a><p><b>Linking Exceptions</b><br><blockquote><a name="115905"></a>During resolution of symbolic reference to the class, array, or interface type, any of the exceptions documented in <a href="ConstantPool.doc.html#71636">Section 5.4.3.1</a> can be thrown.</blockquote><p><a name="instanceof.Notes"></a><p><b>Notes</b><br><blockquote><a name="68766"></a>The <i>instanceof</i> instruction is very similar to the <i>checkcast</i> instruction. It differs in its treatment of <code>null</code>, its behavior when its test fails (<i>checkcast</i> throws an exception, <i>instanceof</i> pushes a result code), and its effect on the operand stack.</blockquote><p><blockquote><a name="68767"></a></blockquote><p><a name="invokeinterface"></a><hr><h2>invokeinterface</h2><a name="invokeinterface.Operation"></a><p><b>Operation</b><br><blockquote><a name="68788"></a>Invoke interface method<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68779"></a> <i>invokeinterface</i><td><a name="87568"></a> <tr><td><a name="68781"></a> <i>indexbyte1</i><td><a name="87568"></a> <tr><td><a name="68783"></a> <i>indexbyte2</i><td><a name="87568"></a> <tr><td><a name="68785"></a> <i>count</i><td><a name="87568"></a> <tr><td><a name="68787"></a> <i>0</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="invokeinterface.Forms"></a><p><b>Forms</b><br><blockquote><a name="68789"></a><i>invokeinterface</i> = 185 (0xb9)</blockquote><p><a name="invokeinterface.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68790"></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"> ...</blockquote><p><a name="invokeinterface.Description"></a><p><b>Description</b><br><blockquote><a name="285957"></a>The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the runtime constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the value of the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The runtime constant pool item at that index must be a symbolic reference to an interface method <a href="ConstantPool.doc.html#73272">(&#167;5.1)</a>, which gives the name and descriptor <a href="ClassFile.doc.html#7035">(&#167;4.3.3)</a> of the interface method as well as a symbolic reference to the interface in which the interface method is to be found. The named interface method is resolved <a href="ConstantPool.doc.html#71722">(&#167;5.4.3.4)</a>. The interface method must not be an instance initialization method <a href="Overview.doc.html#12174">(&#167;3.9)</a> or the class or interface initialization method <a href="Overview.doc.html#12174">(&#167;3.9)</a>.</blockquote><p><blockquote><a name="395205"></a>The <i>count</i> operand is an unsigned byte that must not be zero. The <i>objectref</i> must be of type <code>reference</code> and must be followed on the operand stack by <i>nargs</i> argument values, where the number, type, and order of the values must be consistent with the descriptor of the resolved interface method. The value of the fourth operand byte must always be zero.</blockquote><p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -