📄 instructions2.doc3.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head><title>VM Spec </title></head><body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000><table width=100%><tr><td><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc2.html">Prev</a> | <a href="Instructions2.doc4.html">Next</a> | <a href="VMSpecIX.fm.html">Index</a></td><td align=right><i><i>The Java<sup><font size=-2>TM</font></sup> Virtual Machine Specification</i></i></td></tr></table><hr><br> <a href="Instructions2.doc.html">A</a><a href="Instructions2.doc1.html">B</a><a href="Instructions2.doc2.html">C</a><a href="Instructions2.doc3.html">D</a><a href="Instructions2.doc4.html">F</a><a href="Instructions2.doc5.html">G</a><a href="Instructions2.doc6.html">I</a><a href="Instructions2.doc7.html">J</a><a href="Instructions2.doc8.html">L</a><a href="Instructions2.doc9.html">M</a><a href="Instructions2.doc10.html">N</a><a href="Instructions2.doc11.html">P</a><a href="Instructions2.doc12.html">R</a><a href="Instructions2.doc13.html">S</a><a href="Instructions2.doc14.html">T</a><a href="Instructions2.doc15.html">W</a><a name="d2f"></a><hr><h2>d2f</h2><a name="d2f.Operation"></a><p><b>Operation</b><br><blockquote><a name="67431"></a>Convert <code>double</code> to <code>float</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67430"></a> <i>d2f</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="d2f.Forms"></a><p><b>Forms</b><br><blockquote><a name="67432"></a><i>d2f</i> = 144 (0x90)</blockquote><p><a name="d2f.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67433"></a>..., <i>value</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="d2f.Description"></a><p><b>Description</b><br><blockquote><a name="67434"></a>The <i>value</i> on the top of the operand stack must be of type <code>double</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(§3.8.3)</a> resulting in <i>value'</i>. Then <i>value'</i> is converted to a <code>float</code> <i>result</i> using IEEE 754 round to nearest mode. The <i>result</i> is pushed onto the operand stack.</blockquote><p><blockquote><a name="452590"></a>Where an <i>d2f</i> instruction is FP-strict <a href="Overview.doc.html#28905">(§3.8.2)</a>, the result of the conversion is always rounded to the nearest representable value in the float value set <a href="Overview.doc.html#28147">(§3.3.2)</a>.</blockquote><p><blockquote><a name="452597"></a>Where an <i>d2f</i> instruction is not FP-strict, the result of the conversion may be taken from the float-extended-exponent value set <a href="Overview.doc.html#28147">(§3.3.2)</a>; it is not necessarily rounded to the nearest representable value in the float value set.</blockquote><p><blockquote><a name="67435"></a>A finite <i>value'</i> too small to be represented as a <code>float</code> is converted to a zero of the same sign; a finite <i>value'</i> too large to be represented as a <code>float</code> is converted to an infinity of the same sign. A <code>double</code> NaN is converted to a <code>float</code> NaN.</blockquote><p><a name="d2f.Notes"></a><p><b>Notes</b><br><blockquote><a name="67436"></a>The <i>d2f</i> instruction performs a narrowing primitive conversion <a href="Concepts.doc.html#26142">(§2.6.3)</a>. It may lose information about the overall magnitude of <i>value'</i> and may also lose precision.</blockquote><p><a name="d2i"></a><hr><h2>d2i</h2><a name="d2i.Operation"></a><p><b>Operation</b><br><blockquote><a name="67449"></a>Convert <code>double</code> to <code>int</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67448"></a> <i>d2i</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="d2i.Forms"></a><p><b>Forms</b><br><blockquote><a name="67450"></a><i>d2i</i> = 142 (0x8e)</blockquote><p><a name="d2i.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67451"></a>..., <i>value</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="d2i.Description"></a><p><b>Description</b><br><blockquote><a name="67452"></a>The <i>value</i> on the top of the operand stack must be of type <code>double</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(§3.8.3)</a> resulting in <i>value'</i>. Then <i>value' </i>is converted to an <code>int</code>. The <i>result</i> is pushed onto the operand stack: </blockquote><p><ul><li>If the <i>value'</i> is NaN, the <i>result</i> of the conversion is an <code>int</code> 0. <p><li>Otherwise, if the <i>value'</i> is not an infinity, it is rounded to an integer value <i>V</i>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <i>V</i> can be represented as an <code>int</code>, then the <i>result</i> is the <code>int</code> value <em>V</em>.<p><li>Otherwise, either the <i>value'</i> must be too small (a negative value of large magnitude or negative infinity), and the <i>result</i> is the smallest representable value of type <code>int</code>, or the <i>value'</i> must be too large (a positive value of large magnitude or positive infinity), and the <i>result</i> is the largest representable value of type <code>int</code>.</ul><a name="d2i.Notes"></a><p><b>Notes</b><br><blockquote><a name="67456"></a>The <i>d2i</i> instruction performs a narrowing primitive conversion <a href="Concepts.doc.html#26142">(§2.6.3)</a>. It may lose information about the overall magnitude of <i>value'</i> and may also lose precision.</blockquote><p><a name="d2l"></a><hr><h2>d2l</h2><a name="d2l.Operation"></a><p><b>Operation</b><br><blockquote><a name="67466"></a>Convert <code>double</code> to <code>long</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67465"></a> <i>d2l</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="d2l.Forms"></a><p><b>Forms</b><br><blockquote><a name="67467"></a><i>d2l</i> = 143 (0x8f)</blockquote><p><a name="d2l.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67468"></a>..., <i>value</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="d2l.Description"></a><p><b>Description</b><br><blockquote><a name="67469"></a>The <i>value</i> on the top of the operand stack must be of type <code>double</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(§3.8.3)</a> resulting in <i>value'</i>. Then <i>value' </i>is converted to a <code>long</code>. The <i>result</i> is pushed onto the operand stack: </blockquote><p><ul><li>If the <i>value'</i> is NaN, the <i>result</i> of the conversion is a <code>long</code> 0. <p><li>Otherwise, if the <i>value'</i> is not an infinity, it is rounded to an integer value <i>V</i>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <i>V</i> can be represented as a <code>long</code>, then the <i>result</i> is the <code>long</code> value <em>V</em>.<p><li>Otherwise, either the <i>value'</i> must be too small (a negative value of large magnitude or negative infinity), and the <i>result</i> is the smallest representable value of type <code>long</code>, or the <i>value'</i> must be too large (a positive value of large magnitude or positive infinity), and the <i>result</i> is the largest representable value of type <code>long</code>.</ul><a name="d2l.Notes"></a><p><b>Notes</b><br><blockquote><a name="67473"></a>The <i>d2l</i> instruction performs a narrowing primitive conversion <a href="Concepts.doc.html#26142">(§2.6.3)</a>. It may lose information about the overall magnitude of <i>value'</i> and may also lose precision.</blockquote><p><a name="dadd"></a><hr><h2>dadd</h2><a name="dadd.Operation"></a><p><b>Operation</b><br><blockquote><a name="339346"></a>Add <code>double</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="339343"></a> <i>dadd</i><td><a name="339345"></a> </Table><br></blockquote><p><a name="dadd.Forms"></a><p><b>Forms</b><br><blockquote><a name="339349"></a><i>dadd</i> = 99 (0x63)</blockquote><p><a name="dadd.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67491"></a>..., <i>value1</i>, <i>value2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="dadd.Description"></a><p><b>Description</b><br><blockquote><a name="67492"></a>Both <i>value1</i> and <i>value2</i> must be of type <code>double</code>. The values are popped from the operand stack and undergo value set conversion <a href="Overview.doc.html#33120">(§3.8.3)</a>, resulting in <i>value1'</i> and <i>value2'</i>. The <code>double</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="67493"></a>The result of a <i>dadd</i> instruction is governed by the rules of IEEE arithmetic:</blockquote><p><ul><li>If either <i>value1'</i> or <i>value2'</i> is NaN, the result is NaN.<p><li>The sum of two infinities of opposite sign is NaN.<p><li>The sum of two infinities of the same sign is the infinity of that sign.<p><li>The sum of an infinity and any finite value is equal to the infinity.<p><li>The sum of two zeroes of opposite sign is positive zero.<p><li>The sum of two zeroes of the same sign is the zero of that sign.<p><li>The sum of a zero and a nonzero finite value is equal to the nonzero value.<p><li>The sum of two nonzero finite values of the same magnitude and opposite sign is positive zero.<p><li>In the remaining cases, where neither operand is an infinity, a zero, or NaN and the values have the same sign or have different magnitudes, the sum is computed and rounded to the nearest representable value using IEEE 754 round to nearest mode. If the magnitude is too large to represent as a <code>double</code>, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a <code>double</code>, we say the operation underflows; the result is then a zero of appropriate sign. </ul><blockquote><a name="67503"></a>The Java virtual machine requires support of gradual underflow as defined by IEEE 754. Despite the fact that overflow, underflow, or loss of precision may occur, execution of a <i>dadd</i> instruction never throws a runtime exception.</blockquote><p><a name="daload"></a><hr><h2>daload</h2><a name="daload.Operation"></a><p><b>Operation</b><br><blockquote><a name="67513"></a>Load <code>double</code> from array<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67512"></a> <i>daload</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="daload.Forms"></a><p><b>Forms</b><br><blockquote><a name="67514"></a><i>daload</i> = 49 (0x31)</blockquote><p><a name="daload.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67515"></a>..., <i>arrayref</i>, <i>index</i> <img src="chars/arrwdbrt.gif"> ..., <i>value</i></blockquote><p><a name="daload.Description"></a><p><b>Description</b><br><blockquote><a name="67516"></a>The <i>arrayref</i> must be of type <code>reference</code> and must refer to an array whose components are of type <code>double</code>. The <i>index</i> must be of type <code>int</code>. Both <i>arrayref</i> and <i>index</i> are popped from the operand stack. The <code>double</code> <i>value</i> in the component of the array at <i>index</i> is retrieved and pushed onto the operand stack.</blockquote><p><a name="daload.Runtime"></a><p><b>Runtime Exceptions</b><br><blockquote><a name="67518"></a>If <i>arrayref</i><em> </em>is <code>null</code>, <i>daload</i> throws a <code>NullPointerException</code>. </blockquote><p><blockquote><a name="67519"></a>Otherwise, if <i>index</i> is not within the bounds of the array referenced by <i>arrayref</i>, the <i>daload</i> instruction throws an <code>ArrayIndexOutOfBoundsException</code>.</blockquote><p><a name="dastore"></a><hr><h2>dastore</h2><a name="dastore.Operation"></a><p><b>Operation</b><br><blockquote><a name="67532"></a>Store into <code>double</code> array<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67531"></a> <i>dastore</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="dastore.Forms"></a><p><b>Forms</b><br><blockquote><a name="67533"></a><i>dastore</i> = 82 (0x52)</blockquote><p><a name="dastore.Operand"></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -