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

📄 instructions2.doc8.html

📁 Jvm 规范说明。The Java Virtual Machine was designed to support the Java programming language. Some concep
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<tr><td><a name="69363"></a>
 <i>indexbyte1</i>
<td><a name="87568"></a>
 

<tr><td><a name="69365"></a>
 <i>indexbyte2</i>
<td><a name="87568"></a>
 

</Table><br><br> (wide index)<p>
<a name="ldc_w.Forms"></a>
<b>Forms</h3></b>
<a name="69367"></a>
<i>ldc_w</i> = 19 (0x13)<p>
<a name="ldc_w.Stack"></a>
<b>Stack</h3></b>
<a name="69368"></a>
... <img src="chars/arrwdbrt.gif"> ..., <i>item</i><p>
<a name="ldc_w.Description"></a>
<b>Description</h3></b>
<a name="69369"></a>
The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are assembled into an unsigned 16-bit index into the constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the value of the index is calculated as (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The index must be a valid index into the constant pool of the current class. The constant pool entry at the index must be a <code>CONSTANT_Integer</code> <a href="ClassFile.doc.html#21942">(&#167;4.4.4)</a>, <code>CONSTANT_Float</code> <a href="ClassFile.doc.html#21942">(&#167;4.4.4)</a>, or <code>CONSTANT_String</code> <a href="ClassFile.doc.html#8794">(&#167;4.4.3)</a>. The constant pool entry is resolved (<a href="ConstantPool.doc.html#38759">&#167;5.4</a>, <a href="ConstantPool.doc.html#49466">&#167;5.5)</a>. If the entry is a <code>CONSTANT_Integer</code> or <code>CONSTANT_Float</code>, it must contain a numeric <i>item</i> which is pushed onto the operand stack as an <code>int</code> or <code>float</code>, respectively.<p>
<a name="69385"></a>
If the entry at the constant pool index is a <code>CONSTANT_String</code>, it must contain a <code>CONSTANT_Utf8</code> <a href="ClassFile.doc.html#7963">(&#167;4.4.7)</a> string. An instance of class <code>String</code> is created and initialized to the <code>CONSTANT_Utf8</code> string. The <i>item</i>, a <code>reference</code> to the instance, is pushed onto the operand stack.<p>
<a name="ldc_w.Linking"></a>
<b>Linking Exceptions</h3></b>
<a name="117427"></a>
During resolution of a <code>CONSTANT_String </code>constant pool item, any of the exceptions documented in <a href="ConstantPool.doc.html#38759">&#167;5.4</a> can be thrown.<p>
<b>Notes</h3></b>
<a name="125478"></a>
The <i>ldc_w</i> instruction is identical to the <i>ldc</i> instruction except for its wider constant pool index.<p>

<a name="ldc2_w"></a>
<hr><h2>ldc2_w</h2>
<a name="ldc2_w.Operation"></a>
<b>Operation</h3></b>
<a name="69403"></a>
Push <code>long</code> or <code>double</code> from constant pool<p><Table Border="1">
<tr><td><a name="69398"></a>
 <i>ldc2_w</i>
<td><a name="87568"></a>
 

<tr><td><a name="69400"></a>
 <i>indexbyte1</i>
<td><a name="87568"></a>
 

<tr><td><a name="69402"></a>
 <i>indexbyte2</i>
<td><a name="87568"></a>
 

</Table><br><br> (wide index)<p>
<a name="ldc2_w.Forms"></a>
<b>Forms</h3></b>
<a name="69404"></a>
<i>ldc2_w</i> = 20 (0x14)<p>
<a name="ldc2_w.Stack"></a>
<b>Stack</h3></b>
<a name="69405"></a>
... <img src="chars/arrwdbrt.gif"> ...,<em> </em><i>item.word1</i>, <i>item.word2</i><p>
<a name="ldc2_w.Description"></a>
<b>Description</h3></b>
<a name="69406"></a>
The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are assembled into an unsigned 16-bit index into the constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the value of the index is calculated as (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The index must be a valid index into the constant pool of the current class. The constant pool entry at the index must be a <code>CONSTANT_Long</code> <a href="ClassFile.doc.html#1348">(&#167;4.4.5)</a> or <code>CONSTANT_Double</code> <a href="ClassFile.doc.html#1348">(&#167;4.4.5)</a>. The constant pool entry is resolved <a href="ConstantPool.doc.html#49466">(&#167;5.5)</a>. The entry must contain a numeric <i>item</i> which is pushed onto the operand stack as a <code>long</code> or <code>double</code>, respectively.<p>
<a name="ldc2_w.Notes"></a>
<b>Notes</h3></b>
<a name="69419"></a>
Only a wide-index version of the <i>ldc2_w</i> instruction exists; there is no <i>ldc2</i> instruction that pushes a <code>long</code> or <code>double</code> with a single-byte index.<p>

<a name="ldiv"></a>
<hr><h2>ldiv</h2>
<a name="ldiv.Operation"></a>
<b>Operation</h3></b>
<a name="69429"></a>
Divide <code>long</code><p><Table Border="1">
<tr><td><a name="69428"></a>
 <i>ldiv</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="ldiv.Forms"></a>
<b>Forms</h3></b>
<a name="69430"></a>
<i>ldiv</i> = 109 (0x6d)<p>
<a name="ldiv.Stack"></a>
<b>Stack</h3></b>
<a name="69431"></a>
..., <i>value1.word1</i>, <i>value1.word2</i>, <i>value2.word1</i>, <i>value2.word2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result.word1</i>, <i>result.word2</i><p>
<a name="ldiv.Description"></a>
<b>Description</h3></b>
<a name="69432"></a>
Both <i>value1</i> and <i>value2</i> must be of type <code>long</code>. The values are popped from the operand stack. The <code>long</code> <i>result</i> is the value of the Java expression <i>value1</i> / <i>value2</i>. The <i>result</i> is pushed onto the operand stack.<p>
<a name="69433"></a>
A <code>long</code> division rounds towards 0; that is, the quotient produced for <code>long</code> values in <i>n </i>/ <i>d</i> is a <code>long</code> value <i>q</i> whose magnitude is as large as possible while satisfying <br><br><img src="Instructions2.doc.anc10.gif">
<br><br>. Moreover, <i>q </i>is positive when <br><br><img src="Instructions2.doc.anc11.gif">
<br><br> and <i>n</i> and <i>d</i> have the same sign, but <i>q</i> is negative when <br><br><img src="Instructions2.doc.anc12.gif">
<br><br> and <i>n</i> and <i>d </i>have opposite signs. <p>
<a name="69443"></a>
There is one special case that does not satisfy this rule: if the dividend is the negative integer of largest possible magnitude for the <code>long</code> type and the divisor is -<code>1</code>, then overflow occurs and the result is equal to the dividend; despite the overflow, no exception is thrown in this case. <p>
<a name="ldiv.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="69445"></a>
If the value of the divisor in a <code>long</code> division is 0, <i>ldiv</i> throws an <code>ArithmeticException</code>.<p>

<a name="lload"></a>
<hr><h2>lload</h2>
<a name="lload.Operation"></a>
<b>Operation</h3></b>
<a name="69454"></a>
Load <code>long</code> from local variable<p><Table Border="1">
<tr><td><a name="69451"></a>
 <i>lload</i>
<td><a name="87568"></a>
 

<tr><td><a name="69453"></a>
 <i>index</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="lload.Forms"></a>
<b>Forms</h3></b>
<a name="69455"></a>
<i>lload</i> = 22 (0x16)<p>
<a name="lload.Stack"></a>
<b>Stack</h3></b>
<a name="69456"></a>
... <img src="chars/arrwdbrt.gif"> ..., <i>value.word1</i>, <i>value.word2</i><p>
<a name="lload.Description"></a>
<b>Description</h3></b>
<a name="69457"></a>
The <i>index</i> is an unsigned byte. Both <i>index</i> and <i>index </i>+ 1 must be valid indices into the local variables of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The local variables at <i>index</i> and <i>index </i>+ 1 together must contain a <code>long</code>. The <i>value</i> of the local variables at <i>index</i> and <i>index </i>+ 1 is pushed onto the operand stack. <p>
<a name="lload.Notes"></a>
<b>Notes</h3></b>
<a name="69461"></a>
The <i>lload</i> opcode can be used in conjunction with the <i>wide</i> instruction to access a local variable using a two-byte unsigned index.<p>

<a name="lload_n"></a>
<hr><h2>lload_&lt;n&gt;</h2>
<a name="lload_n.Operation"></a>
<b>Operation</h3></b>
<a name="69471"></a>
Load <code>long</code> from local variable<p><Table Border="1">
<tr><td><a name="69470"></a>
 <i>lload_&lt;n&gt;</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="lload_n.Forms"></a>
<b>Forms</h3></b>
<a name="69472"></a>
<i>lload_0</i> = 30 (0x1e)<i></i><p>
<a name="178043"></a>
<i>lload_1</i> = 31 (0x1f)<i></i><p>
<a name="178045"></a>
<i>lload_2</i> = 32 (0x20)<i></i><p>
<a name="178047"></a>
<i>lload_3</i> = 33 (0x21)<p>
<a name="lload_n.Stack"></a>
<b>Stack</h3></b>
<a name="69473"></a>
... <img src="chars/arrwdbrt.gif"> ..., <i>value.word1</i>, <i>value.word2</i><p>
<a name="lload_n.Description"></a>
<b>Description</h3></b>
<a name="69474"></a>
Both <i>&lt;n&gt;</i> and <i>&lt;n&gt; </i>+ 1 must be valid indices into the local variables of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The local variables at <i>&lt;n&gt;</i> and <i>&lt;n&gt; </i>+ 1 together must contain a <code>long</code>. The <i>value</i> of the local variables at <i>&lt;n&gt;</i> and <i>&lt;n&gt; </i>+ 1 is pushed onto the operand stack. <p>
<a name="lload_n.Notes"></a>
<b>Notes</h3></b>
<a name="69478"></a>
Each of the <i>lload_&lt;n&gt;</i> instructions is the same as <i>lload</i> with an <i>index</i> of <i>&lt;n&gt;</i>, except that the operand <i>&lt;n&gt;</i> is implicit.<p>

<a name="lmul"></a>
<hr><h2>lmul</h2>
<a name="lmul.Operation"></a>
<b>Operation</h3></b>
<a name="69488"></a>
Multiply <code>long</code><p><Table Border="1">
<tr><td><a name="69487"></a>
 <i>lmul</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="lmul.Forms"></a>
<b>Forms</h3></b>
<a name="69489"></a>
<i>lmul</i> = 105 (0x69)<p>
<a name="lmul.Stack"></a>
<b>Stack</h3></b>
<a name="69490"></a>
..., <i>value1.word1</i>, <i>value1.word2</i>, <i>value2.word1</i>, <i>value2.word2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result.word1</i>, <i>result.word2</i><p>
<a name="lmul.Description"></a>
<b>Description</h3></b>
<a name="69491"></a>
Both <i>value1</i> and <i>value2</i> must be of type <code>long</code>. The values are popped from the operand stack. The <code>long</code> <i>result</i> is <i>value1</i> * <i>value2</i>. The <i>result</i> is pushed onto the operand stack.<p>
<a name="69492"></a>
If a <code>long</code> multiplication overflows, then the result is the low-order bits of the mathematical product represented as a <code>long</code>. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical product of the two values.<p>

<a name="lneg"></a>
<hr><h2>lneg</h2>
<a name="lneg.Operation"></a>
<b>Operation</h3></b>
<a name="69508"></a>
Negate <code>long</code><p><Table Border="1">
<tr><td><a name="69507"></a>
 <i>lneg</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="lneg.Forms"></a>
<b>Forms</h3></b>
<a name="69509"></a>
<i>lneg</i><em> </em>= 117 (0x75)<p>
<a name="lneg.Stack"></a>
<b>Stack</h3></b>
<a name="69510"></a>
..., <i>value.word1</i><em>, </em><i>value.word2</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>result.word1</i><em>, </em><i>result.word2</i><p>
<a name="lneg.Description"></a>
<b>Description</h3></b>
<a name="69511"></a>
The <i>value</i> must be of type <code>long</code>. It is popped from the operand stack. The <code>long</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.<p>
<a name="69512"></a>
For <code>long</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>long</code> results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown. <p>
<a name="69513"></a>
For all <code>long</code> values <code>x</code>, -<code>x</code> equals <code>(~x)</code> <code>+</code> <code>1</code>.<p>

<a name="lookupswitch"></a>
<hr><h2>lookupswitch</h2>
<a name="lookupswitch.Operation"></a>
<b>Operation</h3></b>
<a name="69543"></a>
Access jump table by key match and jump<p><Table Border="1">
<tr><td><a name="69522"></a>
 <i>lookupswitch</i>
<td><a name="87568"></a>
 

<tr><td><a name="69524"></a>
 <<i>0-3 byte pad</i>>
<td><a name="87568"></a>
 

<tr><td><a name="69526"></a>
 <i>defaultbyte1</i>
<td><a name="87568"></a>
 

<tr><td><a name="69528"></a>
 <i>defaultbyte2</i>
<td><a name="87568"></a>
 

<tr><td><a name="69530"></a>
 <i>defaultbyte3</i>
<td><a name="87568"></a>
 

<tr><td><a name="69532"></a>
 <i>defaultbyte4</i>
<td><a name="87568"></a>
 

<tr><td><a name="69534"></a>
 <i>npairs1</i>
<td><a name="87568"></a>
 

<tr><td><a name="69536"></a>
 <i>npairs2</i>
<td><a name="87568"></a>
 

<tr><td><a name="69538"></a>
 <i>npairs3</i>
<td><a name="87568"></a>
 

<tr><td><a name="69540"></a>
 <i>npairs4</i>
<td><a name="87568"></a>
 

<tr><td><a name="69542"></a>
 <i>match-offset pairs</i>...
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="lookupswitch.Forms"></a>
<b>Forms</h3></b>
<a name="69544"></a>
<i>lookupswitch</i> = 171 (0xab)<p>
<a name="lookupswitch.Stack"></a>
<b>Stack</h3></b>
<a name="69545"></a>
..., <i>key</i> <img src="chars/arrwdbrt.gif"> ...<p>
<a name="lookupswitch.Description"></a>
<b>Description</h3></b>
<a name="69546"></a>
A <i>lookupswitch</i> is a variable-length instruction. Immediately after the <i>lookupswitch</i> opcode, between zero and three null bytes (zeroed bytes, not the null object) are inserted as padding. The number of null bytes is chosen so that the <i>defaultbyte1</i> begins at an address that is a multiple of four bytes from the start of the current method (the opcode of its first instruction). Immediately after the padding follow a series of signed 32-bit values: <i>default</i>, <i>npairs</i>, and then <i>npairs</i> pairs of signed 32-bit values. The <i>npairs</i> must be greater than or equal to 0. Each of the <i>npairs</i> pairs consists of an <code>int</code> <i>match</i> and a signed 32-bit <i>offset</i>. Each of these signed 32-bit values is constructed from four unsigned bytes as (<i>byte1</i> << 24) | (<i>byte2</i> << 16) | (<i>byte3</i> << 8) | <i>byte4</i>.<p>

<a name="lookupswitch"></a>
<hr><h2>lookupswitch</h2>
<a name="69547"></a>
The table <i>match</i>-<i>offset</i> pairs of the <i>lookupswitch</i> instruction must be sorted in increasing numerical order by <i>match</i>.<p>
<a name="69548"></a>
The <i>key</i> must be of type <code>int</code> and is popped from the operand stack. The <i>key</i> is compared against the <i>match</i> values. If it is equal to one of them, then a target address is calculated by adding the corresponding <i>offset</i> to the address of the opcode of this <i>lookupswitch</i> instruction. If the <i>key</i> does not match any of the <i>match</i> values, the target address is calculated by adding <i>default</i> to the address of the opcode of this <i>lookupswitch</i> instruction. Execution then continues at the target address.<p>
<a name="69549"></a>
The target address that can be calculated from the offset of each <i>match-offset</i> pair, as well as the one calculated from <i>default</i>, must be the address of an opcode of an instruction within the method that contains this <i>lookupswitch</i> instruction.<p>
<a name="lookupswitch.Notes"></a>
<b>Notes</h3></b>
<a name="69550"></a>
The alignment required of the 4-byte operands of the <i>lookupswitch</i> instruction guarantees 4-byte alignment of those operands if and only if the method that contains the <i>lookupswitch</i> is positioned on a 4-byte boundary.<p>

⌨️ 快捷键说明

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