-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjvm_spec.html
1 lines (1 loc) · 566 KB
/
jvm_spec.html
1
<div class="section-execution" title="aaload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.aaload"></a><span class="emphasis"><em>aaload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16476"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">reference</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16480"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>aaload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16484"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>aaload</em></span> = 50 (0x32)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16488"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aaload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.aaload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">reference</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">reference</code> <span class="emphasis"><em>value</em></span> in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved and pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aaload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.aaload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>aaload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.aaload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>aaload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="aastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.aastore"></a><span class="emphasis"><em>aastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16524"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">reference</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16528"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>aastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16532"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>aastore</em></span> = 83 (0x53)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16536"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">reference</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>, and <span class="emphasis"><em>value</em></span> must be of type <code class="literal">reference</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-200"></a> If <span class="emphasis"><em>value</em></span> is <code class="literal">null</code>, then <span class="emphasis"><em>value</em></span> is stored as the component of the array at <span class="emphasis"><em>index</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-210"></a> Otherwise, <span class="emphasis"><em>value</em></span> is non-<code class="literal">null</code>. If the type of <span class="emphasis"><em>value</em></span> is assignment compatible with the type of the components of the array referenced by <span class="emphasis"><em>arrayref</em></span>, then <span class="emphasis"><em>value</em></span> is stored as the component of the array at <span class="emphasis"><em>index</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300"></a> The following rules are used to determine whether a <span class="emphasis"><em>value</em></span> that is not <code class="literal">null</code> is assignment compatible with the array component type. If <span class="type">S</span> is the type of the object referred to by <span class="emphasis"><em>value</em></span>, and <span class="type">T</span> is the reference type of the array components, then <span class="emphasis"><em>aastore</em></span> determines whether assignment is compatible as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-A"></a> If <span class="type">S</span> is a class type, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-A-A"></a> If <span class="type">T</span> is a class type, then <span class="type">S</span> must be the same class as <span class="type">T</span>, or <span class="type">S</span> must be a subclass of <span class="type">T</span>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-A-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">S</span> must implement interface <span class="type">T</span>.</p></li></ul></div></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B"></a> If <span class="type">S</span> is an array type <span class="type">SC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">SC</span>, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B-A"></a> If <span class="type">T</span> is a class type, then <span class="type">T</span> must be <code class="literal">Object</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">T</span> must be one of the interfaces implemented by arrays (JLS §4.10.3).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B-C"></a> If <span class="type">T</span> is an array type <span class="type">TC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">TC</span>, then one of the following must be true:</p><div class="norm"><ul class="norm" type="square"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B-C-A"></a> <span class="type">TC</span> and <span class="type">SC</span> are the same primitive type.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.aastore.desc-300-B-C-B"></a> <span class="type">TC</span> and <span class="type">SC</span> are reference types, and type <span class="type">SC</span> is assignable to <span class="type">TC</span> by these run-time rules.</p></li></ul></div></li></ul></div></li></ul></div></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.aastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>aastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.aastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>aastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p><p class="norm-error"><a name="jvms-6.5.aastore.runtime-120"></a> Otherwise, if <span class="emphasis"><em>arrayref</em></span> is not <code class="literal">null</code> and the actual type of the non-<code class="literal">null</code> <span class="emphasis"><em>value</em></span> is not assignment compatible with the actual type of the components of the array, <span class="emphasis"><em>aastore</em></span> throws an <code class="literal">ArrayStoreException</code>.</p></div></div><div class="section-execution" title="aconst_null"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.aconst_null"></a><span class="emphasis"><em>aconst_null</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16648"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">null</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16652"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>aconst_null</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16656"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>aconst_null</em></span> = 1 (0x1)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16660"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <code class="literal">null</code></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aconst_null.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.aconst_null.desc-100"></a> Push the <code class="literal">null</code> object <code class="literal">reference</code> onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aconst_null.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.aconst_null.notes-100"></a> The Java Virtual Machine does not mandate a concrete value for <code class="literal">null</code>.</p></div></div><div class="section-execution" title="aload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.aload"></a><span class="emphasis"><em>aload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16678"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">reference</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16682"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>aload</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16687"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>aload</em></span> = 25 (0x19)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16691"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>objectref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.aload.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <span class="emphasis"><em>index</em></span> must contain a <code class="literal">reference</code>. The <span class="emphasis"><em>objectref</em></span> in the local variable at <span class="emphasis"><em>index</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.aload.notes-100"></a> The <span class="emphasis"><em>aload</em></span> instruction cannot be used to load a value of type <code class="literal">returnAddress</code> from a local variable onto the operand stack. This asymmetry with the <span class="emphasis"><em>astore</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.astore" title="astore">§<span class="emphasis"><em>astore</em></span></a>) is intentional.</p><p class="norm"><a name="jvms-6.5.aload.notes-200"></a> The <span class="emphasis"><em>aload</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="aload_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.aload_n"></a><span class="emphasis"><em>aload_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16720"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">reference</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16724"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>aload_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16728"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>aload_0</em></span> = 42 (0x2a)</p><p class="norm"><span class="emphasis"><em>aload_1</em></span> = 43 (0x2b)</p><p class="norm"><span class="emphasis"><em>aload_2</em></span> = 44 (0x2c)</p><p class="norm"><span class="emphasis"><em>aload_3</em></span> = 45 (0x2d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16738"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>objectref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aload_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.aload_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <<span class="emphasis"><em>n</em></span>> must contain a <code class="literal">reference</code>. The <span class="emphasis"><em>objectref</em></span> in the local variable at <<span class="emphasis"><em>n</em></span>> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.aload_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.aload_n.notes-100"></a> An <span class="emphasis"><em>aload_<n></em></span> instruction cannot be used to load a value of type <code class="literal">returnAddress</code> from a local variable onto the operand stack. This asymmetry with the corresponding <span class="emphasis"><em>astore_<n></em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.astore_n" title="astore_">§<span class="emphasis"><em>astore_<n></em></span></a>) is intentional.</p><p class="norm"><a name="jvms-6.5.aload_n.notes-200"></a> Each of the <span class="emphasis"><em>aload_<n></em></span> instructions is the same as <span class="emphasis"><em>aload</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="anewarray"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.anewarray"></a><span class="emphasis"><em>anewarray</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16769"></a>Operation</h4></div></div></div><p class="norm">Create new array of <code class="literal">reference</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16773"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>anewarray</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16779"></a>Forms</h4></div></div></div><p class="norm">anewarray = 189 (0xbd)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16782"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>count</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>arrayref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.anewarray.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.anewarray.desc-100"></a> The <span class="emphasis"><em>count</em></span> must be of type <code class="literal">int</code>. It is popped off the operand stack. The <span class="emphasis"><em>count</em></span> represents the number of components of the array to be created. The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry 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 class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>). A new array with components of that type, of length <span class="emphasis"><em>count</em></span>, is allocated from the garbage-collected heap, and a <code class="literal">reference</code> <span class="emphasis"><em>arrayref</em></span> to this new array object is pushed onto the operand stack. All components of the new array are initialized to <code class="literal">null</code>, the default value for <code class="literal">reference</code> types (<a class="xref" href="jvms-2.html#jvms-2.4" title="2.4. Reference Types and Values">§2.4</a>).</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.anewarray.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.anewarray.linking-100"></a> During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in <a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a> can be thrown.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.anewarray.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.anewarray.runtime-100"></a> Otherwise, if <span class="emphasis"><em>count</em></span> is less than zero, the <span class="emphasis"><em>anewarray</em></span> instruction throws a <code class="literal">NegativeArraySizeException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.anewarray.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.anewarray.notes-100"></a> The <span class="emphasis"><em>anewarray</em></span> instruction is used to create a single dimension of an array of object references or part of a multidimensional array.</p></div></div><div class="section-execution" title="areturn"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.areturn"></a><span class="emphasis"><em>areturn</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16825"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">reference</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16829"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>areturn</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16833"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>areturn</em></span> = 176 (0xb0)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16837"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.areturn.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.areturn.desc-100"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code> and must refer to an object of a type that is assignment compatible (JLS §5.2) with the type represented by the return descriptor (<a class="xref" href="jvms-4.html#jvms-4.3.3" title="4.3.3. Method Descriptors">§4.3.3</a>) of the current method. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, <span class="emphasis"><em>objectref</em></span> is popped from the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</p><p class="norm-dynamic"><a name="jvms-6.5.areturn.desc-110"></a> The interpreter then reinstates the frame of the invoker and returns control to the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.areturn.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.areturn.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>areturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is synchronized.</p><p class="norm-error"><a name="jvms-6.5.areturn.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>areturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="arraylength"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.arraylength"></a><span class="emphasis"><em>arraylength</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16872"></a>Operation</h4></div></div></div><p class="norm">Get length of array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16875"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>arraylength</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16879"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>arraylength</em></span> = 190 (0xbe)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16883"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>length</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.arraylength.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.arraylength.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array. It is popped from the operand stack. The <span class="emphasis"><em>length</em></span> of the array it references is determined. That <span class="emphasis"><em>length</em></span> is pushed onto the operand stack as an <code class="literal">int</code>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.arraylength.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.arraylength.runtime-100"></a> If the <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>arraylength</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p></div></div><div class="section-execution" title="astore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.astore"></a><span class="emphasis"><em>astore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16908"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">reference</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16912"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>astore</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16917"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>astore</em></span> = 58 (0x3a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16921"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.astore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.astore.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>objectref</em></span> on the top of the operand stack must be of type <code class="literal">returnAddress</code> or of type <code class="literal">reference</code>. It is popped from the operand stack, and the value of the local variable at <span class="emphasis"><em>index</em></span> is set to <span class="emphasis"><em>objectref</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.astore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.astore.notes-100"></a> The <span class="emphasis"><em>astore</em></span> instruction is used with an <span class="emphasis"><em>objectref</em></span> of type <code class="literal">returnAddress</code> when implementing the <code class="literal">finally</code> clause of the Java programming language (<a class="xref" href="jvms-3.html#jvms-3.13" title="3.13. Compiling finally">§3.13</a>).</p><p class="norm"><a name="jvms-6.5.astore.notes-200"></a> The <span class="emphasis"><em>aload</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.aload" title="aload">§<span class="emphasis"><em>aload</em></span></a>) cannot be used to load a value of type <code class="literal">returnAddress</code> from a local variable onto the operand stack. This asymmetry with the <span class="emphasis"><em>astore</em></span> instruction is intentional.</p><p class="norm"><a name="jvms-6.5.astore.notes-300"></a> The <span class="emphasis"><em>astore</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="astore_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.astore_n"></a><span class="emphasis"><em>astore_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16957"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">reference</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16961"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>astore_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16965"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>astore_0</em></span> = 75 (0x4b)</p><p class="norm"><span class="emphasis"><em>astore_1</em></span> = 76 (0x4c)</p><p class="norm"><span class="emphasis"><em>astore_2</em></span> = 77 (0x4d)</p><p class="norm"><span class="emphasis"><em>astore_3</em></span> = 78 (0x4e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e16975"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.astore_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.astore_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>objectref</em></span> on the top of the operand stack must be of type <code class="literal">returnAddress</code> or of type <code class="literal">reference</code>. It is popped from the operand stack, and the value of the local variable at <<span class="emphasis"><em>n</em></span>> is set to <span class="emphasis"><em>objectref</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.astore_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.astore_n.notes-100"></a> An <span class="emphasis"><em>astore_<n></em></span> instruction is used with an <span class="emphasis"><em>objectref</em></span> of type <code class="literal">returnAddress</code> when implementing the <code class="literal">finally</code> clauses of the Java programming language (<a class="xref" href="jvms-3.html#jvms-3.13" title="3.13. Compiling finally">§3.13</a>).</p><p class="norm"><a name="jvms-6.5.astore_n.notes-200"></a> An <span class="emphasis"><em>aload_<n></em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.aload_n" title="aload_">§<span class="emphasis"><em>aload_<n></em></span></a>) cannot be used to load a value of type <code class="literal">returnAddress</code> from a local variable onto the operand stack. This asymmetry with the corresponding <span class="emphasis"><em>astore_<n></em></span> instruction is intentional.</p><p class="norm"><a name="jvms-6.5.astore_n.notes-300"></a> Each of the <span class="emphasis"><em>astore_<n></em></span> instructions is the same as <span class="emphasis"><em>astore</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="athrow"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.athrow"></a><span class="emphasis"><em>athrow</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17013"></a>Operation</h4></div></div></div><p class="norm">Throw exception or error</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17016"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>athrow</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17020"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>athrow</em></span> = 191 (0xbf)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17024"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm"><span class="emphasis"><em>objectref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.athrow.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.athrow.desc-100"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code> and must refer to an object that is an instance of class <code class="literal">Throwable</code> or of a subclass of <code class="literal">Throwable</code>. It is popped from the operand stack. The <span class="emphasis"><em>objectref</em></span> is then thrown by searching the current method (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) for the first exception handler that matches the class of <span class="emphasis"><em>objectref</em></span>, as given by the algorithm in <a class="xref" href="jvms-2.html#jvms-2.10" title="2.10. Exceptions">§2.10</a>.</p><p class="norm-dynamic"><a name="jvms-6.5.athrow.desc-110"></a> If an exception handler that matches <span class="emphasis"><em>objectref</em></span> is found, it contains the location of the code intended to handle this exception. The <code class="literal">pc</code> register is reset to that location, the operand stack of the current frame is cleared, <span class="emphasis"><em>objectref</em></span> is pushed back onto the operand stack, and execution continues.</p><p class="norm-dynamic"><a name="jvms-6.5.athrow.desc-120"></a> If no matching exception handler is found in the current frame, that frame is popped. If the current frame represents an invocation of a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>). Finally, the frame of its invoker is reinstated, if such a frame exists, and the <span class="emphasis"><em>objectref</em></span> is rethrown. If no such frame exists, the current thread exits.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.athrow.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.athrow.runtime-100"></a> If <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>athrow</em></span> throws a <code class="literal">NullPointerException</code> instead of <span class="emphasis"><em>objectref</em></span>.</p><p class="norm-error"><a name="jvms-6.5.athrow.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the method of the current frame is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>athrow</em></span> throws an <code class="literal">IllegalMonitorStateException</code> instead of the object previously being thrown. This can happen, for example, if an abruptly completing <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is synchronized.</p><p class="norm-error"><a name="jvms-6.5.athrow.runtime-120"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>athrow</em></span> throws an <code class="literal">IllegalMonitorStateException</code> instead of the object previously being thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.athrow.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.athrow.notes-100"></a> The operand stack diagram for the <span class="emphasis"><em>athrow</em></span> instruction may be misleading: If a handler for this exception is matched in the current method, the <span class="emphasis"><em>athrow</em></span> instruction discards all the values on the operand stack, then pushes the thrown object onto the operand stack. However, if no handler is matched in the current method and the exception is thrown farther up the method invocation chain, then the operand stack of the method (if any) that handles the exception is cleared and <span class="emphasis"><em>objectref</em></span> is pushed onto that empty operand stack. All intervening frames from the method that threw the exception up to, but not including, the method that handles the exception are discarded.</p></div></div><div class="section-execution" title="baload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.baload"></a><span class="emphasis"><em>baload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17080"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">byte</code> or <code class="literal">boolean</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17085"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>baload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17089"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>baload</em></span> = 51 (0x33)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17093"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.baload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.baload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">byte</code> or of type <code class="literal">boolean</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">byte</code> <span class="emphasis"><em>value</em></span> in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved, sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>value</em></span>, and pushed onto the top of the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.baload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.baload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>baload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.baload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>baload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.baload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.baload.notes-100"></a> The <span class="emphasis"><em>baload</em></span> instruction is used to load values from both <code class="literal">byte</code> and <code class="literal">boolean</code> arrays. In Oracle's Java Virtual Machine implementation, <code class="literal">boolean</code> arrays - that is, arrays of type <code class="literal">T_BOOLEAN</code> (<a class="xref" href="jvms-2.html#jvms-2.2" title="2.2. Data Types">§2.2</a>, <a class="xref" href="jvms-6.html#jvms-6.5.newarray" title="newarray">§<span class="emphasis"><em>newarray</em></span></a>) - are implemented as arrays of 8-bit values. Other implementations may implement packed <code class="literal">boolean</code> arrays; the <span class="emphasis"><em>baload</em></span> instruction of such implementations must be used to access those arrays.</p></div></div><div class="section-execution" title="bastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.bastore"></a><span class="emphasis"><em>bastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17144"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">byte</code> or <code class="literal">boolean</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17149"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>bastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17153"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>bastore</em></span> = 84 (0x54)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17157"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.bastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.bastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">byte</code> or of type <code class="literal">boolean</code>. The <span class="emphasis"><em>index</em></span> and the <span class="emphasis"><em>value</em></span> must both be of type <code class="literal">int</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.bastore.desc-110"></a> If the <span class="emphasis"><em>arrayref</em></span> refers to an array whose components are of type <code class="literal">byte</code>, then the <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is truncated to a <code class="literal">byte</code> and stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.bastore.desc-120"></a> If the <span class="emphasis"><em>arrayref</em></span> refers to an array whose components are of type <code class="literal">boolean</code>, then the <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is narrowed by taking the bitwise AND of <span class="emphasis"><em>value</em></span> and 1; the result is stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.bastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.bastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>bastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.bastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>bastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.bastore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.bastore.notes-100"></a> The <span class="emphasis"><em>bastore</em></span> instruction is used to store values into both <code class="literal">byte</code> and <code class="literal">boolean</code> arrays. In Oracle's Java Virtual Machine implementation, <code class="literal">boolean</code> arrays - that is, arrays of type <code class="literal">T_BOOLEAN</code> (<a class="xref" href="jvms-2.html#jvms-2.2" title="2.2. Data Types">§2.2</a>, <a class="xref" href="jvms-6.html#jvms-6.5.newarray" title="newarray">§<span class="emphasis"><em>newarray</em></span></a>) - are implemented as arrays of 8-bit values. Other implementations may implement packed <code class="literal">boolean</code> arrays; in such implementations the <span class="emphasis"><em>bastore</em></span> instruction must be able to store <code class="literal">boolean</code> values into packed <code class="literal">boolean</code> arrays as well as <code class="literal">byte</code> values into <code class="literal">byte</code> arrays.</p></div></div><div class="section-execution" title="bipush"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.bipush"></a><span class="emphasis"><em>bipush</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17223"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">byte</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17227"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>bipush</em></span><br> <span class="emphasis"><em>byte</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17232"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>bipush</em></span> = 16 (0x10)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17236"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.bipush.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.bipush.desc-100"></a> The immediate <span class="emphasis"><em>byte</em></span> is sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>value</em></span>. That <span class="emphasis"><em>value</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="caload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.caload"></a><span class="emphasis"><em>caload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17252"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">char</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17256"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>caload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17260"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>caload</em></span> = 52 (0x34)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17264"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.caload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.caload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">char</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The component of the array at <span class="emphasis"><em>index</em></span> is retrieved and zero-extended to an <code class="literal">int</code> <span class="emphasis"><em>value</em></span>. That <span class="emphasis"><em>value</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.caload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.caload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>caload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.caload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>caload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="castore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.castore"></a><span class="emphasis"><em>castore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17301"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">char</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17305"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>castore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17309"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>castore</em></span> = 85 (0x55)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17313"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.castore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.castore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">char</code>. The <span class="emphasis"><em>index</em></span> and the <span class="emphasis"><em>value</em></span> must both be of type <code class="literal">int</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is truncated to a <code class="literal">char</code> and stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.castore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.castore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>castore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.castore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>castore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="checkcast"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.checkcast"></a><span class="emphasis"><em>checkcast</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17352"></a>Operation</h4></div></div></div><p class="norm">Check whether object is of given type</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17355"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>checkcast</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17361"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>checkcast</em></span> = 192 (0xc0)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17365"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>objectref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.checkcast.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-100"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code>. The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a class, array, or interface type.</p><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-110"></a> If <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, then the operand stack is unchanged.</p><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-120"></a> Otherwise, the named class, array, or interface type is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>). If <span class="emphasis"><em>objectref</em></span> can be cast to the resolved class, array, or interface type, the operand stack is unchanged; otherwise, the <span class="emphasis"><em>checkcast</em></span> instruction throws a <code class="literal">ClassCastException</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200"></a> The following rules are used to determine whether an <span class="emphasis"><em>objectref</em></span> that is not <code class="literal">null</code> can be cast to the resolved type. If <span class="type">S</span> is the type of the object referred to by <span class="emphasis"><em>objectref</em></span>, and <span class="type">T</span> is the resolved class, array, or interface type, then <span class="emphasis"><em>checkcast</em></span> determines whether <span class="emphasis"><em>objectref</em></span> can be cast to type <span class="type">T</span> as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-A"></a> If <span class="type">S</span> is a class type, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-A-A"></a> If <span class="type">T</span> is a class type, then <span class="type">S</span> must be the same class as <span class="type">T</span>, or <span class="type">S</span> must be a subclass of <span class="type">T</span>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-A-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">S</span> must implement interface <span class="type">T</span>.</p></li></ul></div></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B"></a> If <span class="type">S</span> is an array type <span class="type">SC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">SC</span>, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B-A"></a> If <span class="type">T</span> is a class type, then <span class="type">T</span> must be <code class="literal">Object</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">T</span> must be one of the interfaces implemented by arrays (JLS §4.10.3).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B-C"></a> If <span class="type">T</span> is an array type <span class="type">TC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">TC</span>, then one of the following must be true:</p><div class="norm"><ul class="norm" type="square"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B-C-A"></a> <span class="type">TC</span> and <span class="type">SC</span> are the same primitive type.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.checkcast.desc-200-B-C-B"></a> <span class="type">TC</span> and <span class="type">SC</span> are reference types, and type <span class="type">SC</span> can be cast to <span class="type">TC</span> by recursive application of these rules.</p></li></ul></div></li></ul></div></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.checkcast.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.checkcast.linking-100"></a> During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in <a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a> can be thrown.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.checkcast.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.checkcast.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> cannot be cast to the resolved class, array, or interface type, the <span class="emphasis"><em>checkcast</em></span> instruction throws a <code class="literal">ClassCastException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.checkcast.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.checkcast.notes-100"></a> The <span class="emphasis"><em>checkcast</em></span> instruction is very similar to the <span class="emphasis"><em>instanceof</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.instanceof" title="instanceof">§<span class="emphasis"><em>instanceof</em></span></a>). It differs in its treatment of <code class="literal">null</code>, its behavior when its test fails (<span class="emphasis"><em>checkcast</em></span> throws an exception, <span class="emphasis"><em>instanceof</em></span> pushes a result code), and its effect on the operand stack.</p></div></div><div class="section-execution" title="d2f"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.d2f"></a><span class="emphasis"><em>d2f</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17472"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">double</code> to <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17477"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>d2f</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17481"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>d2f</em></span> = 144 (0x90)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17485"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2f.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.d2f.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to a <code class="literal">float</code> result using IEEE 754 round to nearest mode. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.d2f.desc-200"></a> Where an <span class="emphasis"><em>d2f</em></span> instruction is FP-strict (<a class="xref" href="jvms-2.html#jvms-2.8.2" title="2.8.2. Floating-Point Modes">§2.8.2</a>), the result of the conversion is always rounded to the nearest representable value in the float value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.d2f.desc-210"></a> Where an <span class="emphasis"><em>d2f</em></span> instruction is not FP-strict, the result of the conversion may be taken from the float-extended-exponent value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>); it is not necessarily rounded to the nearest representable value in the float value set.</p><p class="norm-dynamic"><a name="jvms-6.5.d2f.desc-300"></a> A finite <span class="emphasis"><em>value</em></span>' too small to be represented as a <code class="literal">float</code> is converted to a zero of the same sign; a finite <span class="emphasis"><em>value</em></span>' too large to be represented as a <code class="literal">float</code> is converted to an infinity of the same sign. A <code class="literal">double</code> NaN is converted to a <code class="literal">float</code> NaN.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2f.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.d2f.notes-100"></a> The <span class="emphasis"><em>d2f</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>' and may also lose precision.</p></div></div><div class="section-execution" title="d2i"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.d2i"></a><span class="emphasis"><em>d2i</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17524"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">double</code> to <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17529"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>d2i</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17533"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>d2i</em></span> = 142 (0x8e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17537"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2i.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.d2i.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to an <code class="literal">int</code>. The result is pushed onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2i.desc-100-A"></a> If the <span class="emphasis"><em>value</em></span>' is NaN, the <span class="emphasis"><em>result</em></span> of the conversion is an <code class="literal">int</code> 0.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2i.desc-100-B"></a> Otherwise, if the <span class="emphasis"><em>value</em></span>' is not an infinity, it is rounded to an integer value <span class="type">V</span>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <span class="type">V</span> can be represented as an <code class="literal">int</code>, then the result is the <code class="literal">int</code> value <span class="type">V</span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2i.desc-100-C"></a> Otherwise, either the <span class="emphasis"><em>value</em></span>' must be too small (a negative value of large magnitude or negative infinity), and the <span class="emphasis"><em>result</em></span> is the smallest representable value of type <code class="literal">int</code>, or the <span class="emphasis"><em>value</em></span>' must be too large (a positive value of large magnitude or positive infinity), and the <span class="emphasis"><em>result</em></span> is the largest representable value of type <code class="literal">int</code>.</p></li></ul></div></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2i.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.d2i.notes-100"></a> The <span class="emphasis"><em>d2i</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>' and may also lose precision.</p></div></div><div class="section-execution" title="d2l"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.d2l"></a><span class="emphasis"><em>d2l</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17583"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">double</code> to <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17588"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>d2l</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17592"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>d2l</em></span> = 143 (0x8f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17596"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2l.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.d2l.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to a <code class="literal">long</code>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2l.desc-100-A"></a> If the <span class="emphasis"><em>value</em></span>' is NaN, the <span class="emphasis"><em>result</em></span> of the conversion is a <code class="literal">long</code> 0.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2l.desc-100-B"></a> Otherwise, if the <span class="emphasis"><em>value</em></span>' is not an infinity, it is rounded to an integer value <span class="type">V</span>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <span class="type">V</span> can be represented as a <code class="literal">long</code>, then the <span class="emphasis"><em>result</em></span> is the <code class="literal">long</code> value <span class="type">V</span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.d2l.desc-100-C"></a> Otherwise, either the <span class="emphasis"><em>value</em></span>' must be too small (a negative value of large magnitude or negative infinity), and the <span class="emphasis"><em>result</em></span> is the smallest representable value of type <code class="literal">long</code>, or the <span class="emphasis"><em>value</em></span>' must be too large (a positive value of large magnitude or positive infinity), and the <span class="emphasis"><em>result</em></span> is the largest representable value of type <code class="literal">long</code>.</p></li></ul></div></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.d2l.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.d2l.notes-100"></a> The <span class="emphasis"><em>d2l</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>' and may also lose precision.</p></div></div><div class="section-execution" title="dadd"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dadd"></a><span class="emphasis"><em>dadd</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17644"></a>Operation</h4></div></div></div><p class="norm">Add <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17648"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dadd</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17652"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dadd</em></span> = 99 (0x63)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17656"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dadd.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">double</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' + <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200"></a> The result of a <span class="emphasis"><em>dadd</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-B"></a> The sum of two infinities of opposite sign is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-C"></a> The sum of two infinities of the same sign is the infinity of that sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-D"></a> The sum of an infinity and any finite value is equal to the infinity.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-E"></a> The sum of two zeroes of opposite sign is positive zero.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-F"></a> The sum of two zeroes of the same sign is the zero of that sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-G"></a> The sum of a zero and a nonzero finite value is equal to the nonzero value.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-H"></a> The sum of two nonzero finite values of the same magnitude and opposite sign is positive zero.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-200-I"></a> 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 class="literal">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 class="literal">double</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.dadd.desc-300"></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 <span class="emphasis"><em>dadd</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="daload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.daload"></a><span class="emphasis"><em>daload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17708"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">double</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17712"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>daload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17716"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>daload</em></span> = 49 (0x31)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17720"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.daload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.daload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">double</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">double</code> value in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved and pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.daload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.daload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>daload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.daload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>daload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="dastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dastore"></a><span class="emphasis"><em>dastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17755"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">double</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17759"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17763"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dastore</em></span> = 82 (0x52)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17767"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">double</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>, and value must be of type <code class="literal">double</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">double</code> <span class="emphasis"><em>value</em></span> undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>', which is stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.dastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>dastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.dastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>dastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="dcmp"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dcmp_op"></a><span class="emphasis"><em>dcmp<op></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17807"></a>Operation</h4></div></div></div><p class="norm">Compare <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17811"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dcmp<op></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17815"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dcmpg</em></span> = 152 (0x98)</p><p class="norm"><span class="emphasis"><em>dcmpl</em></span> = 151 (0x97)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17821"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dcmp_op.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. A floating-point comparison is performed:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-100-A"></a> If <span class="emphasis"><em>value1</em></span>' is greater than <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value 1 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-100-B"></a> Otherwise, if <span class="emphasis"><em>value1</em></span>' is equal to <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value 0 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-100-C"></a> Otherwise, if <span class="emphasis"><em>value1</em></span>' is less than <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value -1 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-100-D"></a> Otherwise, at least one of <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN. The <span class="emphasis"><em>dcmpg</em></span> instruction pushes the <code class="literal">int</code> value 1 onto the operand stack and the <span class="emphasis"><em>dcmpl</em></span> instruction pushes the <code class="literal">int</code> value -1 onto the operand stack.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.dcmp_op.desc-200"></a> Floating-point comparison is performed in accordance with IEEE 754. All values other than NaN are ordered, with negative infinity less than all finite values and positive infinity greater than all finite values. Positive zero and negative zero are considered equal.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dcmp_op.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.dcmp_op.notes-100"></a> The <span class="emphasis"><em>dcmpg</em></span> and <span class="emphasis"><em>dcmpl</em></span> instructions differ only in their treatment of a comparison involving NaN. NaN is unordered, so any <code class="literal">double</code> comparison fails if either or both of its operands are NaN. With both <span class="emphasis"><em>dcmpg</em></span> and <span class="emphasis"><em>dcmpl</em></span> available, any <code class="literal">double</code> comparison may be compiled to push the same <span class="emphasis"><em>result</em></span> onto the operand stack whether the comparison fails on non-NaN values or fails because it encountered a NaN. For more information, see <a class="xref" href="jvms-3.html#jvms-3.5" title="3.5. More Control Examples">§3.5</a>.</p></div></div><div class="section-execution" title="dconst_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dconst_d"></a><span class="emphasis"><em>dconst_<d></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17877"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17881"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dconst_<d></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17885"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dconst_0</em></span> = 14 (0xe)</p><p class="norm"><span class="emphasis"><em>dconst_1</em></span> = 15 (0xf)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17891"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <<span class="emphasis"><em>d</em></span>></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dconst_d.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dconst_d.desc-100"></a> Push the <code class="literal">double</code> constant <<span class="emphasis"><em>d</em></span>> (0.0 or 1.0) onto the operand stack.</p></div></div><div class="section-execution" title="ddiv"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ddiv"></a><span class="emphasis"><em>ddiv</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17905"></a>Operation</h4></div></div></div><p class="norm">Divide <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17909"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ddiv</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17913"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ddiv</em></span> = 111 (0x6f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17917"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ddiv.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">double</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200"></a> The result of a <span class="emphasis"><em>ddiv</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result is positive if both values have the same sign, negative if the values have different signs.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-C"></a> Division of an infinity by an infinity results in NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-D"></a> Division of an infinity by a finite value results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-E"></a> Division of a finite value by an infinity results in a signed zero, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-F"></a> Division of a zero by a zero results in NaN; division of zero by any other finite value results in a signed zero, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-G"></a> Division of a nonzero finite value by a zero results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-200-H"></a> In the remaining cases, where neither operand is an infinity, a zero, or NaN, the quotient is computed and rounded to the nearest <code class="literal">double</code> using IEEE 754 round to nearest mode. If the magnitude is too large to represent as a <code class="literal">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 class="literal">double</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.ddiv.desc-300"></a> The Java Virtual Machine requires support of gradual underflow as defined by IEEE 754. Despite the fact that overflow, underflow, division by zero, or loss of precision may occur, execution of a <span class="emphasis"><em>ddiv</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="dload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dload"></a><span class="emphasis"><em>dload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17970"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">double</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17974"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dload</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17979"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dload</em></span> = 24 (0x18)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e17983"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dload.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <span class="emphasis"><em>index</em></span> must contain a <code class="literal">double</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <span class="emphasis"><em>index</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.dload.notes-100"></a> The <span class="emphasis"><em>dload</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="dload_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dload_n"></a><span class="emphasis"><em>dload_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18009"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">double</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18013"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dload_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18017"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dload_0</em></span> = 38 (0x26)</p><p class="norm"><span class="emphasis"><em>dload_1</em></span> = 39 (0x27)</p><p class="norm"><span class="emphasis"><em>dload_2</em></span> = 40 (0x28)</p><p class="norm"><span class="emphasis"><em>dload_3</em></span> = 41 (0x29)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18027"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dload_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dload_n.desc-100"></a> Both <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <<span class="emphasis"><em>n</em></span>> must contain a <code class="literal">double</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <<span class="emphasis"><em>n</em></span>> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dload_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.dload_n.notes-100"></a> Each of the <span class="emphasis"><em>dload_<n></em></span> instructions is the same as <span class="emphasis"><em>dload</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="dmul"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dmul"></a><span class="emphasis"><em>dmul</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18054"></a>Operation</h4></div></div></div><p class="norm">Multiply <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18058"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dmul</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18062"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dmul</em></span> = 107 (0x6b)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18066"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dmul.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">double</code> result is <span class="emphasis"><em>value1</em></span>' * <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200"></a> The result of a <span class="emphasis"><em>dmul</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result is positive if both values have the same sign and negative if the values have different signs.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200-C"></a> Multiplication of an infinity by a zero results in NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200-D"></a> Multiplication of an infinity by a finite value results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-200-E"></a> In the remaining cases, where neither an infinity nor NaN is involved, the product 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 class="literal">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 class="literal">double</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.dmul.desc-300"></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 <span class="emphasis"><em>dmul</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="dneg"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dneg"></a><span class="emphasis"><em>dneg</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18111"></a>Operation</h4></div></div></div><p class="norm">Negate <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18115"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dneg</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18119"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dneg</em></span> = 119 (0x77)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18123"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dneg.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-100"></a> The value must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The <code class="literal">double</code> <span class="emphasis"><em>result</em></span> is the arithmetic negation of <span class="emphasis"><em>value</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-200"></a> For <code class="literal">double</code> values, negation is not the same as subtraction from zero. If <code class="literal">x</code> is <code class="literal">+0.0</code>, then <code class="literal">0.0-x</code> equals <code class="literal">+0.0</code>, but <code class="literal">-x</code> equals <code class="literal">-0.0</code>. Unary minus merely inverts the sign of a <code class="literal">double</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-300"></a> Special cases of interest:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-300-A"></a> If the operand is NaN, the result is NaN (recall that NaN has no sign).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-300-B"></a> If the operand is an infinity, the result is the infinity of opposite sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.dneg.desc-300-C"></a> If the operand is a zero, the result is the zero of opposite sign.</p></li></ul></div></div></div><div class="section-execution" title="drem"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.drem"></a><span class="emphasis"><em>drem</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18160"></a>Operation</h4></div></div></div><p class="norm">Remainder <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18164"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>drem</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18168"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>drem</em></span> = 115 (0x73)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18172"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.drem.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is calculated and pushed onto the operand stack as a <code class="literal">double</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-200"></a> The result of a <span class="emphasis"><em>drem</em></span> instruction is not the same as that of the so-called remainder operation defined by IEEE 754. The IEEE 754 "remainder" operation computes the remainder from a rounding division, not a truncating division, and so its behavior is <span class="emphasis"><em>not</em></span> analogous to that of the usual integer remainder operator. Instead, the Java Virtual Machine defines <span class="emphasis"><em>drem</em></span> to behave in a manner analogous to that of the Java Virtual Machine integer remainder instructions (<span class="emphasis"><em>irem</em></span> and <span class="emphasis"><em>lrem</em></span>); this may be compared with the C library function <code class="literal">fmod</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300"></a> The result of a <span class="emphasis"><em>drem</em></span> instruction is governed by these rules:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result equals the sign of the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-C"></a> If the dividend is an infinity or the divisor is a zero or both, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-D"></a> If the dividend is finite and the divisor is an infinity, the result equals the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-E"></a> If the dividend is a zero and the divisor is finite, the result equals the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-300-F"></a> In the remaining cases, where neither operand is an infinity, a zero, or NaN, the floating-point remainder <span class="emphasis"><em>result</em></span> from a dividend <span class="emphasis"><em>value1</em></span>' and a divisor <span class="emphasis"><em>value2</em></span>' is defined by the mathematical relation <span class="emphasis"><em>result</em></span> = <span class="emphasis"><em>value1</em></span>' - (<span class="emphasis"><em>value2</em></span>' * <span class="emphasis"><em>q</em></span>), where <span class="emphasis"><em>q</em></span> is an integer that is negative only if <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>' is negative, and positive only if <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>' is positive, and whose magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.drem.desc-400"></a> Despite the fact that division by zero may occur, evaluation of a <span class="emphasis"><em>drem</em></span> instruction never throws a run-time exception. Overflow, underflow, or loss of precision cannot occur.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.drem.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.drem.notes-100"></a> The IEEE 754 remainder operation may be computed by the library routine <code class="literal">Math.IEEEremainder</code>.</p></div></div><div class="section-execution" title="dreturn"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dreturn"></a><span class="emphasis"><em>dreturn</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18240"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">double</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18244"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dreturn</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18248"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dreturn</em></span> = 175 (0xaf)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18252"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dreturn.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dreturn.desc-100"></a> The current method must have return type <code class="literal">double</code>. The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">double</code>. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, <span class="emphasis"><em>value</em></span> is popped from the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The <span class="emphasis"><em>value</em></span>' is pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</p><p class="norm-dynamic"><a name="jvms-6.5.dreturn.desc-110"></a> The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dreturn.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.dreturn.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>dreturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is synchronized.</p><p class="norm-error"><a name="jvms-6.5.dreturn.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>dreturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="dstore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dstore"></a><span class="emphasis"><em>dstore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18290"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">double</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18294"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dstore</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18299"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dstore</em></span> = 57 (0x39)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18303"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dstore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dstore.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The local variables at <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 are set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dstore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.dstore.notes-100"></a> The <span class="emphasis"><em>dstore</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="dstore_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dstore_n"></a><span class="emphasis"><em>dstore_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18332"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">double</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18336"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dstore_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18340"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dstore_0</em></span> = 71 (0x47)</p><p class="norm"><span class="emphasis"><em>dstore_1</em></span> = 72 (0x48)</p><p class="norm"><span class="emphasis"><em>dstore_2</em></span> = 73 (0x49)</p><p class="norm"><span class="emphasis"><em>dstore_3</em></span> = 74 (0x4a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18350"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dstore_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dstore_n.desc-100"></a> Both <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">double</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The local variables at <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 are set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dstore_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.dstore_n.notes-100"></a> Each of the <span class="emphasis"><em>dstore_<n></em></span> instructions is the same as <span class="emphasis"><em>dstore</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="dsub"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dsub"></a><span class="emphasis"><em>dsub</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18380"></a>Operation</h4></div></div></div><p class="norm">Subtract <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18384"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dsub</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18388"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dsub</em></span> = 103 (0x67)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18392"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dsub.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dsub.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">double</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">double</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' - <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dsub.desc-200"></a> For <code class="literal">double</code> subtraction, it is always the case that <code class="literal">a-b</code> produces the same result as <code class="literal">a+(-b)</code>. However, for the <span class="emphasis"><em>dsub</em></span> instruction, subtraction from zero is not the same as negation, because if <code class="literal">x</code> is <code class="literal">+0.0</code>, then <code class="literal">0.0-x</code> equals <code class="literal">+0.0</code>, but <code class="literal">-x</code> equals <code class="literal">-0.0</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.dsub.desc-300"></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 <span class="emphasis"><em>dsub</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="dup"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup"></a><span class="emphasis"><em>dup</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18430"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top operand stack value</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18433"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18437"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup</em></span> = 89 (0x59)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18441"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span>, <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup.desc-100"></a> Duplicate the top value on the operand stack and push the duplicated value onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dup.desc-110"></a> The <span class="emphasis"><em>dup</em></span> instruction must not be used unless <span class="emphasis"><em>value</em></span> is a value of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div></div><div class="section-execution" title="dup_x1"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup_x1"></a><span class="emphasis"><em>dup_x1</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18459"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top operand stack value and insert two values down</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18462"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup_x1</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18466"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup_x1</em></span> = 90 (0x5a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18470"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup_x1.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup_x1.desc-100"></a> Duplicate the top value on the operand stack and insert the duplicated value two values down in the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.dup_x1.desc-110"></a> The <span class="emphasis"><em>dup_x1</em></span> instruction must not be used unless both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> are values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div></div><div class="section-execution" title="dup_x2"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup_x2"></a><span class="emphasis"><em>dup_x2</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18491"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top operand stack value and insert two or three values down</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18494"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup_x2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18498"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup_x2</em></span> = 91 (0x5b)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup_x2.stack"></a>Operand Stack</h4></div></div></div><p class="norm"><a name="jvms-6.5.dup_x2.stack-100"></a>Form 1:</p><p class="norm"><a name="jvms-6.5.dup_x2.stack-100-A"></a>..., <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup_x2.stack-100-B"></a>..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup_x2.stack-110"></a> where <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, and <span class="emphasis"><em>value3</em></span> are all values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup_x2.stack-200"></a>Form 2:</p><p class="norm"><a name="jvms-6.5.dup_x2.stack-200-A"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup_x2.stack-200-B"></a>..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup_x2.stack-210"></a> where <span class="emphasis"><em>value1</em></span> is a value of a category 1 computational type and <span class="emphasis"><em>value2</em></span> is a value of a category 2 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup_x2.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup_x2.desc-100"></a> Duplicate the top value on the operand stack and insert the duplicated value two or three values down in the operand stack.</p></div></div><div class="section-execution" title="dup2"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup2"></a><span class="emphasis"><em>dup2</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18539"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top one or two operand stack values</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18542"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18546"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup2</em></span> = 92 (0x5c)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2.stack"></a>Operand Stack</h4></div></div></div><p class="norm"><a name="jvms-6.5.dup2.stack-100"></a>Form 1:</p><p class="norm"><a name="jvms-6.5.dup2.stack-100-A"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2.stack-100-B"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2.stack-110"></a> where both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> are values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup2.stack-200"></a>Form 2:</p><p class="norm"><a name="jvms-6.5.dup2.stack-200-A"></a>..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2.stack-200-B"></a>..., <span class="emphasis"><em>value</em></span>, <span class="emphasis"><em>value</em></span></p><p class="norm"><a name="jvms-6.5.dup2.stack-210"></a> where <span class="emphasis"><em>value</em></span> is a value of a category 2 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup2.desc-100"></a> Duplicate the top one or two values on the operand stack and push the duplicated value or values back onto the operand stack in the original order.</p></div></div><div class="section-execution" title="dup2_x1"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup2_x1"></a><span class="emphasis"><em>dup2_x1</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18582"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top one or two operand stack values and insert two or three values down</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18585"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup2_x1</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18589"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup2_x1</em></span> = 93 (0x5d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2_x1.stack"></a>Operand Stack</h4></div></div></div><p class="norm"><a name="jvms-6.5.dup2_x1.stack-100"></a>Form 1:</p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-100-A"></a>..., <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-100-B"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-110"></a> where <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, and <span class="emphasis"><em>value3</em></span> are all values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-200"></a>Form 2:</p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-200-A"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-200-B"></a>..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x1.stack-210"></a> where <span class="emphasis"><em>value1</em></span> is a value of a category 2 computational type and <span class="emphasis"><em>value2</em></span> is a value of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2_x1.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup2_x1.desc-100"></a> Duplicate the top one or two values on the operand stack and insert the duplicated values, in the original order, one value beneath the original value or values in the operand stack.</p></div></div><div class="section-execution" title="dup2_x2"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.dup2_x2"></a><span class="emphasis"><em>dup2_x2</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18631"></a>Operation</h4></div></div></div><p class="norm">Duplicate the top one or two operand stack values and insert two, three, or four values down</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18634"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>dup2_x2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18638"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>dup2_x2</em></span> = 94 (0x5e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2_x2.stack"></a>Operand Stack</h4></div></div></div><p class="norm"><a name="jvms-6.5.dup2_x2.stack-100"></a>Form 1:</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-100-A"></a>..., <span class="emphasis"><em>value4</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-100-B"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value4</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-110"></a> where <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value3</em></span>, and <span class="emphasis"><em>value4</em></span> are all values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-200"></a>Form 2:</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-200-A"></a>..., <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-200-B"></a>..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-210"></a> where <span class="emphasis"><em>value1</em></span> is a value of a category 2 computational type and <span class="emphasis"><em>value2</em></span> and <span class="emphasis"><em>value3</em></span> are both values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-300"></a>Form 3:</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-300-A"></a>..., <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-300-B"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value3</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-310"></a> where <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> are both values of a category 1 computational type and <span class="emphasis"><em>value3</em></span> is a value of a category 2 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-400"></a>Form 4:</p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-400-A"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-400-B"></a>..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span></p><p class="norm"><a name="jvms-6.5.dup2_x2.stack-410"></a> where <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> are both values of a category 2 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.dup2_x2.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.dup2_x2.desc-100"></a> Duplicate the top one or two values on the operand stack and insert the duplicated values, in the original order, into the operand stack.</p></div></div><div class="section-execution" title="f2d"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.f2d"></a><span class="emphasis"><em>f2d</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18716"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">float</code> to <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18721"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>f2d</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18725"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>f2d</em></span> = 141 (0x8d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18729"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2d.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.f2d.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to a <code class="literal">double</code> <span class="emphasis"><em>result</em></span>. This <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2d.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.f2d.notes-100"></a> Where an <span class="emphasis"><em>f2d</em></span> instruction is FP-strict (<a class="xref" href="jvms-2.html#jvms-2.8.2" title="2.8.2. Floating-Point Modes">§2.8.2</a>) it performs a widening primitive conversion (JLS §5.1.2). Because all values of the float value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>) are exactly representable by values of the double value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>), such a conversion is exact.</p><p class="norm"><a name="jvms-6.5.f2d.notes-110"></a> Where an <span class="emphasis"><em>f2d</em></span> instruction is not FP-strict, the result of the conversion may be taken from the double-extended-exponent value set; it is not necessarily rounded to the nearest representable value in the double value set. However, if the operand <span class="emphasis"><em>value</em></span> is taken from the float-extended-exponent value set and the target result is constrained to the double value set, rounding of <span class="emphasis"><em>value</em></span> may be required.</p></div></div><div class="section-execution" title="f2i"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.f2i"></a><span class="emphasis"><em>f2i</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18761"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">float</code> to <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18766"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>f2i</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18770"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>f2i</em></span> = 139 (0x8b)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18774"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2i.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.f2i.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to an <code class="literal">int</code> <span class="emphasis"><em>result</em></span>. This <span class="emphasis"><em>result</em></span> is pushed onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2i.desc-100-A"></a> If the <span class="emphasis"><em>value</em></span>' is NaN, the <span class="emphasis"><em>result</em></span> of the conversion is an <code class="literal">int</code> 0.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2i.desc-100-B"></a> Otherwise, if the <span class="emphasis"><em>value</em></span>' is not an infinity, it is rounded to an integer value <span class="type">V</span>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <span class="type">V</span> can be represented as an <code class="literal">int</code>, then the <span class="emphasis"><em>result</em></span> is the <code class="literal">int</code> value <span class="type">V</span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2i.desc-100-C"></a> Otherwise, either the <span class="emphasis"><em>value</em></span>' must be too small (a negative value of large magnitude or negative infinity), and the <span class="emphasis"><em>result</em></span> is the smallest representable value of type <code class="literal">int</code>, or the <span class="emphasis"><em>value</em></span>' must be too large (a positive value of large magnitude or positive infinity), and the <span class="emphasis"><em>result</em></span> is the largest representable value of type <code class="literal">int</code>.</p></li></ul></div></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2i.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.f2i.notes-100"></a> The <span class="emphasis"><em>f2i</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>' and may also lose precision.</p></div></div><div class="section-execution" title="f2l"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.f2l"></a><span class="emphasis"><em>f2l</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18823"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">float</code> to <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18828"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>f2l</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18832"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>f2l</em></span> = 140 (0x8c)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18836"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2l.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.f2l.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. Then <span class="emphasis"><em>value</em></span>' is converted to a <code class="literal">long</code> <span class="emphasis"><em>result</em></span>. This <span class="emphasis"><em>result</em></span> is pushed onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2l.desc-100-A"></a> If the <span class="emphasis"><em>value</em></span>' is NaN, the result of the conversion is a <code class="literal">long</code> 0.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2l.desc-100-B"></a> Otherwise, if the <span class="emphasis"><em>value</em></span>' is not an infinity, it is rounded to an integer value <span class="type">V</span>, rounding towards zero using IEEE 754 round towards zero mode. If this integer value <span class="type">V</span> can be represented as a <code class="literal">long</code>, then the <span class="emphasis"><em>result</em></span> is the <code class="literal">long</code> value <span class="type">V</span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.f2l.desc-100-C"></a> Otherwise, either the <span class="emphasis"><em>value</em></span>' must be too small (a negative value of large magnitude or negative infinity), and the <span class="emphasis"><em>result</em></span> is the smallest representable value of type <code class="literal">long</code>, or the <span class="emphasis"><em>value</em></span>' must be too large (a positive value of large magnitude or positive infinity), and the <span class="emphasis"><em>result</em></span> is the largest representable value of type <code class="literal">long</code>.</p></li></ul></div></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.f2l.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.f2l.notes-100"></a> The <span class="emphasis"><em>f2l</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>' and may also lose precision.</p></div></div><div class="section-execution" title="fadd"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fadd"></a><span class="emphasis"><em>fadd</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18884"></a>Operation</h4></div></div></div><p class="norm">Add <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18888"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fadd</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18892"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fadd</em></span> = 98 (0x62)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18896"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fadd.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">float</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' + <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200"></a> The result of an <span class="emphasis"><em>fadd</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-B"></a> The sum of two infinities of opposite sign is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-C"></a> The sum of two infinities of the same sign is the infinity of that sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-D"></a> The sum of an infinity and any finite value is equal to the infinity.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-E"></a> The sum of two zeroes of opposite sign is positive zero.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-F"></a> The sum of two zeroes of the same sign is the zero of that sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-G"></a> The sum of a zero and a nonzero finite value is equal to the nonzero value.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-H"></a> The sum of two nonzero finite values of the same magnitude and opposite sign is positive zero.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-200-I"></a> 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 class="literal">float</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 class="literal">float</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.fadd.desc-300"></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 an <span class="emphasis"><em>fadd</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="faload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.faload"></a><span class="emphasis"><em>faload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18948"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">float</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18952"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>faload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18956"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>faload</em></span> = 48 (0x30)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18960"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.faload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.faload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">float</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">float</code> value in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved and pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.faload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.faload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>faload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.faload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>faload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="fastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fastore"></a><span class="emphasis"><em>fastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18995"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">float</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e18999"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19003"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fastore</em></span> = 81 (0x51)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19007"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">float</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>, and the <span class="emphasis"><em>value</em></span> must be of type <code class="literal">float</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">float</code> <span class="emphasis"><em>value</em></span> undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>', and <span class="emphasis"><em>value</em></span>' is stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.fastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>fastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.fastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>fastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="fcmp"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fcmp_op"></a><span class="emphasis"><em>fcmp<op></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19049"></a>Operation</h4></div></div></div><p class="norm">Compare <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19053"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fcmp<op></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19057"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fcmpg</em></span> = 150 (0x96)</p><p class="norm"><span class="emphasis"><em>fcmpl</em></span> = 149 (0x95)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19063"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fcmp_op.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. A floating-point comparison is performed:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-100-A"></a> If <span class="emphasis"><em>value1</em></span>' is greater than <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value 1 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-100-B"></a> Otherwise, if <span class="emphasis"><em>value1</em></span>' is equal to <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value 0 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-100-C"></a> Otherwise, if <span class="emphasis"><em>value1</em></span>' is less than <span class="emphasis"><em>value2</em></span>', the <code class="literal">int</code> value -1 is pushed onto the operand stack.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-100-D"></a> Otherwise, at least one of <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN. The <span class="emphasis"><em>fcmpg</em></span> instruction pushes the <code class="literal">int</code> value 1 onto the operand stack and the <span class="emphasis"><em>fcmpl</em></span> instruction pushes the <code class="literal">int</code> value -1 onto the operand stack.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.fcmp_op.desc-200"></a> Floating-point comparison is performed in accordance with IEEE 754. All values other than NaN are ordered, with negative infinity less than all finite values and positive infinity greater than all finite values. Positive zero and negative zero are considered equal.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fcmp_op.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.fcmp_op.notes-100"></a> The <span class="emphasis"><em>fcmpg</em></span> and <span class="emphasis"><em>fcmpl</em></span> instructions differ only in their treatment of a comparison involving NaN. NaN is unordered, so any <code class="literal">float</code> comparison fails if either or both of its operands are NaN. With both <span class="emphasis"><em>fcmpg</em></span> and <span class="emphasis"><em>fcmpl</em></span> available, any <code class="literal">float</code> comparison may be compiled to push the same <span class="emphasis"><em>result</em></span> onto the operand stack whether the comparison fails on non-NaN values or fails because it encountered a NaN. For more information, see <a class="xref" href="jvms-3.html#jvms-3.5" title="3.5. More Control Examples">§3.5</a>.</p></div></div><div class="section-execution" title="fconst_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fconst_f"></a><span class="emphasis"><em>fconst_<f></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19119"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19123"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fconst_<f></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19127"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fconst_0</em></span> = 11 (0xb)</p><p class="norm"><span class="emphasis"><em>fconst_1</em></span> = 12 (0xc)</p><p class="norm"><span class="emphasis"><em>fconst_2</em></span> = 13 (0xd)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19135"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <<span class="emphasis"><em>f</em></span>></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fconst_f.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fconst_f.desc-100"></a> Push the <code class="literal">float</code> constant <<span class="emphasis"><em>f</em></span>> (0.0, 1.0, or 2.0) onto the operand stack.</p></div></div><div class="section-execution" title="fdiv"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fdiv"></a><span class="emphasis"><em>fdiv</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19149"></a>Operation</h4></div></div></div><p class="norm">Divide <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19153"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fdiv</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19157"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fdiv</em></span> = 110 (0x6e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19161"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fdiv.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">float</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200"></a> The result of an <span class="emphasis"><em>fdiv</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result is positive if both values have the same sign, negative if the values have different signs.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-C"></a> Division of an infinity by an infinity results in NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-D"></a> Division of an infinity by a finite value results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-E"></a> Division of a finite value by an infinity results in a signed zero, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-F"></a> Division of a zero by a zero results in NaN; division of zero by any other finite value results in a signed zero, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-G"></a> Division of a nonzero finite value by a zero results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-200-H"></a> In the remaining cases, where neither operand is an infinity, a zero, or NaN, the quotient is computed and rounded to the nearest <code class="literal">float</code> using IEEE 754 round to nearest mode. If the magnitude is too large to represent as a <code class="literal">float</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 class="literal">float</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.fdiv.desc-300"></a> The Java Virtual Machine requires support of gradual underflow as defined by IEEE 754. Despite the fact that overflow, underflow, division by zero, or loss of precision may occur, execution of an <span class="emphasis"><em>fdiv</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="fload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fload"></a><span class="emphasis"><em>fload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19214"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">float</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19218"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fload</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19223"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fload</em></span> = 23 (0x17)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19227"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fload.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <span class="emphasis"><em>index</em></span> must contain a <code class="literal">float</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <span class="emphasis"><em>index</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.fload.notes-100"></a> The <span class="emphasis"><em>fload</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="fload_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fload_n"></a><span class="emphasis"><em>fload_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19251"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">float</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19255"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fload_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19259"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fload_0</em></span> = 34 (0x22)</p><p class="norm"><span class="emphasis"><em>fload_1</em></span> = 35 (0x23)</p><p class="norm"><span class="emphasis"><em>fload_2</em></span> = 36 (0x24)</p><p class="norm"><span class="emphasis"><em>fload_3</em></span> = 37 (0x25)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19269"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fload_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fload_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <<span class="emphasis"><em>n</em></span>> must contain a <code class="literal">float</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <<span class="emphasis"><em>n</em></span>> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fload_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.fload_n.notes-100"></a> Each of the <span class="emphasis"><em>fload_<n></em></span> instructions is the same as <span class="emphasis"><em>fload</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="fmul"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fmul"></a><span class="emphasis"><em>fmul</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19295"></a>Operation</h4></div></div></div><p class="norm">Multiply <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19299"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fmul</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19303"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fmul</em></span> = 106 (0x6a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19307"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fmul.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">float</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' * <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200"></a> The result of an <span class="emphasis"><em>fmul</em></span> instruction is governed by the rules of IEEE arithmetic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result is positive if both values have the same sign, and negative if the values have different signs.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200-C"></a> Multiplication of an infinity by a zero results in NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200-D"></a> Multiplication of an infinity by a finite value results in a signed infinity, with the sign-producing rule just given.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-200-E"></a> In the remaining cases, where neither an infinity nor NaN is involved, the product 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 class="literal">float</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 class="literal">float</code>, we say the operation underflows; the result is then a zero of appropriate sign.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.fmul.desc-300"></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 an <span class="emphasis"><em>fmul</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="fneg"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fneg"></a><span class="emphasis"><em>fneg</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19353"></a>Operation</h4></div></div></div><p class="norm">Negate <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19357"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fneg</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19361"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fneg</em></span> = 118 (0x76)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19365"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fneg.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-100"></a> The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The <code class="literal">float</code> <span class="emphasis"><em>result</em></span> is the arithmetic negation of <span class="emphasis"><em>value</em></span>'. This <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-200"></a> For <code class="literal">float</code> values, negation is not the same as subtraction from zero. If <code class="literal">x</code> is <code class="literal">+0.0</code>, then <code class="literal">0.0-x</code> equals <code class="literal">+0.0</code>, but <code class="literal">-x</code> equals <code class="literal">-0.0</code>. Unary minus merely inverts the sign of a <code class="literal">float</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-300"></a> Special cases of interest:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-300-A"></a> If the operand is NaN, the result is NaN (recall that NaN has no sign).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-300-B"></a> If the operand is an infinity, the result is the infinity of opposite sign.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.fneg.desc-300-C"></a> If the operand is a zero, the result is the zero of opposite sign.</p></li></ul></div></div></div><div class="section-execution" title="frem"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.frem"></a><span class="emphasis"><em>frem</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19403"></a>Operation</h4></div></div></div><p class="norm">Remainder <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19407"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>frem</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19411"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>frem</em></span> = 114 (0x72)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19415"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.frem.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is calculated and pushed onto the operand stack as a <code class="literal">float</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-200"></a> The <span class="emphasis"><em>result</em></span> of an <span class="emphasis"><em>frem</em></span> instruction is not the same as that of the so-called remainder operation defined by IEEE 754. The IEEE 754 "remainder" operation computes the remainder from a rounding division, not a truncating division, and so its behavior is <span class="emphasis"><em>not</em></span> analogous to that of the usual integer remainder operator. Instead, the Java Virtual Machine defines <span class="emphasis"><em>frem</em></span> to behave in a manner analogous to that of the Java Virtual Machine integer remainder instructions (<span class="emphasis"><em>irem</em></span> and <span class="emphasis"><em>lrem</em></span>); this may be compared with the C library function <code class="literal">fmod</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300"></a> The result of an <span class="emphasis"><em>frem</em></span> instruction is governed by these rules:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-A"></a> If either <span class="emphasis"><em>value1</em></span>' or <span class="emphasis"><em>value2</em></span>' is NaN, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-B"></a> If neither <span class="emphasis"><em>value1</em></span>' nor <span class="emphasis"><em>value2</em></span>' is NaN, the sign of the result equals the sign of the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-C"></a> If the dividend is an infinity or the divisor is a zero or both, the result is NaN.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-D"></a> If the dividend is finite and the divisor is an infinity, the result equals the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-E"></a> If the dividend is a zero and the divisor is finite, the result equals the dividend.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-300-F"></a> In the remaining cases, where neither operand is an infinity, a zero, or NaN, the floating-point remainder <span class="emphasis"><em>result</em></span> from a dividend <span class="emphasis"><em>value1</em></span>' and a divisor <span class="emphasis"><em>value2</em></span>' is defined by the mathematical relation <span class="emphasis"><em>result</em></span> = <span class="emphasis"><em>value1</em></span>' - (<span class="emphasis"><em>value2</em></span>' * <span class="emphasis"><em>q</em></span>), where <span class="emphasis"><em>q</em></span> is an integer that is negative only if <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>' is negative and positive only if <span class="emphasis"><em>value1</em></span>' / <span class="emphasis"><em>value2</em></span>' is positive, and whose magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.frem.desc-400"></a> Despite the fact that division by zero may occur, evaluation of an <span class="emphasis"><em>frem</em></span> instruction never throws a run-time exception. Overflow, underflow, or loss of precision cannot occur.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.frem.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.frem.notes-100"></a> The IEEE 754 remainder operation may be computed by the library routine <code class="literal">Math.IEEEremainder</code>.</p></div></div><div class="section-execution" title="freturn"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.freturn"></a><span class="emphasis"><em>freturn</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19484"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">float</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19488"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>freturn</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19492"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>freturn</em></span> = 174 (0xae)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19496"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.freturn.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.freturn.desc-100"></a> The current method must have return type <code class="literal">float</code>. The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">float</code>. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, <span class="emphasis"><em>value</em></span> is popped from the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The <span class="emphasis"><em>value</em></span>' is pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</p><p class="norm-dynamic"><a name="jvms-6.5.freturn.desc-110"></a> The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.freturn.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.freturn.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>freturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is synchronized.</p><p class="norm-error"><a name="jvms-6.5.freturn.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>freturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="fstore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fstore"></a><span class="emphasis"><em>fstore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19534"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">float</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19538"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fstore</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19543"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fstore</em></span> = 56 (0x38)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19547"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fstore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fstore.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The value of the local variable at <span class="emphasis"><em>index</em></span> is set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fstore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.fstore.notes-100"></a> The <span class="emphasis"><em>fstore</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="fstore_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fstore_n"></a><span class="emphasis"><em>fstore_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19573"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">float</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19577"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fstore_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19581"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fstore_0</em></span> = 67 (0x43)</p><p class="norm"><span class="emphasis"><em>fstore_1</em></span> = 68 (0x44)</p><p class="norm"><span class="emphasis"><em>fstore_2</em></span> = 69 (0x45)</p><p class="norm"><span class="emphasis"><em>fstore_3</em></span> = 70 (0x46)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19591"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fstore_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fstore_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">float</code>. It is popped from the operand stack and undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'. The value of the local variable at <<span class="emphasis"><em>n</em></span>> is set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fstore_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.fstore_n.notes-100"></a> Each of the <span class="emphasis"><em>fstore_<n></em></span> instructions is the same as <span class="emphasis"><em>fstore</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="fsub"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.fsub"></a><span class="emphasis"><em>fsub</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19619"></a>Operation</h4></div></div></div><p class="norm">Subtract <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19623"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>fsub</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19627"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>fsub</em></span> = 102 (0x66)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19631"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.fsub.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.fsub.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">float</code>. The values are popped from the operand stack and undergo value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value1</em></span>' and <span class="emphasis"><em>value2</em></span>'. The <code class="literal">float</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span>' - <span class="emphasis"><em>value2</em></span>'. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.fsub.desc-200"></a> For <code class="literal">float</code> subtraction, it is always the case that <code class="literal">a-b</code> produces the same result as <code class="literal">a+(-b)</code>. However, for the <span class="emphasis"><em>fsub</em></span> instruction, subtraction from zero is not the same as negation, because if <code class="literal">x</code> is <code class="literal">+0.0</code>, then <code class="literal">0.0-x</code> equals <code class="literal">+0.0</code>, but <code class="literal">-x</code> equals <code class="literal">-0.0</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.fsub.desc-300"></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 an <span class="emphasis"><em>fsub</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="getfield"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.getfield"></a><span class="emphasis"><em>getfield</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19669"></a>Operation</h4></div></div></div><p class="norm">Fetch field from object</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19672"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>getfield</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19678"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>getfield</em></span> = 180 (0xb4)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19682"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getfield.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.getfield.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a field (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor of the field as well as a symbolic reference to the class in which the field is to be found. The referenced field is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.getfield.desc-110"></a> The <span class="emphasis"><em>objectref</em></span>, which must be of type <code class="literal">reference</code> but not an array type, is popped from the operand stack. The <span class="emphasis"><em>value</em></span> of the referenced field in <span class="emphasis"><em>objectref</em></span> is fetched and pushed onto the operand stack.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getfield.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.getfield.linking-100"></a> During resolution of the symbolic reference to the field, any of the errors pertaining to field resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.getfield.linking-110"></a> Otherwise, if the resolved field is a <code class="literal">static</code> field, <span class="emphasis"><em>getfield</em></span> throws an <code class="literal">IncompatibleClassChangeError</code>.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getfield.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.getfield.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>getfield</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getfield.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.getfield.notes-100"></a> The <span class="emphasis"><em>getfield</em></span> instruction cannot be used to access the <code class="literal">length</code> field of an array. The <span class="emphasis"><em>arraylength</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.arraylength" title="arraylength">§<span class="emphasis"><em>arraylength</em></span></a>) is used instead.</p></div></div><div class="section-execution" title="getstatic"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.getstatic"></a><span class="emphasis"><em>getstatic</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19730"></a>Operation</h4></div></div></div><p class="norm">Get <code class="literal">static</code> field from class</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19734"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>getstatic</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19740"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>getstatic</em></span> = 178 (0xb2)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19744"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getstatic.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.getstatic.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a field (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor of the field as well as a symbolic reference to the class or interface in which the field is to be found. The referenced field is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.getstatic.desc-110"></a> On successful resolution of the field, the class or interface that declared the resolved field is initialized if that class or interface has not already been initialized (<a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.getstatic.desc-120"></a> The <span class="emphasis"><em>value</em></span> of the class or interface field is fetched and pushed onto the operand stack.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getstatic.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.getstatic.linking-100"></a> During resolution of the symbolic reference to the class or interface field, any of the exceptions pertaining to field resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.getstatic.linking-110"></a> Otherwise, if the resolved field is not a <code class="literal">static</code> (class) field or an interface field, <span class="emphasis"><em>getstatic</em></span> throws an <code class="literal">IncompatibleClassChangeError</code>.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.getstatic.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.getstatic.runtime-100"></a> Otherwise, if execution of this <span class="emphasis"><em>getstatic</em></span> instruction causes initialization of the referenced class or interface, <span class="emphasis"><em>getstatic</em></span> may throw an <code class="literal">Error</code> as detailed in <a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>.</p></div></div><div class="section-execution" title="goto"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.goto"></a><span class="emphasis"><em>goto</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19783"></a>Operation</h4></div></div></div><p class="norm">Branch always</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19786"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>goto</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19792"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>goto</em></span> = 167 (0xa7)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19796"></a>Operand Stack</h4></div></div></div><p class="norm">No change</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.goto.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.goto.desc-100"></a> The unsigned bytes <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit <span class="emphasis"><em>branchoffset</em></span>, where <span class="emphasis"><em>branchoffset</em></span> is (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>goto</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>goto</em></span> instruction.</p></div></div><div class="section-execution" title="goto_w"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.goto_w"></a><span class="emphasis"><em>goto_w</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19814"></a>Operation</h4></div></div></div><p class="norm">Branch always (wide index)</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19817"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>goto_w</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br> <span class="emphasis"><em>branchbyte3</em></span><br> <span class="emphasis"><em>branchbyte4</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19825"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>goto_w</em></span> = 200 (0xc8)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19829"></a>Operand Stack</h4></div></div></div><p class="norm">No change</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.goto_w.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.goto_w.desc-100"></a> The unsigned bytes <span class="emphasis"><em>branchbyte1</em></span>, <span class="emphasis"><em>branchbyte2</em></span>, <span class="emphasis"><em>branchbyte3</em></span>, and <span class="emphasis"><em>branchbyte4</em></span> are used to construct a signed 32-bit <span class="emphasis"><em>branchoffset</em></span>, where <span class="emphasis"><em>branchoffset</em></span> is (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 24) | (<span class="emphasis"><em>branchbyte2</em></span> <code class="literal"><<</code> 16) | (<span class="emphasis"><em>branchbyte3</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte4</em></span>. Execution proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>goto_w</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>goto_w</em></span> instruction.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.goto_w.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.goto_w.notes-100"></a> Although the <span class="emphasis"><em>goto_w</em></span> instruction takes a 4-byte branch offset, other factors limit the size of a method to 65535 bytes (<a class="xref" href="jvms-4.html#jvms-4.11" title="4.11. Limitations of the Java Virtual Machine">§4.11</a>). This limit may be raised in a future release of the Java Virtual Machine.</p></div></div><div class="section-execution" title="i2b"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2b"></a><span class="emphasis"><em>i2b</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19858"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">byte</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19863"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2b</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19867"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2b</em></span> = 145 (0x91)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19871"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2b.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2b.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack, truncated to a <code class="literal">byte</code>, then sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>result</em></span>. That <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2b.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2b.notes-100"></a> The <span class="emphasis"><em>i2b</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> may also not have the same sign as <span class="emphasis"><em>value</em></span>.</p></div></div><div class="section-execution" title="i2c"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2c"></a><span class="emphasis"><em>i2c</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19897"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">char</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19902"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2c</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19906"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2c</em></span> = 146 (0x92)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19910"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2c.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2c.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack, truncated to <code class="literal">char</code>, then zero-extended to an <code class="literal">int</code> <span class="emphasis"><em>result</em></span>. That <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2c.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2c.notes-100"></a> The <span class="emphasis"><em>i2c</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> (which is always positive) may also not have the same sign as <span class="emphasis"><em>value</em></span>.</p></div></div><div class="section-execution" title="i2d"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2d"></a><span class="emphasis"><em>i2d</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19936"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19941"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2d</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19945"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2d</em></span> = 135 (0x87)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19949"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2d.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2d.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack and converted to a <code class="literal">double</code> <span class="emphasis"><em>result</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2d.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2d.notes-100"></a> The <span class="emphasis"><em>i2d</em></span> instruction performs a widening primitive conversion (JLS §5.1.2). Because all values of type <code class="literal">int</code> are exactly representable by type <code class="literal">double</code>, the conversion is exact.</p></div></div><div class="section-execution" title="i2f"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2f"></a><span class="emphasis"><em>i2f</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19973"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19978"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2f</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19982"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2f</em></span> = 134 (0x86)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e19986"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2f.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2f.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack and converted to the <code class="literal">float</code> <span class="emphasis"><em>result</em></span> using IEEE 754 round to nearest mode. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2f.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2f.notes-100"></a> The <span class="emphasis"><em>i2f</em></span> instruction performs a widening primitive conversion (JLS §5.1.2), but may result in a loss of precision because values of type <code class="literal">float</code> have only 24 significand bits.</p></div></div><div class="section-execution" title="i2l"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2l"></a><span class="emphasis"><em>i2l</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20009"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20014"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2l</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20018"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2l</em></span> = 133 (0x85)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20022"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2l.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2l.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack and sign-extended to a <code class="literal">long</code> <span class="emphasis"><em>result</em></span>. That <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2l.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2l.notes-100"></a> The <span class="emphasis"><em>i2l</em></span> instruction performs a widening primitive conversion (JLS §5.1.2). Because all values of type <code class="literal">int</code> are exactly representable by type <code class="literal">long</code>, the conversion is exact.</p></div></div><div class="section-execution" title="i2s"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.i2s"></a><span class="emphasis"><em>i2s</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20046"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">int</code> to <code class="literal">short</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20051"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>i2s</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20055"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>i2s</em></span> = 147 (0x93)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20059"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2s.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.i2s.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack, truncated to a <code class="literal">short</code>, then sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>result</em></span>. That <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.i2s.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.i2s.notes-100"></a> The <span class="emphasis"><em>i2s</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> may also not have the same sign as <span class="emphasis"><em>value</em></span>.</p></div></div><div class="section-execution" title="iadd"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iadd"></a><span class="emphasis"><em>iadd</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20085"></a>Operation</h4></div></div></div><p class="norm">Add <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20089"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iadd</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20093"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iadd</em></span> = 96 (0x60)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20097"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iadd.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iadd.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> + <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.iadd.desc-200"></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 class="literal">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.</p><p class="norm-dynamic"><a name="jvms-6.5.iadd.desc-300"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>iadd</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="iaload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iaload"></a><span class="emphasis"><em>iaload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20123"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">int</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20127"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iaload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20131"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iaload</em></span> = 46 (0x2e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20135"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iaload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iaload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">int</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>value</em></span> in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved and pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iaload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.iaload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>iaload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.iaload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>iaload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="iand"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iand"></a><span class="emphasis"><em>iand</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20171"></a>Operation</h4></div></div></div><p class="norm">Boolean AND <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20175"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iand</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20179"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iand</em></span> = 126 (0x7e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20183"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iand.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iand.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. They are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise AND (conjunction) of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="iastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iastore"></a><span class="emphasis"><em>iastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20205"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">int</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20209"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20213"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iastore</em></span> = 79 (0x4f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20217"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">int</code>. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>value</em></span> must be of type <code class="literal">int</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.iastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>iastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.iastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>iastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="iconst_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iconst_i"></a><span class="emphasis"><em>iconst_<i></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20255"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">int</code> constant</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20259"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iconst_<i></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20263"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iconst_m1</em></span> = 2 (0x2)</p><p class="norm"><span class="emphasis"><em>iconst_0</em></span> = 3 (0x3)</p><p class="norm"><span class="emphasis"><em>iconst_1</em></span> = 4 (0x4)</p><p class="norm"><span class="emphasis"><em>iconst_2</em></span> = 5 (0x5)</p><p class="norm"><span class="emphasis"><em>iconst_3</em></span> = 6 (0x6)</p><p class="norm"><span class="emphasis"><em>iconst_4</em></span> = 7 (0x7)</p><p class="norm"><span class="emphasis"><em>iconst_5</em></span> = 8 (0x8)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20279"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <<span class="emphasis"><em>i</em></span>></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iconst_i.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iconst_i.desc-100"></a> Push the <code class="literal">int</code> constant <<span class="emphasis"><em>i</em></span>> (-1, 0, 1, 2, 3, 4 or 5) onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iconst_i.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.iconst_i.notes-100"></a> Each of this family of instructions is equivalent to <span class="emphasis"><em>bipush</em></span> <<span class="emphasis"><em>i</em></span>> for the respective value of <<span class="emphasis"><em>i</em></span>>, except that the operand <<span class="emphasis"><em>i</em></span>> is implicit.</p></div></div><div class="section-execution" title="idiv"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.idiv"></a><span class="emphasis"><em>idiv</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20300"></a>Operation</h4></div></div></div><p class="norm">Divide <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20304"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>idiv</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20308"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>idiv</em></span> = 108 (0x6c)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20312"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.idiv.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.idiv.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is the value of the Java programming language expression <span class="emphasis"><em>value1</em></span> / <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.idiv.desc-200"></a> An <code class="literal">int</code> division rounds towards 0; that is, the quotient produced for <code class="literal">int</code> values in <span class="emphasis"><em>n</em></span>/<span class="emphasis"><em>d</em></span> is an <code class="literal">int</code> value <span class="emphasis"><em>q</em></span> whose magnitude is as large as possible while satisfying |<span class="emphasis"><em>d</em></span> <span class="symbol">⋅</span> <span class="emphasis"><em>q</em></span>| <span class="symbol">≤</span> |<span class="emphasis"><em>n</em></span>|. Moreover, <span class="emphasis"><em>q</em></span> is positive when |<span class="emphasis"><em>n</em></span>| <span class="symbol">≥</span> |<span class="emphasis"><em>d</em></span>| and <span class="emphasis"><em>n</em></span> and <span class="emphasis"><em>d</em></span> have the same sign, but <span class="emphasis"><em>q</em></span> is negative when |<span class="emphasis"><em>n</em></span>| <span class="symbol">≥</span> |<span class="emphasis"><em>d</em></span>| and <span class="emphasis"><em>n</em></span> and <span class="emphasis"><em>d</em></span> have opposite signs.</p><p class="norm-dynamic"><a name="jvms-6.5.idiv.desc-300"></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 class="literal">int</code> type, and the divisor is -1, then overflow occurs, and the result is equal to the dividend. Despite the overflow, no exception is thrown in this case.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.idiv.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.idiv.runtime-100"></a> If the value of the divisor in an <code class="literal">int</code> division is 0, <span class="emphasis"><em>idiv</em></span> throws an <code class="literal">ArithmeticException</code>.</p></div></div><div class="section-execution" title="if_acmp"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.if_acmp_cond"></a><span class="emphasis"><em>if_acmp<cond></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20366"></a>Operation</h4></div></div></div><p class="norm">Branch if <code class="literal">reference</code> comparison succeeds</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20370"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>if_acmp<cond></em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20376"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>if_acmpeq</em></span> = 165 (0xa5)</p><p class="norm"><span class="emphasis"><em>if_acmpne</em></span> = 166 (0xa6)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20382"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.if_acmp_cond.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.if_acmp_cond.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">reference</code>. They are both popped from the operand stack and compared. The results of the comparison are as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_acmp_cond.desc-100-A"></a> <span class="emphasis"><em>if_acmpeq</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> = <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_acmp_cond.desc-100-B"></a> <span class="emphasis"><em>if_acmpne</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> <span class="symbol">≠</span> <span class="emphasis"><em>value2</em></span></p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.if_acmp_cond.desc-200"></a> If the comparison succeeds, the unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is calculated to be (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution then proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>if_acmp<cond></em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>if_acmp<cond></em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.if_acmp_cond.desc-300"></a> Otherwise, if the comparison fails, execution proceeds at the address of the instruction following this <span class="emphasis"><em>if_acmp<cond></em></span> instruction.</p></div></div><div class="section-execution" title="if_icmp"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.if_icmp_cond"></a><span class="emphasis"><em>if_icmp<cond></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20420"></a>Operation</h4></div></div></div><p class="norm">Branch if <code class="literal">int</code> comparison succeeds</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20424"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>if_icmp<cond></em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20430"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>if_icmpeq</em></span> = 159 (0x9f)</p><p class="norm"><span class="emphasis"><em>if_icmpne</em></span> = 160 (0xa0)</p><p class="norm"><span class="emphasis"><em>if_icmplt</em></span> = 161 (0xa1)</p><p class="norm"><span class="emphasis"><em>if_icmpge</em></span> = 162 (0xa2)</p><p class="norm"><span class="emphasis"><em>if_icmpgt</em></span> = 163 (0xa3)</p><p class="norm"><span class="emphasis"><em>if_icmple</em></span> = 164 (0xa4)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20444"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.if_icmp_cond.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. They are both popped from the operand stack and compared. All comparisons are signed. The results of the comparison are as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-A"></a> <span class="emphasis"><em>if_icmpeq</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> = <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-B"></a> <span class="emphasis"><em>if_icmpne</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> <span class="symbol">≠</span> <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-C"></a> <span class="emphasis"><em>if_icmplt</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> < <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-D"></a> <span class="emphasis"><em>if_icmple</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> <span class="symbol">≤</span> <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-E"></a> <span class="emphasis"><em>if_icmpgt</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> > <span class="emphasis"><em>value2</em></span></p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-100-F"></a> <span class="emphasis"><em>if_icmpge</em></span> succeeds if and only if <span class="emphasis"><em>value1</em></span> <span class="symbol">≥</span> <span class="emphasis"><em>value2</em></span></p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-200"></a> If the comparison succeeds, the unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is calculated to be (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution then proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>if_icmp<cond></em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>if_icmp<cond></em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.if_icmp_cond.desc-300"></a> Otherwise, execution proceeds at the address of the instruction following this <span class="emphasis"><em>if_icmp<cond></em></span> instruction.</p></div></div><div class="section-execution" title="if"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.if_cond"></a><span class="emphasis"><em>if<cond></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20504"></a>Operation</h4></div></div></div><p class="norm">Branch if <code class="literal">int</code> comparison with zero succeeds</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20508"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>if<cond></em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20514"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ifeq</em></span> = 153 (0x99)</p><p class="norm"><span class="emphasis"><em>ifne</em></span> = 154 (0x9a)</p><p class="norm"><span class="emphasis"><em>iflt</em></span> = 155 (0x9b)</p><p class="norm"><span class="emphasis"><em>ifge</em></span> = 156 (0x9c)</p><p class="norm"><span class="emphasis"><em>ifgt</em></span> = 157 (0x9d)</p><p class="norm"><span class="emphasis"><em>ifle</em></span> = 158 (0x9e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20528"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.if_cond.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100"></a> The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">int</code>. It is popped from the operand stack and compared against zero. All comparisons are signed. The results of the comparisons are as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-A"></a> <span class="emphasis"><em>ifeq</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> = 0</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-B"></a> <span class="emphasis"><em>ifne</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> <span class="symbol">≠</span> 0</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-C"></a> <span class="emphasis"><em>iflt</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> < 0</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-D"></a> <span class="emphasis"><em>ifle</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> <span class="symbol">≤</span> 0</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-E"></a> <span class="emphasis"><em>ifgt</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> > 0</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-100-F"></a> <span class="emphasis"><em>ifge</em></span> succeeds if and only if <span class="emphasis"><em>value</em></span> <span class="symbol">≥</span> 0</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-200"></a> If the comparison succeeds, the unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is calculated to be (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution then proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>if<cond></em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>if<cond></em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.if_cond.desc-300"></a> Otherwise, execution proceeds at the address of the instruction following this <span class="emphasis"><em>if<cond></em></span> instruction.</p></div></div><div class="section-execution" title="ifnonnull"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ifnonnull"></a><span class="emphasis"><em>ifnonnull</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20580"></a>Operation</h4></div></div></div><p class="norm">Branch if <code class="literal">reference</code> not <code class="literal">null</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20585"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ifnonnull</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20591"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ifnonnull</em></span> = 199 (0xc7)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20595"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ifnonnull.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ifnonnull.desc-100"></a> The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">reference</code>. It is popped from the operand stack. If <span class="emphasis"><em>value</em></span> is not <code class="literal">null</code>, the unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is calculated to be (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution then proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>ifnonnull</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>ifnonnull</em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.ifnonnull.desc-200"></a> Otherwise, execution proceeds at the address of the instruction following this <span class="emphasis"><em>ifnonnull</em></span> instruction.</p></div></div><div class="section-execution" title="ifnull"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ifnull"></a><span class="emphasis"><em>ifnull</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20620"></a>Operation</h4></div></div></div><p class="norm">Branch if <code class="literal">reference</code> is <code class="literal">null</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20625"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ifnull</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20631"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ifnull</em></span> = 198 (0xc6)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20635"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ifnull.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ifnull.desc-100"></a> The <span class="emphasis"><em>value</em></span> must of type <code class="literal">reference</code>. It is popped from the operand stack. If <span class="emphasis"><em>value</em></span> is <code class="literal">null</code>, the unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is calculated to be (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution then proceeds at that offset from the address of the opcode of this <span class="emphasis"><em>ifnull</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>ifnull</em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.ifnull.desc-200"></a> Otherwise, execution proceeds at the address of the instruction following this <span class="emphasis"><em>ifnull</em></span> instruction.</p></div></div><div class="section-execution" title="iinc"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iinc"></a><span class="emphasis"><em>iinc</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20660"></a>Operation</h4></div></div></div><p class="norm">Increment local variable by constant</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20663"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iinc</em></span><br> <span class="emphasis"><em>index</em></span><br> <span class="emphasis"><em>const</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20669"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iinc</em></span> = 132 (0x84)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20673"></a>Operand Stack</h4></div></div></div><p class="norm">No change</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iinc.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iinc.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>const</em></span> is an immediate signed byte. The local variable at <span class="emphasis"><em>index</em></span> must contain an <code class="literal">int</code>. The value <span class="emphasis"><em>const</em></span> is first sign-extended to an <code class="literal">int</code>, and then the local variable at <span class="emphasis"><em>index</em></span> is incremented by that amount.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iinc.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.iinc.notes-100"></a> The <span class="emphasis"><em>iinc</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index and to increment it by a two-byte immediate signed value.</p></div></div><div class="section-execution" title="iload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iload"></a><span class="emphasis"><em>iload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20696"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">int</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20700"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iload</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20705"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iload</em></span> = 21 (0x15)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20709"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iload.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <span class="emphasis"><em>index</em></span> must contain an <code class="literal">int</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <span class="emphasis"><em>index</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.iload.notes-100"></a> The <span class="emphasis"><em>iload</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="iload_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iload_n"></a><span class="emphasis"><em>iload_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20733"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">int</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20737"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iload_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20741"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iload_0</em></span> = 26 (0x1a)</p><p class="norm"><span class="emphasis"><em>iload_1</em></span> = 27 (0x1b)</p><p class="norm"><span class="emphasis"><em>iload_2</em></span> = 28 (0x1c)</p><p class="norm"><span class="emphasis"><em>iload_3</em></span> = 29 (0x1d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20751"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iload_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iload_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <<span class="emphasis"><em>n</em></span>> must contain an <code class="literal">int</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <<span class="emphasis"><em>n</em></span>> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iload_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.iload_n.notes-100"></a> Each of the <span class="emphasis"><em>iload_<n></em></span> instructions is the same as <span class="emphasis"><em>iload</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="imul"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.imul"></a><span class="emphasis"><em>imul</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20777"></a>Operation</h4></div></div></div><p class="norm">Multiply <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20781"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>imul</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20785"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>imul</em></span> = 104 (0x68)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20789"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.imul.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.imul.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> * <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.imul.desc-200"></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 class="literal">int</code>. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical multiplication of the two values.</p><p class="norm-dynamic"><a name="jvms-6.5.imul.desc-300"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>imul</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="ineg"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ineg"></a><span class="emphasis"><em>ineg</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20815"></a>Operation</h4></div></div></div><p class="norm">Negate <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20819"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ineg</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20823"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ineg</em></span> = 116 (0x74)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20827"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ineg.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ineg.desc-100"></a> The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">int</code>. It is popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is the arithmetic negation of <span class="emphasis"><em>value</em></span>, -<span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ineg.desc-200"></a> For <code class="literal">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 class="literal">int</code> results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown.</p><p class="norm-dynamic"><a name="jvms-6.5.ineg.desc-300"></a> For all <code class="literal">int</code> values <code class="literal">x</code>, <code class="literal">-x</code> equals <code class="literal">(~x)+1</code>.</p></div></div><div class="section-execution" title="instanceof"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.instanceof"></a><span class="emphasis"><em>instanceof</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20855"></a>Operation</h4></div></div></div><p class="norm">Determine if object is of given type</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20858"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>instanceof</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20864"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>instanceof</em></span> = 193 (0xc1)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20868"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.instanceof.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-100"></a> The <span class="emphasis"><em>objectref</em></span>, which must be of type <code class="literal">reference</code>, is popped from the operand stack. The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a class, array, or interface type.</p><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-200"></a> If <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>instanceof</em></span> instruction pushes an <code class="literal">int</code> <span class="emphasis"><em>result</em></span> of 0 as an <code class="literal">int</code> onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-210"></a> Otherwise, the named class, array, or interface type is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>). If <span class="emphasis"><em>objectref</em></span> is an instance of the resolved class or array type, or implements the resolved interface, the <span class="emphasis"><em>instanceof</em></span> instruction pushes an <code class="literal">int</code> <span class="emphasis"><em>result</em></span> of 1 as an <code class="literal">int</code> onto the operand stack; otherwise, it pushes an <code class="literal">int</code> <span class="emphasis"><em>result</em></span> of 0.</p><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300"></a> The following rules are used to determine whether an <span class="emphasis"><em>objectref</em></span> that is not <code class="literal">null</code> is an instance of the resolved type. If <span class="type">S</span> is the type of the object referred to by <span class="emphasis"><em>objectref</em></span>, and <span class="type">T</span> is the resolved class, array, or interface type, then <span class="emphasis"><em>instanceof</em></span> determines whether <span class="emphasis"><em>objectref</em></span> is an instance of <span class="type">T</span> as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-A"></a> If <span class="type">S</span> is a class type, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-A-A"></a> If <span class="type">T</span> is a class type, then <span class="type">S</span> must be the same class as <span class="type">T</span>, or <span class="type">S</span> must be a subclass of <span class="type">T</span>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-A-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">S</span> must implement interface <span class="type">T</span>.</p></li></ul></div></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B"></a> If <span class="type">S</span> is an array type <span class="type">SC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">SC</span>, then:</p><div class="norm"><ul class="norm" type="circle"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B-A"></a> If <span class="type">T</span> is a class type, then <span class="type">T</span> must be <code class="literal">Object</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B-B"></a> If <span class="type">T</span> is an interface type, then <span class="type">T</span> must be one of the interfaces implemented by arrays (JLS §4.10.3).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B-C"></a> If <span class="type">T</span> is an array type <span class="type">TC</span><code class="literal">[]</code>, that is, an array of components of type <span class="type">TC</span>, then one of the following must be true:</p><div class="norm"><ul class="norm" type="square"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B-C-A"></a> <span class="type">TC</span> and <span class="type">SC</span> are the same primitive type.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.instanceof.desc-300-B-C-B"></a> <span class="type">TC</span> and <span class="type">SC</span> are reference types, and type <span class="type">SC</span> can be cast to <span class="type">TC</span> by these run-time rules.</p></li></ul></div></li></ul></div></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.instanceof.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.instanceof.linking-100"></a> During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in <a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a> can be thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.instanceof.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.instanceof.notes-100"></a> The <span class="emphasis"><em>instanceof</em></span> instruction is very similar to the <span class="emphasis"><em>checkcast</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.checkcast" title="checkcast">§<span class="emphasis"><em>checkcast</em></span></a>). It differs in its treatment of <code class="literal">null</code>, its behavior when its test fails (<span class="emphasis"><em>checkcast</em></span> throws an exception, <span class="emphasis"><em>instanceof</em></span> pushes a result code), and its effect on the operand stack.</p></div></div><div class="section-execution" title="invokedynamic"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.invokedynamic"></a><span class="emphasis"><em>invokedynamic</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20977"></a>Operation</h4></div></div></div><p class="norm">Invoke a dynamically-computed call site</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20980"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>invokedynamic</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br> <span class="emphasis"><em>0</em></span><br> <span class="emphasis"><em>0</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20988"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>invokedynamic</em></span> = 186 (0xba)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e20992"></a>Operand Stack</h4></div></div></div><p class="norm">..., [<span class="emphasis"><em>arg1</em></span>, [<span class="emphasis"><em>arg2</em></span> ...]] <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokedynamic.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-100"></a> First, the unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a dynamically-computed call site (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>). The values of the third and fourth operand bytes must always be zero.</p><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-110"></a> The symbolic reference is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.6" title="5.4.3.6. Dynamically-Computed Constant and Call Site Resolution">§5.4.3.6</a>) <span class="emphasis"><em>for this specific</em></span> <span class="emphasis"><em>invokedynamic</em></span> <span class="emphasis"><em>instruction</em></span> to obtain a <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.CallSite</code>. The instance of <code class="literal">java.lang.invoke.CallSite</code> is considered "bound" to this specific <span class="emphasis"><em>invokedynamic</em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-300"></a> The instance of <code class="literal">java.lang.invoke.CallSite</code> indicates a <span class="emphasis"><em>target method handle</em></span>. The <span class="emphasis"><em>nargs</em></span> argument values are popped from the operand stack, and the target method handle is invoked. The invocation occurs as if by execution of an <span class="emphasis"><em>invokevirtual</em></span> instruction that indicates a run-time constant pool index to a symbolic reference <span class="type">R</span> where:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-300-A"></a> <span class="type">R</span> is a symbolic reference to a method of a class;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-300-B"></a> for the symbolic reference to the class in which the method is to be found, <span class="type">R</span> specifies <code class="literal">java.lang.invoke.MethodHandle</code>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-300-C"></a> for the name of the method, <span class="type">R</span> specifies <code class="literal">invokeExact</code>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-300-D"></a> for the descriptor of the method, <span class="type">R</span> specifies the method descriptor in the dynamically-computed call site.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-310"></a> and where it is as if the following items were pushed, in order, onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-310-A"></a> a <code class="literal">reference</code> to the target method handle;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.desc-310-B"></a> the <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the method descriptor in the dynamically-computed call site.</p></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokedynamic.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokedynamic.linking-100"></a> During resolution of the symbolic reference to a dynamically-computed call site, any of the exceptions pertaining to dynamically-computed call site resolution can be thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokedynamic.notes"></a>Notes</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.runtime-100"></a> If the symbolic reference to the dynamically-computed call site can be resolved, it implies that a non-<code class="literal">null</code> <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.CallSite</code> is bound to the <span class="emphasis"><em>invokedynamic</em></span> instruction. Therefore, the target method handle, indicated by the instance of <code class="literal">java.lang.invoke.CallSite</code>, is non-<code class="literal">null</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.runtime-110"></a> Similarly, successful resolution implies that the method descriptor in the symbolic reference is semantically equal to the type descriptor of the target method handle.</p><p class="norm-dynamic"><a name="jvms-6.5.invokedynamic.runtime-120"></a> Together, these invariants mean that an <span class="emphasis"><em>invokedynamic</em></span> instruction which is bound to an instance of <code class="literal">java.lang.invoke.CallSite</code> never throws a <code class="literal">NullPointerException</code> or a <code class="literal">java.lang.invoke.WrongMethodTypeException</code>.</p></div></div><div class="section-execution" title="invokeinterface"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.invokeinterface"></a><span class="emphasis"><em>invokeinterface</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21068"></a>Operation</h4></div></div></div><p class="norm">Invoke interface method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21071"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>invokeinterface</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br> <span class="emphasis"><em>count</em></span><br> <span class="emphasis"><em>0</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21079"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>invokeinterface</em></span> = 185 (0xb9)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21083"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span>, [<span class="emphasis"><em>arg1</em></span>, [<span class="emphasis"><em>arg2</em></span> ...]] <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokeinterface.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to an interface method (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor (<a class="xref" href="jvms-4.html#jvms-4.3.3" title="4.3.3. Method Descriptors">§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 class="xref" href="jvms-5.html#jvms-5.4.3.4" title="5.4.3.4. Interface Method Resolution">§5.4.3.4</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-110"></a> The resolved interface method must not be an instance initialization method, or the class or interface initialization method (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>, <a class="xref" href="jvms-2.html#jvms-2.9.2" title="2.9.2. Class Initialization Methods">§2.9.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-120"></a> The <span class="emphasis"><em>count</em></span> operand is an unsigned byte that must not be zero. The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code> and must be followed on the operand stack by <span class="emphasis"><em>nargs</em></span> 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.</p><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-200"></a> Let <span class="type">C</span> be the class of <span class="emphasis"><em>objectref</em></span>. A method is selected with respect to <span class="type">C</span> and the resolved method (<a class="xref" href="jvms-5.html#jvms-5.4.6" title="5.4.6. Method Selection">§5.4.6</a>). This is the <span class="emphasis"><em>method to be invoked</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-300"></a> If the method to be invoked is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is entered or reentered as if by execution of a <span class="emphasis"><em>monitorenter</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorenter" title="monitorenter">§<span class="emphasis"><em>monitorenter</em></span></a>) in the current thread.</p><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-310"></a> If the method to be invoked is not <code class="literal">native</code>, the <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack. A new frame is created on the Java Virtual Machine stack for the method being invoked. The <span class="emphasis"><em>objectref</em></span> and the argument values are consecutively made the values of local variables of the new frame, with <span class="emphasis"><em>objectref</em></span> in local variable 0, <span class="emphasis"><em>arg1</em></span> in local variable 1 (or, if <span class="emphasis"><em>arg1</em></span> is of type <code class="literal">long</code> or <code class="literal">double</code>, in local variables 1 and 2), and so on. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being stored in a local variable. The new frame is then made current, and the Java Virtual Machine <code class="literal">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><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-320"></a> If the method to be invoked is <code class="literal">native</code> and the platform-dependent code that implements it has not yet been bound (<a class="xref" href="jvms-5.html#jvms-5.6" title="5.6. Binding Native Method Implementations">§5.6</a>) into the Java Virtual Machine, then that is done. The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack and are passed as parameters to the code that implements the method. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being passed as a parameter. The parameters are passed and the code is invoked in an implementation-dependent manner. When the platform-dependent code returns:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-320-A"></a> If the <code class="literal">native</code> method is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokeinterface.desc-320-B"></a> If the <code class="literal">native</code> method returns a value, the return value of the platform-dependent code is converted in an implementation-dependent way to the return type of the <code class="literal">native</code> method and pushed onto the operand stack.</p></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokeinterface.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokeinterface.linking-100"></a> During resolution of the symbolic reference to the interface method, any of the exceptions pertaining to interface method resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.4" title="5.4.3.4. Interface Method Resolution">§5.4.3.4</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.linking-110"></a> Otherwise, if the resolved method is <code class="literal">static</code>, the <span class="emphasis"><em>invokeinterface</em></span> instruction throws an <code class="literal">IncompatibleClassChangeError</code>.</p><p class="note"> Note that <span class="emphasis"><em>invokeinterface</em></span> may refer to <code class="literal">private</code> methods declared in interfaces, including nestmate interfaces.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokeinterface.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>invokeinterface</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-110"></a> Otherwise, if the class of <span class="emphasis"><em>objectref</em></span> does not implement the resolved interface, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">IncompatibleClassChangeError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-200"></a> Otherwise, if the selected method is neither <code class="literal">public</code> nor <code class="literal">private</code>, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">IllegalAccessError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-210"></a> Otherwise, if the selected method is <code class="literal">abstract</code>, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">AbstractMethodError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-220"></a> Otherwise, if the selected method is <code class="literal">native</code> and the code that implements the method cannot be bound, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">UnsatisfiedLinkError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-300"></a> Otherwise, if no method is selected, and there are multiple maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">IncompatibleClassChangeError</code></p><p class="norm-error"><a name="jvms-6.5.invokeinterface.runtime-310"></a> Otherwise, if no method is selected, and there are no maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokeinterface</em></span> throws an <code class="literal">AbstractMethodError</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokeinterface.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.invokeinterface.notes-100"></a> The <span class="emphasis"><em>count</em></span> operand of the <span class="emphasis"><em>invokeinterface</em></span> instruction records a measure of the number of argument values, where an argument value of type <code class="literal">long</code> or type <code class="literal">double</code> contributes two units to the <span class="emphasis"><em>count</em></span> value and an argument of any other type contributes one unit. This information can also be derived from the descriptor of the selected method. The redundancy is historical.</p><p class="norm"><a name="jvms-6.5.invokeinterface.notes-110"></a> The fourth operand byte exists to reserve space for an additional operand used in certain of Oracle's Java Virtual Machine implementations, which replace the <span class="emphasis"><em>invokeinterface</em></span> instruction by a specialized pseudo-instruction at run time. It must be retained for backwards compatibility.</p><p class="norm"><a name="jvms-6.5.invokeinterface.notes-200"></a> The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are not one-to-one with the first <span class="emphasis"><em>nargs</em></span>+1 local variables. Argument values of types <code class="literal">long</code> and <code class="literal">double</code> must be stored in two consecutive local variables, thus more than <span class="emphasis"><em>nargs</em></span> local variables may be required to pass <span class="emphasis"><em>nargs</em></span> argument values to the invoked method.</p><p class="norm"><a name="jvms-6.5.invokeinterface.notes-300"></a> The selection logic allows a non-<code class="literal">abstract</code> method declared in a superinterface to be selected. Methods in interfaces are only considered if there is no matching method in the class hierarchy. In the event that there are two non-<code class="literal">abstract</code> methods in the superinterface hierarchy, with neither more specific than the other, an error occurs; there is no attempt to disambiguate (for example, one may be the referenced method and one may be unrelated, but we do not prefer the referenced method). On the other hand, if there are many <code class="literal">abstract</code> methods but only one non-<code class="literal">abstract</code> method, the non-<code class="literal">abstract</code> method is selected (unless an <code class="literal">abstract</code> method is more specific).</p></div></div><div class="section-execution" title="invokespecial"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.invokespecial"></a><span class="emphasis"><em>invokespecial</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21226"></a>Operation</h4></div></div></div><p class="norm">Invoke instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21229"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>invokespecial</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21235"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>invokespecial</em></span> = 183 (0xb7)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21239"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span>, [<span class="emphasis"><em>arg1</em></span>, [<span class="emphasis"><em>arg2</em></span> ...]] <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokespecial.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a method or an interface method (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor (<a class="xref" href="jvms-4.html#jvms-4.3.3" title="4.3.3. Method Descriptors">§4.3.3</a>) of the method or interface method as well as a symbolic reference to the class or interface in which the method or interface method is to be found. The named method is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>, <a class="xref" href="jvms-5.html#jvms-5.4.3.4" title="5.4.3.4. Interface Method Resolution">§5.4.3.4</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-200"></a> If all of the following are true, let <span class="type">C</span> be the direct superclass of the current class:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-200-A"></a> The resolved method is not an instance initialization method (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>).</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-200-B"></a> The symbolic reference names a class (not an interface), and that class is a superclass of the current class.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-200-C"></a> The <code class="literal">ACC_SUPER</code> flag is set for the <code class="literal">class</code> file (<a class="xref" href="jvms-4.html#jvms-4.1" title="4.1. The ClassFile Structure">§4.1</a>).</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-210"></a> Otherwise, let <span class="type">C</span> be the class or interface named by the symbolic reference.</p><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-300"></a> The actual method to be invoked is selected by the following lookup procedure:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-300-A"></a> If <span class="type">C</span> contains a declaration for an instance method with the same name and descriptor as the resolved method, then it is the method to be invoked.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-300-B"></a> Otherwise, if <span class="type">C</span> is a class and has a superclass, a search for a declaration of an instance method with the same name and descriptor as the resolved method is performed, starting with the direct superclass of <span class="type">C</span> and continuing with the direct superclass of that class, and so forth, until a match is found or no further superclasses exist. If a match is found, then it is the method to be invoked.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-300-C"></a> Otherwise, if <span class="type">C</span> is an interface and the class <code class="literal">Object</code> contains a declaration of a <code class="literal">public</code> instance method with the same name and descriptor as the resolved method, then it is the method to be invoked.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-300-D"></a> Otherwise, if there is exactly one maximally-specific method (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>) in the superinterfaces of <span class="type">C</span> that matches the resolved method's name and descriptor and is not <code class="literal">abstract</code>, then it is the method to be invoked.</p></li></ol></div><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-310"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code> and must be followed on the operand stack by <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the descriptor of the selected instance method.</p><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-400"></a> If the method is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is entered or reentered as if by execution of a <span class="emphasis"><em>monitorenter</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorenter" title="monitorenter">§<span class="emphasis"><em>monitorenter</em></span></a>) in the current thread.</p><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-410"></a> If the method is not <code class="literal">native</code>, the <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack. A new frame is created on the Java Virtual Machine stack for the method being invoked. The <span class="emphasis"><em>objectref</em></span> and the argument values are consecutively made the values of local variables of the new frame, with <span class="emphasis"><em>objectref</em></span> in local variable 0, <span class="emphasis"><em>arg1</em></span> in local variable 1 (or, if <span class="emphasis"><em>arg1</em></span> is of type <code class="literal">long</code> or <code class="literal">double</code>, in local variables 1 and 2), and so on. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being stored in a local variable. The new frame is then made current, and the Java Virtual Machine <code class="literal">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><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-420"></a> If the method is <code class="literal">native</code> and the platform-dependent code that implements it has not yet been bound (<a class="xref" href="jvms-5.html#jvms-5.6" title="5.6. Binding Native Method Implementations">§5.6</a>) into the Java Virtual Machine, that is done. The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack and are passed as parameters to the code that implements the method. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being passed as a parameter. The parameters are passed and the code is invoked in an implementation-dependent manner. When the platform-dependent code returns, the following take place:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-420-A"></a> If the <code class="literal">native</code> method is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokespecial.desc-420-B"></a> If the <code class="literal">native</code> method returns a value, the return value of the platform-dependent code is converted in an implementation-dependent way to the return type of the <code class="literal">native</code> method and pushed onto the operand stack.</p></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokespecial.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokespecial.linking-100"></a> During resolution of the symbolic reference to the method, any of the exceptions pertaining to method resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.invokespecial.linking-110"></a> Otherwise, if the resolved method is an instance initialization method, and the class in which it is declared is not the class symbolically referenced by the instruction, a <code class="literal">NoSuchMethodError</code> is thrown.</p><p class="norm-error"><a name="jvms-6.5.invokespecial.linking-120"></a> Otherwise, if the resolved method is a class (<code class="literal">static</code>) method, the <span class="emphasis"><em>invokespecial</em></span> instruction throws an <code class="literal">IncompatibleClassChangeError</code>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokespecial.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokespecial.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>invokespecial</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.invokespecial.runtime-200"></a> Otherwise, if step 1, step 2, or step 3 of the lookup procedure selects an <code class="literal">abstract</code> method, <span class="emphasis"><em>invokespecial</em></span> throws an <code class="literal">AbstractMethodError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokespecial.runtime-210"></a> Otherwise, if step 1, step 2, or step 3 of the lookup procedure selects a <code class="literal">native</code> method and the code that implements the method cannot be bound, <span class="emphasis"><em>invokespecial</em></span> throws an <code class="literal">UnsatisfiedLinkError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokespecial.runtime-300"></a> Otherwise, if step 4 of the lookup procedure determines there are multiple maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokespecial</em></span> throws an <code class="literal">IncompatibleClassChangeError</code></p><p class="norm-error"><a name="jvms-6.5.invokespecial.runtime-310"></a> Otherwise, if step 4 of the lookup procedure determines there are no maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokespecial</em></span> throws an <code class="literal">AbstractMethodError</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokespecial.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.invokespecial.notes-100"></a> The difference between the <span class="emphasis"><em>invokespecial</em></span> instruction and the <span class="emphasis"><em>invokevirtual</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.invokevirtual" title="invokevirtual">§<span class="emphasis"><em>invokevirtual</em></span></a>) is that <span class="emphasis"><em>invokevirtual</em></span> invokes a method based on the class of the object. The <span class="emphasis"><em>invokespecial</em></span> instruction is used to directly invoke instance initialization methods (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>) as well as methods of the current class and its supertypes.</p><p class="note"> The <span class="emphasis"><em>invokespecial</em></span> instruction was named <code class="literal">invokenonvirtual</code> prior to JDK release 1.0.2.</p><p class="norm"><a name="jvms-6.5.invokespecial.notes-200"></a> The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are not one-to-one with the first <span class="emphasis"><em>nargs</em></span>+1 local variables. Argument values of types <code class="literal">long</code> and <code class="literal">double</code> must be stored in two consecutive local variables, thus more than <span class="emphasis"><em>nargs</em></span> local variables may be required to pass <span class="emphasis"><em>nargs</em></span> argument values to the invoked method.</p><p class="norm"><a name="jvms-6.5.invokespecial.notes-300"></a> The <span class="emphasis"><em>invokespecial</em></span> instruction handles invocation of a non-<code class="literal">abstract</code> interface method, referenced either via a direct superinterface or via a superclass. In these cases, the rules for selection are essentially the same as those for <span class="emphasis"><em>invokeinterface</em></span> (except that the search starts from a different class).</p></div></div><div class="section-execution" title="invokestatic"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.invokestatic"></a><span class="emphasis"><em>invokestatic</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21396"></a>Operation</h4></div></div></div><p class="norm">Invoke a class (<code class="literal">static</code>) method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21400"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>invokestatic</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21406"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>invokestatic</em></span> = 184 (0xb8)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21410"></a>Operand Stack</h4></div></div></div><p class="norm">..., [<span class="emphasis"><em>arg1</em></span>, [<span class="emphasis"><em>arg2</em></span> ...]] <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokestatic.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a method or an interface method (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor (<a class="xref" href="jvms-4.html#jvms-4.3.3" title="4.3.3. Method Descriptors">§4.3.3</a>) of the method or interface method as well as a symbolic reference to the class or interface in which the method or interface method is to be found. The named method is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>, <a class="xref" href="jvms-5.html#jvms-5.4.3.4" title="5.4.3.4. Interface Method Resolution">§5.4.3.4</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-110"></a> The resolved method must not be an instance initialization method, or the class or interface initialization method (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>, <a class="xref" href="jvms-2.html#jvms-2.9.2" title="2.9.2. Class Initialization Methods">§2.9.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-120"></a> The resolved method must be <code class="literal">static</code>, and therefore cannot be <code class="literal">abstract</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-200"></a> On successful resolution of the method, the class or interface that declared the resolved method is initialized if that class or interface has not already been initialized (<a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-210"></a> The operand stack must contain <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the descriptor of the resolved method.</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-300"></a> If the method is <code class="literal">synchronized</code>, the monitor associated with the resolved <code class="literal">Class</code> object is entered or reentered as if by execution of a <span class="emphasis"><em>monitorenter</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorenter" title="monitorenter">§<span class="emphasis"><em>monitorenter</em></span></a>) in the current thread.</p><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-310"></a> If the method is not <code class="literal">native</code>, the <span class="emphasis"><em>nargs</em></span> argument values are popped from the operand stack. A new frame is created on the Java Virtual Machine stack for the method being invoked. The <span class="emphasis"><em>nargs</em></span> argument values are consecutively made the values of local variables of the new frame, with <span class="emphasis"><em>arg1</em></span> in local variable 0 (or, if <span class="emphasis"><em>arg1</em></span> is of type <code class="literal">long</code> or <code class="literal">double</code>, in local variables 0 and 1) and so on. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being stored in a local variable. The new frame is then made current, and the Java Virtual Machine <code class="literal">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><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-320"></a> If the method is <code class="literal">native</code> and the platform-dependent code that implements it has not yet been bound (<a class="xref" href="jvms-5.html#jvms-5.6" title="5.6. Binding Native Method Implementations">§5.6</a>) into the Java Virtual Machine, that is done. The <span class="emphasis"><em>nargs</em></span> argument values are popped from the operand stack and are passed as parameters to the code that implements the method. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being passed as a parameter. The parameters are passed and the code is invoked in an implementation-dependent manner. When the platform-dependent code returns, the following take place:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-320-A"></a> If the <code class="literal">native</code> method is <code class="literal">synchronized</code>, the monitor associated with the resolved <code class="literal">Class</code> object is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokestatic.desc-320-B"></a> If the <code class="literal">native</code> method returns a value, the return value of the platform-dependent code is converted in an implementation-dependent way to the return type of the <code class="literal">native</code> method and pushed onto the operand stack.</p></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokestatic.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokestatic.linking-100"></a> During resolution of the symbolic reference to the method, any of the exceptions pertaining to method resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.invokestatic.linking-110"></a> Otherwise, if the resolved method is an instance method, the <span class="emphasis"><em>invokestatic</em></span> instruction throws an <code class="literal">IncompatibleClassChangeError</code>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokestatic.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokestatic.runtime-100"></a> Otherwise, if execution of this <span class="emphasis"><em>invokestatic</em></span> instruction causes initialization of the referenced class or interface, <span class="emphasis"><em>invokestatic</em></span> may throw an <code class="literal">Error</code> as detailed in <a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>.</p><p class="norm-error"><a name="jvms-6.5.invokestatic.runtime-110"></a> Otherwise, if the resolved method is <code class="literal">native</code> and the code that implements the method cannot be bound, <span class="emphasis"><em>invokestatic</em></span> throws an <code class="literal">UnsatisfiedLinkError</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokestatic.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.invokestatic.notes-100"></a> The <span class="emphasis"><em>nargs</em></span> argument values are not one-to-one with the first <span class="emphasis"><em>nargs</em></span> local variables. Argument values of types <code class="literal">long</code> and <code class="literal">double</code> must be stored in two consecutive local variables, thus more than <span class="emphasis"><em>nargs</em></span> local variables may be required to pass <span class="emphasis"><em>nargs</em></span> argument values to the invoked method.</p></div></div><div class="section-execution" title="invokevirtual"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.invokevirtual"></a><span class="emphasis"><em>invokevirtual</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21502"></a>Operation</h4></div></div></div><p class="norm">Invoke instance method; dispatch based on class</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21505"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>invokevirtual</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21511"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>invokevirtual</em></span> = 182 (0xb6)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21515"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span>, [<span class="emphasis"><em>arg1</em></span>, [<span class="emphasis"><em>arg2</em></span> ...]] <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokevirtual.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a method (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor (<a class="xref" href="jvms-4.html#jvms-4.3.3" title="4.3.3. Method Descriptors">§4.3.3</a>) of the method as well as a symbolic reference to the class in which the method is to be found. The named method is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-200"></a> <span class="emphasis"><em>If the resolved method is not signature polymorphic</em></span> (<a class="xref" href="jvms-2.html#jvms-2.9.3" title="2.9.3. Signature Polymorphic Methods">§2.9.3</a>), then the <span class="emphasis"><em>invokevirtual</em></span> instruction proceeds as follows.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-210"></a> Let <span class="type">C</span> be the class of <span class="emphasis"><em>objectref</em></span>. A method is selected with respect to <span class="type">C</span> and the resolved method (<a class="xref" href="jvms-5.html#jvms-5.4.6" title="5.4.6. Method Selection">§5.4.6</a>). This is the <span class="emphasis"><em>method to be invoked</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-220"></a> The <span class="emphasis"><em>objectref</em></span> must be followed on the operand stack by <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the descriptor of the selected instance method.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-300"></a> If the method to be invoked is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is entered or reentered as if by execution of a <span class="emphasis"><em>monitorenter</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorenter" title="monitorenter">§<span class="emphasis"><em>monitorenter</em></span></a>) in the current thread.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-310"></a> If the method to be invoked is not <code class="literal">native</code>, the <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack. A new frame is created on the Java Virtual Machine stack for the method being invoked. The <span class="emphasis"><em>objectref</em></span> and the argument values are consecutively made the values of local variables of the new frame, with <span class="emphasis"><em>objectref</em></span> in local variable 0, <span class="emphasis"><em>arg1</em></span> in local variable 1 (or, if <span class="emphasis"><em>arg1</em></span> is of type <code class="literal">long</code> or <code class="literal">double</code>, in local variables 1 and 2), and so on. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being stored in a local variable. The new frame is then made current, and the Java Virtual Machine <code class="literal">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><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-320"></a> If the method to be invoked is <code class="literal">native</code> and the platform-dependent code that implements it has not yet been bound (<a class="xref" href="jvms-5.html#jvms-5.6" title="5.6. Binding Native Method Implementations">§5.6</a>) into the Java Virtual Machine, that is done. The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack and are passed as parameters to the code that implements the method. Any argument value that is of a floating-point type undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>) prior to being passed as a parameter. The parameters are passed and the code is invoked in an implementation-dependent manner. When the platform-dependent code returns, the following take place:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-320-A"></a> If the <code class="literal">native</code> method is <code class="literal">synchronized</code>, the monitor associated with <span class="emphasis"><em>objectref</em></span> is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-320-B"></a> If the <code class="literal">native</code> method returns a value, the return value of the platform-dependent code is converted in an implementation-dependent way to the return type of the <code class="literal">native</code> method and pushed onto the operand stack.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-400"></a> <span class="emphasis"><em>If the resolved method is signature polymorphic</em></span> (<a class="xref" href="jvms-2.html#jvms-2.9.3" title="2.9.3. Signature Polymorphic Methods">§2.9.3</a>), <span class="emphasis"><em>and declared in the <code class="literal">java.lang.invoke.MethodHandle</code> class</em></span>, then the <span class="emphasis"><em>invokevirtual</em></span> instruction proceeds as follows, where <span class="type">D</span> is the descriptor of the method symbolically referenced by the instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-410"></a> First, a <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.MethodType</code> is obtained as if by resolution of a symbolic reference to a method type (<a class="xref" href="jvms-5.html#jvms-5.4.3.5" title="5.4.3.5. Method Type and Method Handle Resolution">§5.4.3.5</a>) with the same parameter and return types as <span class="type">D</span>.</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-410-A"></a> If the named method is <code class="literal">invokeExact</code>, the instance of <code class="literal">java.lang.invoke.MethodType</code> must be semantically equal to the type descriptor of the receiving method handle <span class="emphasis"><em>objectref</em></span>. The <span class="emphasis"><em>method handle to be invoked</em></span> is <span class="emphasis"><em>objectref</em></span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-410-B"></a> If the named method is <code class="literal">invoke</code>, and the instance of <code class="literal">java.lang.invoke.MethodType</code> is semantically equal to the type descriptor of the receiving method handle <span class="emphasis"><em>objectref</em></span>, then the <span class="emphasis"><em>method handle to be invoked</em></span> is <span class="emphasis"><em>objectref</em></span>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-410-C"></a> If the named method is <code class="literal">invoke</code>, and the instance of <code class="literal">java.lang.invoke.MethodType</code> is not semantically equal to the type descriptor of the receiving method handle <span class="emphasis"><em>objectref</em></span>, then the Java Virtual Machine attempts to adjust the type descriptor of the receiving method handle, as if by invocation of the <code class="literal">asType</code> method of <code class="literal">java.lang.invoke.MethodHandle</code>, to obtain an exactly invokable method handle <code class="varname">m</code>. The <span class="emphasis"><em>method handle to be invoked</em></span> is <code class="varname">m</code>.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-420"></a> The <span class="emphasis"><em>objectref</em></span> must be followed on the operand stack by <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the type descriptor of the method handle to be invoked. (This type descriptor will correspond to the method descriptor appropriate for the kind of the method handle to be invoked, as specified in <a class="xref" href="jvms-5.html#jvms-5.4.3.5" title="5.4.3.5. Method Type and Method Handle Resolution">§5.4.3.5</a>.)</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-500"></a> Then, if the method handle to be invoked has bytecode behavior, the Java Virtual Machine invokes the method handle as if by execution of the bytecode behavior associated with the method handle's kind. If the kind is 5 (<code class="literal">REF_invokeVirtual</code>), 6 (<code class="literal">REF_invokeStatic</code>), 7 (<code class="literal">REF_invokeSpecial</code>), 8 (<code class="literal">REF_newInvokeSpecial</code>), or 9 (<code class="literal">REF_invokeInterface</code>), then a frame will be created and made current <span class="emphasis"><em>in the course of executing the bytecode behavior</em></span>; however, this frame is not visible, and when the method invoked by the bytecode behavior completes (normally or abruptly), the <span class="emphasis"><em>frame of its invoker</em></span> is considered to be the frame for the method containing this <span class="emphasis"><em>invokevirtual</em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-510"></a> Otherwise, if the method handle to be invoked has no bytecode behavior, the Java Virtual Machine invokes it in an implementation-dependent manner.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-600"></a> <span class="emphasis"><em>If the resolved method is signature polymorphic and declared in the <code class="literal">java.lang.invoke.VarHandle</code> class</em></span>, then the <span class="emphasis"><em>invokevirtual</em></span> instruction proceeds as follows, where <code class="varname">N</code> and <span class="type">D</span> are the name and descriptor of the method symbolically referenced by the instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-610"></a> First, a <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.VarHandle.AccessMode</code> is obtained as if by invocation of the <code class="literal">valueFromMethodName</code> method of <code class="literal">java.lang.invoke.VarHandle.AccessMode</code> with a <code class="literal">String</code> argument denoting <code class="varname">N</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-620"></a> Second, a <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.MethodType</code> is obtained as if by invocation of the <code class="literal">accessModeType</code> method of <code class="literal">java.lang.invoke.VarHandle</code> on the instance <span class="emphasis"><em>objectref</em></span>, with the instance of <code class="literal">java.lang.invoke.VarHandle.AccessMode</code> as the argument.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-630"></a> Third, a <code class="literal">reference</code> to an instance of <code class="literal">java.lang.invoke.MethodHandle</code> is obtained as if by invocation of the <code class="literal">varHandleExactInvoker</code> method of <code class="literal">java.lang.invoke.MethodHandles</code> with the instance of <code class="literal">java.lang.invoke.VarHandle.AccessMode</code> as the first argument and the instance of <code class="literal">java.lang.invoke.MethodType</code> as the second argument. The resulting instance is called the <span class="emphasis"><em>invoker method handle</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-700"></a> Finally, the <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack, and the invoker method handle is invoked. The invocation occurs as if by execution of an <span class="emphasis"><em>invokevirtual</em></span> instruction that indicates a run-time constant pool index to a symbolic reference <span class="type">R</span> where:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-700-A"></a> <span class="type">R</span> is a symbolic reference to a method of a class;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-700-B"></a> for the symbolic reference to the class in which the method is to be found, <span class="type">R</span> specifies <code class="literal">java.lang.invoke.MethodHandle</code>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-700-C"></a> for the name of the method, <span class="type">R</span> specifies <code class="literal">invoke</code>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-700-D"></a> for the descriptor of the method, <span class="type">R</span> specifies a return type indicated by the return descriptor of <span class="type">D</span>, and specifies a first parameter type of <code class="literal">java.lang.invoke.VarHandle</code> followed by the parameter types indicated by the parameter descriptors of <span class="type">D</span> (if any) in order.</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-710"></a> and where it is as if the following items were pushed, in order, onto the operand stack:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-710-A"></a> a <code class="literal">reference</code> to the instance of <code class="literal">java.lang.invoke.MethodHandle</code> (the invoker method handle);</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-710-B"></a> <span class="emphasis"><em>objectref</em></span>;</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.invokevirtual.desc-710-C"></a> the <span class="emphasis"><em>nargs</em></span> argument values, where the number, type, and order of the values must be consistent with the type descriptor of the invoker method handle.</p></li></ul></div></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokevirtual.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokevirtual.linking-100"></a> During resolution of the symbolic reference to the method, any of the exceptions pertaining to method resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.3" title="5.4.3.3. Method Resolution">§5.4.3.3</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.invokevirtual.linking-110"></a> Otherwise, if the resolved method is a class (<code class="literal">static</code>) method, the <span class="emphasis"><em>invokevirtual</em></span> instruction throws an <code class="literal">IncompatibleClassChangeError</code>.</p><p class="norm-error"><a name="jvms-6.5.invokevirtual.linking-120"></a> Otherwise, if the resolved method is signature polymorphic and declared in the <code class="literal">java.lang.invoke.MethodHandle</code> class, then during resolution of the method type derived from the descriptor in the symbolic reference to the method, any of the exceptions pertaining to method type resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.5" title="5.4.3.5. Method Type and Method Handle Resolution">§5.4.3.5</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.invokevirtual.linking-130"></a> Otherwise, if the resolved method is signature polymorphic and declared in the <code class="literal">java.lang.invoke.VarHandle</code> class, then any linking exception that may arise from invocation of the invoker method handle can be thrown. No linking exceptions are thrown from invocation of the <code class="literal">valueFromMethodName</code>, <code class="literal">accessModeType</code>, and <code class="literal">varHandleExactInvoker</code> methods.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokevirtual.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>invokevirtual</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-200"></a> Otherwise, if the resolved method is not signature polymorphic:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-200-A"></a> If the selected method is <code class="literal">abstract</code>, <span class="emphasis"><em>invokevirtual</em></span> throws an <code class="literal">AbstractMethodError</code>.</p></li><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-200-B"></a> Otherwise, if the selected method is <code class="literal">native</code> and the code that implements the method cannot be bound, <span class="emphasis"><em>invokevirtual</em></span> throws an <code class="literal">UnsatisfiedLinkError</code>.</p></li><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-200-C"></a> Otherwise, if no method is selected, and there are multiple maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokevirtual</em></span> throws an <code class="literal">IncompatibleClassChangeError</code></p></li><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-200-D"></a> Otherwise, if no method is selected, and there are no maximally-specific superinterface methods of <span class="type">C</span> that match the resolved method's name and descriptor and are not <code class="literal">abstract</code>, <span class="emphasis"><em>invokevirtual</em></span> throws an <code class="literal">AbstractMethodError</code>.</p></li></ul></div><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-300"></a> Otherwise, if the resolved method is signature polymorphic and declared in the <code class="literal">java.lang.invoke.MethodHandle</code> class, then:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-300-A"></a> If the method name is <code class="literal">invokeExact</code>, and the obtained instance of <code class="literal">java.lang.invoke.MethodType</code> is not semantically equal to the type descriptor of the receiving method handle <span class="emphasis"><em>objectref</em></span>, the <span class="emphasis"><em>invokevirtual</em></span> instruction throws a <code class="literal">java.lang.invoke.WrongMethodTypeException</code>.</p></li><li class="listitem"><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-300-B"></a> If the method name is <code class="literal">invoke</code>, and the obtained instance of <code class="literal">java.lang.invoke.MethodType</code> is not a valid argument to the <code class="literal">asType</code> method of <code class="literal">java.lang.invoke.MethodHandle</code> invoked on the receiving method handle <span class="emphasis"><em>objectref</em></span>, the <span class="emphasis"><em>invokevirtual</em></span> instruction throws a <code class="literal">java.lang.invoke.WrongMethodTypeException</code>.</p></li></ul></div><p class="norm-error"><a name="jvms-6.5.invokevirtual.runtime-310"></a> Otherwise, if the resolved method is signature polymorphic and declared in the <code class="literal">java.lang.invoke.VarHandle</code> class, then any run-time exception that may arise from invocation of the invoker method handle can be thrown. No run-time exceptions are thrown from invocation of the <code class="literal">valueFromMethodName</code>, <code class="literal">accessModeType</code>, and <code class="literal">varHandleExactInvoker</code> methods, except <code class="literal">NullPointerException</code> if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.invokevirtual.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.invokevirtual.notes-100"></a> The <span class="emphasis"><em>nargs</em></span> argument values and <span class="emphasis"><em>objectref</em></span> are not one-to-one with the first <span class="emphasis"><em>nargs</em></span>+1 local variables. Argument values of types <code class="literal">long</code> and <code class="literal">double</code> must be stored in two consecutive local variables, thus more than <span class="emphasis"><em>nargs</em></span> local variables may be required to pass <span class="emphasis"><em>nargs</em></span> argument values to the invoked method.</p><p class="norm"><a name="jvms-6.5.invokevirtual.notes-200"></a> It is possible that the symbolic reference of an <span class="emphasis"><em>invokevirtual</em></span> instruction resolves to an interface method. In this case, it is possible that there is no overriding method in the class hierarchy, but that a non-<code class="literal">abstract</code> interface method matches the resolved method's descriptor. The selection logic matches such a method, using the same rules as for <span class="emphasis"><em>invokeinterface</em></span>.</p></div></div><div class="section-execution" title="ior"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ior"></a><span class="emphasis"><em>ior</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21788"></a>Operation</h4></div></div></div><p class="norm">Boolean OR <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21792"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ior</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21796"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ior</em></span> = 128 (0x80)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21800"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ior.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ior.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. They are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise inclusive OR of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="irem"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.irem"></a><span class="emphasis"><em>irem</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21822"></a>Operation</h4></div></div></div><p class="norm">Remainder <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21826"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>irem</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21830"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>irem</em></span> = 112 (0x70)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21834"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.irem.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.irem.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> - (<span class="emphasis"><em>value1</em></span> / <span class="emphasis"><em>value2</em></span>) * <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.irem.desc-200"></a> The result of the <span class="emphasis"><em>irem</em></span> instruction is such that <code class="literal">(a/b)*b + (a%b)</code> is equal to <code class="literal">a</code>. This identity holds even in the special case in which the dividend is the negative <code class="literal">int</code> of largest possible magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule that the result of the remainder operation can be negative only if the dividend is negative and can be positive only if the dividend is positive. Moreover, the magnitude of the result is always less than the magnitude of the divisor.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.irem.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.irem.runtime-100"></a> If the value of the divisor for an <code class="literal">int</code> remainder operator is 0, <span class="emphasis"><em>irem</em></span> throws an <code class="literal">ArithmeticException</code>.</p></div></div><div class="section-execution" title="ireturn"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ireturn"></a><span class="emphasis"><em>ireturn</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21869"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">int</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21873"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ireturn</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21877"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ireturn</em></span> = 172 (0xac)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21881"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ireturn.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ireturn.desc-100"></a> The current method must have return type <code class="literal">boolean</code>, <code class="literal">byte</code>, <code class="literal">char</code>, <code class="literal">short</code>, or <code class="literal">int</code>. The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">int</code>. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, <span class="emphasis"><em>value</em></span> is popped from the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</p><p class="norm-dynamic"><a name="jvms-6.5.ireturn.desc-110"></a> Prior to pushing <span class="emphasis"><em>value</em></span> onto the operand stack of the frame of the invoker, it may have to be converted. If the return type of the invoked method was <code class="literal">byte</code>, <code class="literal">char</code>, or <code class="literal">short</code>, then <span class="emphasis"><em>value</em></span> is converted from <code class="literal">int</code> to the return type as if by execution of <span class="emphasis"><em>i2b</em></span>, <span class="emphasis"><em>i2c</em></span>, or <span class="emphasis"><em>i2s</em></span>, respectively. If the return type of the invoked method was <code class="literal">boolean</code>, then <span class="emphasis"><em>value</em></span> is narrowed from <code class="literal">int</code> to <code class="literal">boolean</code> by taking the bitwise AND of <span class="emphasis"><em>value</em></span> and 1.</p><p class="norm-dynamic"><a name="jvms-6.5.ireturn.desc-120"></a> The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ireturn.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.ireturn.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>ireturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is synchronized.</p><p class="norm-error"><a name="jvms-6.5.ireturn.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>ireturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="ishl"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ishl"></a><span class="emphasis"><em>ishl</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21935"></a>Operation</h4></div></div></div><p class="norm">Shift left <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21939"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ishl</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21943"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ishl</em></span> = 120 (0x78)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21947"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ishl.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ishl.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> left by <span class="emphasis"><em>s</em></span> bit positions, where <span class="emphasis"><em>s</em></span> is the value of the low 5 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ishl.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ishl.notes-100"></a> This is equivalent (even if overflow occurs) to multiplication by 2 to the power <span class="emphasis"><em>s</em></span>. The shift distance actually used is always in the range 0 to 31, inclusive, as if <span class="emphasis"><em>value2</em></span> were subjected to a bitwise logical AND with the mask value 0x1f.</p></div></div><div class="section-execution" title="ishr"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ishr"></a><span class="emphasis"><em>ishr</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21976"></a>Operation</h4></div></div></div><p class="norm">Arithmetic shift right <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21980"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ishr</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21984"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ishr</em></span> = 122 (0x7a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e21988"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ishr.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ishr.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> right by <span class="emphasis"><em>s</em></span> bit positions, with sign extension, where <span class="emphasis"><em>s</em></span> is the value of the low 5 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ishr.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ishr.notes-100"></a> The resulting value is <span class="emphasis"><em>floor</em></span>(<span class="emphasis"><em>value1</em></span> / 2<sup><span class="emphasis"><em>s</em></span></sup>), where <span class="emphasis"><em>s</em></span> is <span class="emphasis"><em>value2</em></span> & 0x1f. For non-negative <span class="emphasis"><em>value1</em></span>, this is equivalent to truncating <code class="literal">int</code> division by 2 to the power <span class="emphasis"><em>s</em></span>. The shift distance actually used is always in the range 0 to 31, inclusive, as if <span class="emphasis"><em>value2</em></span> were subjected to a bitwise logical AND with the mask value 0x1f.</p></div></div><div class="section-execution" title="istore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.istore"></a><span class="emphasis"><em>istore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22025"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">int</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22029"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>istore</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22034"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>istore</em></span> = 54 (0x36)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22038"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.istore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.istore.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack, and the value of the local variable at <span class="emphasis"><em>index</em></span> is set to <span class="emphasis"><em>value</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.istore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.istore.notes-100"></a> The <span class="emphasis"><em>istore</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="istore_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.istore_n"></a><span class="emphasis"><em>istore_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22062"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">int</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22066"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>istore_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22070"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>istore_0</em></span> = 59 (0x3b)</p><p class="norm"><span class="emphasis"><em>istore_1</em></span> = 60 (0x3c)</p><p class="norm"><span class="emphasis"><em>istore_2</em></span> = 61 (0x3d)</p><p class="norm"><span class="emphasis"><em>istore_3</em></span> = 62 (0x3e)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22080"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.istore_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.istore_n.desc-100"></a> The <<span class="emphasis"><em>n</em></span>> must be an index into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">int</code>. It is popped from the operand stack, and the value of the local variable at <<span class="emphasis"><em>n</em></span>> is set to <span class="emphasis"><em>value</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.istore_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.istore_n.notes-100"></a> Each of the <span class="emphasis"><em>istore_<n></em></span> instructions is the same as <span class="emphasis"><em>istore</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="isub"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.isub"></a><span class="emphasis"><em>isub</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22106"></a>Operation</h4></div></div></div><p class="norm">Subtract <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22110"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>isub</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22114"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>isub</em></span> = 100 (0x64)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22118"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.isub.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.isub.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> - <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.isub.desc-200"></a> For <code class="literal">int</code> subtraction, <code class="literal">a-b</code> produces the same result as <code class="literal">a+(-b)</code>. For <code class="literal">int</code> values, subtraction from zero is the same as negation.</p><p class="norm-dynamic"><a name="jvms-6.5.isub.desc-300"></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 class="literal">int</code>. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical difference of the two values.</p><p class="norm-dynamic"><a name="jvms-6.5.isub.desc-400"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>isub</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="iushr"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.iushr"></a><span class="emphasis"><em>iushr</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22149"></a>Operation</h4></div></div></div><p class="norm">Logical shift right <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22153"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>iushr</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22157"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>iushr</em></span> = 124 (0x7c)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22161"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iushr.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.iushr.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> right by <span class="emphasis"><em>s</em></span> bit positions, with zero extension, where <span class="emphasis"><em>s</em></span> is the value of the low 5 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.iushr.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.iushr.notes-100"></a> If <span class="emphasis"><em>value1</em></span> is positive and <span class="emphasis"><em>s</em></span> is <span class="emphasis"><em>value2</em></span> & 0x1f, the result is the same as that of <span class="emphasis"><em>value1</em></span> <code class="literal">>></code> <span class="emphasis"><em>s</em></span>; if <span class="emphasis"><em>value1</em></span> is negative, the result is equal to the value of the expression (<span class="emphasis"><em>value1</em></span> <code class="literal">>></code> <span class="emphasis"><em>s</em></span>) + (2 <code class="literal"><<</code> ~<span class="emphasis"><em>s</em></span>). The addition of the (2 <code class="literal"><<</code> ~<span class="emphasis"><em>s</em></span>) term cancels out the propagated sign bit. The shift distance actually used is always in the range 0 to 31, inclusive.</p></div></div><div class="section-execution" title="ixor"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ixor"></a><span class="emphasis"><em>ixor</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22202"></a>Operation</h4></div></div></div><p class="norm">Boolean XOR <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22206"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ixor</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22210"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ixor</em></span> = 130 (0x82)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22214"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ixor.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ixor.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. They are popped from the operand stack. An <code class="literal">int</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise exclusive OR of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="jsr"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.jsr"></a><span class="emphasis"><em>jsr</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22236"></a>Operation</h4></div></div></div><p class="norm">Jump subroutine</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22239"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>jsr</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22245"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>jsr</em></span> = 168 (0xa8)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22249"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>address</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.jsr.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.jsr.desc-100"></a> The <span class="emphasis"><em>address</em></span> of the opcode of the instruction immediately following this <span class="emphasis"><em>jsr</em></span> instruction is pushed onto the operand stack as a value of type <code class="literal">returnAddress</code>. The unsigned <span class="emphasis"><em>branchbyte1</em></span> and <span class="emphasis"><em>branchbyte2</em></span> are used to construct a signed 16-bit offset, where the offset is (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte2</em></span>. Execution proceeds at that offset from the address of this <span class="emphasis"><em>jsr</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>jsr</em></span> instruction.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.jsr.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.jsr.notes-100"></a> Note that <span class="emphasis"><em>jsr</em></span> pushes the address onto the operand stack and <span class="emphasis"><em>ret</em></span> (<a class="xref" href="jvms-6.html#jvms-6.5.ret" title="ret">§<span class="emphasis"><em>ret</em></span></a>) gets it out of a local variable. This asymmetry is intentional.</p><p class="norm"><a name="jvms-6.5.jsr.notes-200"></a> In Oracle's implementation of a compiler for the Java programming language prior to Java SE 6, the <span class="emphasis"><em>jsr</em></span> instruction was used with the <span class="emphasis"><em>ret</em></span> instruction in the implementation of the <code class="literal">finally</code> clause (<a class="xref" href="jvms-3.html#jvms-3.13" title="3.13. Compiling finally">§3.13</a>, <a class="xref" href="jvms-4.html#jvms-4.10.2.5" title="4.10.2.5. Exceptions and finally">§4.10.2.5</a>).</p></div></div><div class="section-execution" title="jsr_w"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.jsr_w"></a><span class="emphasis"><em>jsr_w</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22283"></a>Operation</h4></div></div></div><p class="norm">Jump subroutine (wide index)</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22286"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>jsr_w</em></span><br> <span class="emphasis"><em>branchbyte1</em></span><br> <span class="emphasis"><em>branchbyte2</em></span><br> <span class="emphasis"><em>branchbyte3</em></span><br> <span class="emphasis"><em>branchbyte4</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22294"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>jsr_w</em></span> = 201 (0xc9)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22298"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>address</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.jsr_w.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.jsr_w.desc-100"></a> The <span class="emphasis"><em>address</em></span> of the opcode of the instruction immediately following this <span class="emphasis"><em>jsr_w</em></span> instruction is pushed onto the operand stack as a value of type <code class="literal">returnAddress</code>. The unsigned <span class="emphasis"><em>branchbyte1</em></span>, <span class="emphasis"><em>branchbyte2</em></span>, <span class="emphasis"><em>branchbyte3</em></span>, and <span class="emphasis"><em>branchbyte4</em></span> are used to construct a signed 32-bit offset, where the offset is (<span class="emphasis"><em>branchbyte1</em></span> <code class="literal"><<</code> 24) | (<span class="emphasis"><em>branchbyte2</em></span> <code class="literal"><<</code> 16) | (<span class="emphasis"><em>branchbyte3</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>branchbyte4</em></span>. Execution proceeds at that offset from the address of this <span class="emphasis"><em>jsr_w</em></span> instruction. The target address must be that of an opcode of an instruction within the method that contains this <span class="emphasis"><em>jsr_w</em></span> instruction.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.jsr_w.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.jsr_w.notes-100"></a> Note that <span class="emphasis"><em>jsr_w</em></span> pushes the address onto the operand stack and <span class="emphasis"><em>ret</em></span> (<a class="xref" href="jvms-6.html#jvms-6.5.ret" title="ret">§<span class="emphasis"><em>ret</em></span></a>) gets it out of a local variable. This asymmetry is intentional.</p><p class="norm"><a name="jvms-6.5.jsr_w.notes-200"></a> In Oracle's implementation of a compiler for the Java programming language prior to Java SE 6, the <span class="emphasis"><em>jsr_w</em></span> instruction was used with the <span class="emphasis"><em>ret</em></span> instruction in the implementation of the <code class="literal">finally</code> clause (<a class="xref" href="jvms-3.html#jvms-3.13" title="3.13. Compiling finally">§3.13</a>, <a class="xref" href="jvms-4.html#jvms-4.10.2.5" title="4.10.2.5. Exceptions and finally">§4.10.2.5</a>).</p><p class="norm"><a name="jvms-6.5.jsr_w.notes-300"></a> Although the <span class="emphasis"><em>jsr_w</em></span> instruction takes a 4-byte branch offset, other factors limit the size of a method to 65535 bytes (<a class="xref" href="jvms-4.html#jvms-4.11" title="4.11. Limitations of the Java Virtual Machine">§4.11</a>). This limit may be raised in a future release of the Java Virtual Machine.</p></div></div><div class="section-execution" title="l2d"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.l2d"></a><span class="emphasis"><em>l2d</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22341"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">long</code> to <code class="literal">double</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22346"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>l2d</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22350"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>l2d</em></span> = 138 (0x8a)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22354"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2d.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.l2d.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">long</code>. It is popped from the operand stack and converted to a <code class="literal">double</code> <span class="emphasis"><em>result</em></span> using IEEE 754 round to nearest mode. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2d.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.l2d.notes-100"></a> The <span class="emphasis"><em>l2d</em></span> instruction performs a widening primitive conversion (JLS §5.1.2) that may lose precision because values of type <code class="literal">double</code> have only 53 significand bits.</p></div></div><div class="section-execution" title="l2f"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.l2f"></a><span class="emphasis"><em>l2f</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22377"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">long</code> to <code class="literal">float</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22382"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>l2f</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22386"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>l2f</em></span> = 137 (0x89)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22390"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2f.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.l2f.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">long</code>. It is popped from the operand stack and converted to a <code class="literal">float</code> <span class="emphasis"><em>result</em></span> using IEEE 754 round to nearest mode. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2f.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.l2f.notes-100"></a> The <span class="emphasis"><em>l2f</em></span> instruction performs a widening primitive conversion (JLS §5.1.2) that may lose precision because values of type <code class="literal">float</code> have only 24 significand bits.</p></div></div><div class="section-execution" title="l2i"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.l2i"></a><span class="emphasis"><em>l2i</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22413"></a>Operation</h4></div></div></div><p class="norm">Convert <code class="literal">long</code> to <code class="literal">int</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22418"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>l2i</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22422"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>l2i</em></span> = 136 (0x88)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22426"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2i.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.l2i.desc-100"></a> The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">long</code>. It is popped from the operand stack and converted to an <code class="literal">int</code> <span class="emphasis"><em>result</em></span> by taking the low-order 32 bits of the <code class="literal">long</code> value and discarding the high-order 32 bits. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.l2i.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.l2i.notes-100"></a> The <span class="emphasis"><em>l2i</em></span> instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of <span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> may also not have the same sign as value.</p></div></div><div class="section-execution" title="ladd"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ladd"></a><span class="emphasis"><em>ladd</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22451"></a>Operation</h4></div></div></div><p class="norm">Add <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22455"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ladd</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22459"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ladd</em></span> = 97 (0x61)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22463"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ladd.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ladd.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. The values are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> + <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ladd.desc-200"></a> The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type <code class="literal">long</code>. If overflow occurs, the sign of the result may not be the same as the sign of the mathematical sum of the two values.</p><p class="norm-dynamic"><a name="jvms-6.5.ladd.desc-300"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>ladd</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="laload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.laload"></a><span class="emphasis"><em>laload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22489"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">long</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22493"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>laload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22497"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>laload</em></span> = 47 (0x2f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22501"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.laload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.laload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">long</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>value</em></span> in the component of the array at <span class="emphasis"><em>index</em></span> is retrieved and pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.laload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.laload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>laload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.laload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>laload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="land"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.land"></a><span class="emphasis"><em>land</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22537"></a>Operation</h4></div></div></div><p class="norm">Boolean AND <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22541"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>land</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22545"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>land</em></span> = 127 (0x7f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22549"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.land.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.land.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. They are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise AND of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="lastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lastore"></a><span class="emphasis"><em>lastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22571"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">long</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22575"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22579"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lastore</em></span> = 80 (0x50)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22583"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">long</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>, and <span class="emphasis"><em>value</em></span> must be of type <code class="literal">long</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>value</em></span> is stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.lastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>lastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.lastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>lastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="lcmp"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lcmp"></a><span class="emphasis"><em>lcmp</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22622"></a>Operation</h4></div></div></div><p class="norm">Compare <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22626"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lcmp</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22630"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lcmp</em></span> = 148 (0x94)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22634"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lcmp.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lcmp.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. They are both popped from the operand stack, and a signed integer comparison is performed. If <span class="emphasis"><em>value1</em></span> is greater than <span class="emphasis"><em>value2</em></span>, the <code class="literal">int</code> value 1 is pushed onto the operand stack. If <span class="emphasis"><em>value1</em></span> is equal to <span class="emphasis"><em>value2</em></span>, the <code class="literal">int</code> value 0 is pushed onto the operand stack. If <span class="emphasis"><em>value1</em></span> is less than <span class="emphasis"><em>value2</em></span>, the <code class="literal">int</code> value -1 is pushed onto the operand stack.</p></div></div><div class="section-execution" title="lconst_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lconst_l"></a><span class="emphasis"><em>lconst_<l></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22660"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">long</code> constant</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22664"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lconst_<l></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22668"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lconst_0</em></span> = 9 (0x9)</p><p class="norm"><span class="emphasis"><em>lconst_1</em></span> = 10 (0xa)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22674"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <<span class="emphasis"><em>l</em></span>></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lconst_l.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lconst_l.desc-100"></a> Push the <code class="literal">long</code> constant <<span class="emphasis"><em>l</em></span>> (0 or 1) onto the operand stack.</p></div></div><div class="section-execution" title="ldc"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ldc"></a><span class="emphasis"><em>ldc</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22688"></a>Operation</h4></div></div></div><p class="norm">Push item from run-time constant pool</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22691"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ldc</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22696"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ldc</em></span> = 18 (0x12)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22700"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte that must be a valid index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.5.5" title="2.5.5. Run-Time Constant Pool">§2.5.5</a>). The run-time constant pool entry at <span class="emphasis"><em>index</em></span> must be loadable (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), and not any of the following:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-100-A"></a> A numeric constant of type <code class="literal">long</code> or <code class="literal">double</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-100-B"></a> A symbolic reference to a dynamically-computed constant whose field descriptor is <code class="literal">J</code> (denoting <code class="literal">long</code>) or <code class="literal">D</code> (denoting <code class="literal">double</code>).</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-200"></a> If the run-time constant pool entry is a numeric constant of type <code class="literal">int</code> or <code class="literal">float</code>, then the <span class="emphasis"><em>value</em></span> of that numeric constant is pushed onto the operand stack as an <code class="literal">int</code> or <code class="literal">float</code>, respectively.</p><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-210"></a> Otherwise, if the run-time constant pool entry is a string constant, that is, a <code class="literal">reference</code> to an instance of class <code class="literal">String</code>, then <span class="emphasis"><em>value</em></span>, a <code class="literal">reference</code> to that instance, is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-220"></a> Otherwise, if the run-time constant pool entry is a symbolic reference to a class or interface, then the named class or interface is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>) and <span class="emphasis"><em>value</em></span>, a <code class="literal">reference</code> to the <code class="literal">Class</code> object representing that class or interface, is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ldc.desc-230"></a> Otherwise, the run-time constant pool entry is a symbolic reference to a method type, a method handle, or a dynamically-computed constant. The symbolic reference is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.5" title="5.4.3.5. Method Type and Method Handle Resolution">§5.4.3.5</a>, <a class="xref" href="jvms-5.html#jvms-5.4.3.6" title="5.4.3.6. Dynamically-Computed Constant and Call Site Resolution">§5.4.3.6</a>) and <span class="emphasis"><em>value</em></span>, the result of resolution, is pushed onto the operand stack.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.ldc.linking-100"></a> During resolution of a symbolic reference, any of the exceptions pertaining to resolution of that kind of symbolic reference can be thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ldc.notes-100"></a> The <span class="emphasis"><em>ldc</em></span> instruction can only be used to push a value of type <code class="literal">float</code> taken from the float value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>) because a constant of type <code class="literal">float</code> in the constant pool (<a class="xref" href="jvms-4.html#jvms-4.4.4" title="4.4.4. The CONSTANT_Integer_info and CONSTANT_Float_info Structures">§4.4.4</a>) must be taken from the float value set.</p></div></div><div class="section-execution" title="ldc_w"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ldc_w"></a><span class="emphasis"><em>ldc_w</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22758"></a>Operation</h4></div></div></div><p class="norm">Push item from run-time constant pool (wide index)</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22761"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ldc_w</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22767"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ldc_w</em></span> = 19 (0x13)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22771"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc_w.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ldc_w.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are assembled into an unsigned 16-bit index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.5.5" title="2.5.5. Run-Time Constant Pool">§2.5.5</a>), where the value of the index is calculated as (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The index must be a valid index into the run-time constant pool of the current class. The run-time constant pool entry at the index must be loadable (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), and not any of the following:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc_w.desc-100-A"></a> A numeric constant of type <code class="literal">long</code> or <code class="literal">double</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc_w.desc-100-B"></a> A symbolic reference to a dynamically-computed constant whose field descriptor is <code class="literal">J</code> (denoting <code class="literal">long</code>) or <code class="literal">D</code> (denoting <code class="literal">double</code>).</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.ldc_w.desc-200"></a> If the run-time constant pool entry is a numeric constant of type <code class="literal">int</code> or <code class="literal">float</code>, or a string constant, then <span class="emphasis"><em>value</em></span> is determined and pushed onto the operand stack according to the rules given for the <span class="emphasis"><em>ldc</em></span> instruction.</p><p class="norm-dynamic"><a name="jvms-6.5.ldc_w.desc-210"></a> Otherwise, the run-time constant pool entry is a symbolic reference to a class, interface, method type, method handle, or dynamically-computed constant. It is resolved and <span class="emphasis"><em>value</em></span> is determined and pushed onto the operand stack according to the rules given for the <span class="emphasis"><em>ldc</em></span> instruction.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc_w.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.ldc_w.linking-100"></a> During resolution of a symbolic reference, any of the exceptions pertaining to resolution of that kind of symbolic reference can be thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc_w.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ldc_w.notes-100"></a> The <span class="emphasis"><em>ldc_w</em></span> instruction is identical to the <span class="emphasis"><em>ldc</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.ldc" title="ldc">§<span class="emphasis"><em>ldc</em></span></a>) except for its wider run-time constant pool index.</p><p class="norm"><a name="jvms-6.5.ldc_w.notes-200"></a> The <span class="emphasis"><em>ldc_w</em></span> instruction can only be used to push a value of type <code class="literal">float</code> taken from the float value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>) because a constant of type <code class="literal">float</code> in the constant pool (<a class="xref" href="jvms-4.html#jvms-4.4.4" title="4.4.4. The CONSTANT_Integer_info and CONSTANT_Float_info Structures">§4.4.4</a>) must be taken from the float value set.</p></div></div><div class="section-execution" title="ldc2_w"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ldc2_w"></a><span class="emphasis"><em>ldc2_w</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22824"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">long</code> or <code class="literal">double</code> from run-time constant pool (wide index)</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22829"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ldc2_w</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22835"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ldc2_w</em></span> = 20 (0x14)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22839"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc2_w.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ldc2_w.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are assembled into an unsigned 16-bit index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.5.5" title="2.5.5. Run-Time Constant Pool">§2.5.5</a>), where the value of the index is calculated as (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The index must be a valid index into the run-time constant pool of the current class. The run-time constant pool entry at the index must be loadable (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), and in particular one of the following:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc2_w.desc-100-A"></a> A numeric constant of type <code class="literal">long</code> or <code class="literal">double</code>.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.ldc2_w.desc-100-B"></a> A symbolic reference to a dynamically-computed constant whose field descriptor is <code class="literal">J</code> (denoting <code class="literal">long</code>) or <code class="literal">D</code> (denoting <code class="literal">double</code>).</p></li></ul></div><p class="norm-dynamic"><a name="jvms-6.5.ldc2_w.desc-200"></a> If the run-time constant pool entry is a numeric constant of type <code class="literal">long</code> or <code class="literal">double</code>, then the <span class="emphasis"><em>value</em></span> of that numeric constant is pushed onto the operand stack as a <code class="literal">long</code> or <code class="literal">double</code>, respectively.</p><p class="norm-dynamic"><a name="jvms-6.5.ldc2_w.desc-210"></a> Otherwise, the run-time constant pool entry is a symbolic reference to a dynamically-computed constant. The symbolic reference is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.6" title="5.4.3.6. Dynamically-Computed Constant and Call Site Resolution">§5.4.3.6</a>) and <span class="emphasis"><em>value</em></span>, the result of resolution, is pushed onto the operand stack.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc2_w.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.ldc2_w.linking-100"></a> During resolution of a symbolic reference to a dynamically-computed constant, any of the exceptions pertaining to dynamically-computed constant resolution can be thrown.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldc2_w.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ldc2_w.notes-100"></a> Only a wide-index version of the <span class="emphasis"><em>ldc2_w</em></span> instruction exists; there is no <span class="emphasis"><em>ldc2</em></span> instruction that pushes a <code class="literal">long</code> or <code class="literal">double</code> with a single-byte index.</p><p class="norm"><a name="jvms-6.5.ldc2_w.notes-200"></a> The <span class="emphasis"><em>ldc2_w</em></span> instruction can only be used to push a value of type <code class="literal">double</code> taken from the double value set (<a class="xref" href="jvms-2.html#jvms-2.3.2" title="2.3.2. Floating-Point Types, Value Sets, and Values">§2.3.2</a>) because a constant of type <code class="literal">double</code> in the constant pool (<a class="xref" href="jvms-4.html#jvms-4.4.5" title="4.4.5. The CONSTANT_Long_info and CONSTANT_Double_info Structures">§4.4.5</a>) must be taken from the double value set.</p></div></div><div class="section-execution" title="ldiv"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ldiv"></a><span class="emphasis"><em>ldiv</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22894"></a>Operation</h4></div></div></div><p class="norm">Divide <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22898"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ldiv</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22902"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ldiv</em></span> = 109 (0x6d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22906"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldiv.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ldiv.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. The values are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is the value of the Java programming language expression <span class="emphasis"><em>value1</em></span> / <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.ldiv.desc-200"></a> A <code class="literal">long</code> division rounds towards 0; that is, the quotient produced for <code class="literal">long</code> values in <span class="emphasis"><em>n</em></span> / <span class="emphasis"><em>d</em></span> is a <code class="literal">long</code> value <span class="emphasis"><em>q</em></span> whose magnitude is as large as possible while satisfying |<span class="emphasis"><em>d</em></span> <span class="symbol">⋅</span> <span class="emphasis"><em>q</em></span>| <span class="symbol">≤</span> |<span class="emphasis"><em>n</em></span>|. Moreover, <span class="emphasis"><em>q</em></span> is positive when |<span class="emphasis"><em>n</em></span>| <span class="symbol">≥</span> |<span class="emphasis"><em>d</em></span>| and <span class="emphasis"><em>n</em></span> and <span class="emphasis"><em>d</em></span> have the same sign, but <span class="emphasis"><em>q</em></span> is negative when |<span class="emphasis"><em>n</em></span>| <span class="symbol">≥</span> |<span class="emphasis"><em>d</em></span>| and <span class="emphasis"><em>n</em></span> and <span class="emphasis"><em>d</em></span> have opposite signs.</p><p class="norm-dynamic"><a name="jvms-6.5.ldiv.desc-300"></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 class="literal">long</code> type and the divisor is -1, then overflow occurs and the result is equal to the dividend; despite the overflow, no exception is thrown in this case.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ldiv.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.ldiv.runtime-100"></a> If the value of the divisor in a <code class="literal">long</code> division is 0, <span class="emphasis"><em>ldiv</em></span> throws an <code class="literal">ArithmeticException</code>.</p></div></div><div class="section-execution" title="lload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lload"></a><span class="emphasis"><em>lload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22960"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">long</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22964"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lload</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22969"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lload</em></span> = 22 (0x16)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22973"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lload.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <span class="emphasis"><em>index</em></span> must contain a <code class="literal">long</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <span class="emphasis"><em>index</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lload.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lload.notes-100"></a> The <span class="emphasis"><em>lload</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="lload_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lload_n"></a><span class="emphasis"><em>lload_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e22999"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">long</code> from local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23003"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lload_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23007"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lload_0</em></span> = 30 (0x1e)</p><p class="norm"><span class="emphasis"><em>lload_1</em></span> = 31 (0x1f)</p><p class="norm"><span class="emphasis"><em>lload_2</em></span> = 32 (0x20)</p><p class="norm"><span class="emphasis"><em>lload_3</em></span> = 33 (0x21)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23017"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lload_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lload_n.desc-100"></a> Both <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The local variable at <<span class="emphasis"><em>n</em></span>> must contain a <code class="literal">long</code>. The <span class="emphasis"><em>value</em></span> of the local variable at <<span class="emphasis"><em>n</em></span>> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lload_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lload_n.notes-100"></a> Each of the <span class="emphasis"><em>lload_<n></em></span> instructions is the same as <span class="emphasis"><em>lload</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="lmul"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lmul"></a><span class="emphasis"><em>lmul</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23044"></a>Operation</h4></div></div></div><p class="norm">Multiply <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23048"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lmul</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23052"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lmul</em></span> = 105 (0x69)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23056"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lmul.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lmul.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. The values are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> * <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.lmul.desc-200"></a> The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type <code class="literal">long</code>. If overflow occurs, the sign of the result may not be the same as the sign of the mathematical multiplication of the two values.</p><p class="norm-dynamic"><a name="jvms-6.5.lmul.desc-300"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>lmul</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="lneg"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lneg"></a><span class="emphasis"><em>lneg</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23082"></a>Operation</h4></div></div></div><p class="norm">Negate <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23086"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lneg</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23090"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lneg</em></span> = 117 (0x75)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23094"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lneg.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lneg.desc-100"></a> The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">long</code>. It is popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is the arithmetic negation of <span class="emphasis"><em>value</em></span>, -<span class="emphasis"><em>value</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.lneg.desc-200"></a> For <code class="literal">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 class="literal">long</code> results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown.</p><p class="norm-dynamic"><a name="jvms-6.5.lneg.desc-300"></a> For all <code class="literal">long</code> values <code class="literal">x</code>, <code class="literal">-x</code> equals <code class="literal">(~x)+1</code>.</p></div></div><div class="section-execution" title="lookupswitch"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lookupswitch"></a><span class="emphasis"><em>lookupswitch</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23122"></a>Operation</h4></div></div></div><p class="norm">Access jump table by key match and jump</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23125"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lookupswitch</em></span><br> <span class="emphasis"><em><0-3 byte pad></em></span><br> <span class="emphasis"><em>defaultbyte1</em></span><br> <span class="emphasis"><em>defaultbyte2</em></span><br> <span class="emphasis"><em>defaultbyte3</em></span><br> <span class="emphasis"><em>defaultbyte4</em></span><br> <span class="emphasis"><em>npairs1</em></span><br> <span class="emphasis"><em>npairs2</em></span><br> <span class="emphasis"><em>npairs3</em></span><br> <span class="emphasis"><em>npairs4</em></span><br> <span class="emphasis"><em>match-offset pairs...</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23139"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lookupswitch</em></span> = 171 (0xab)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23143"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>key</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lookupswitch.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lookupswitch.desc-100"></a> A <span class="emphasis"><em>lookupswitch</em></span> is a variable-length instruction. Immediately after the <span class="emphasis"><em>lookupswitch</em></span> opcode, between zero and three bytes must act as padding, such that <span class="emphasis"><em>defaultbyte1</em></span> 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: <span class="emphasis"><em>default</em></span>, <span class="emphasis"><em>npairs</em></span>, and then <span class="emphasis"><em>npairs</em></span> pairs of signed 32-bit values. The <span class="emphasis"><em>npairs</em></span> must be greater than or equal to 0. Each of the <span class="emphasis"><em>npairs</em></span> pairs consists of an <code class="literal">int</code> <span class="emphasis"><em>match</em></span> and a signed 32-bit <span class="emphasis"><em>offset</em></span>. Each of these signed 32-bit values is constructed from four unsigned bytes as (<span class="emphasis"><em>byte1</em></span> <code class="literal"><<</code> 24) | (<span class="emphasis"><em>byte2</em></span> <code class="literal"><<</code> 16) | (<span class="emphasis"><em>byte3</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>byte4</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.lookupswitch.desc-110"></a> The table <span class="emphasis"><em>match-offset</em></span> pairs of the <span class="emphasis"><em>lookupswitch</em></span> instruction must be sorted in increasing numerical order by <span class="emphasis"><em>match</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.lookupswitch.desc-120"></a> The <span class="emphasis"><em>key</em></span> must be of type <code class="literal">int</code> and is popped from the operand stack. The <span class="emphasis"><em>key</em></span> is compared against the <span class="emphasis"><em>match</em></span> values. If it is equal to one of them, then a target address is calculated by adding the corresponding <span class="emphasis"><em>offset</em></span> to the address of the opcode of this <span class="emphasis"><em>lookupswitch</em></span> instruction. If the <span class="emphasis"><em>key</em></span> does not match any of the <span class="emphasis"><em>match</em></span> values, the target address is calculated by adding <span class="emphasis"><em>default</em></span> to the address of the opcode of this <span class="emphasis"><em>lookupswitch</em></span> instruction. Execution then continues at the target address.</p><p class="norm-dynamic"><a name="jvms-6.5.lookupswitch.desc-130"></a> The target address that can be calculated from the <span class="emphasis"><em>offset</em></span> of each <span class="emphasis"><em>match-offset</em></span> pair, as well as the one calculated from <span class="emphasis"><em>default</em></span>, must be the address of an opcode of an instruction within the method that contains this <span class="emphasis"><em>lookupswitch</em></span> instruction.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lookupswitch.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lookupswitch.notes-100"></a> The alignment required of the 4-byte operands of the <span class="emphasis"><em>lookupswitch</em></span> instruction guarantees 4-byte alignment of those operands if and only if the method that contains the <span class="emphasis"><em>lookupswitch</em></span> is positioned on a 4-byte boundary.</p><p class="norm"><a name="jvms-6.5.lookupswitch.notes-200"></a> The <span class="emphasis"><em>match-offset</em></span> pairs are sorted to support lookup routines that are quicker than linear search.</p></div></div><div class="section-execution" title="lor"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lor"></a><span class="emphasis"><em>lor</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23200"></a>Operation</h4></div></div></div><p class="norm">Boolean OR <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23204"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lor</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23208"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lor</em></span> = 129 (0x81)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23212"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lor.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lor.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. They are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise inclusive OR of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="lrem"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lrem"></a><span class="emphasis"><em>lrem</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23234"></a>Operation</h4></div></div></div><p class="norm">Remainder <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23238"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lrem</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23242"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lrem</em></span> = 113 (0x71)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23246"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lrem.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lrem.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. The values are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> - (<span class="emphasis"><em>value1</em></span> / <span class="emphasis"><em>value2</em></span>) * <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.lrem.desc-200"></a> The result of the <span class="emphasis"><em>lrem</em></span> instruction is such that <code class="literal">(a/b)*b + (a%b)</code> is equal to <code class="literal">a</code>. This identity holds even in the special case in which the dividend is the negative <code class="literal">long</code> of largest possible magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule that the result of the remainder operation can be negative only if the dividend is negative and can be positive only if the dividend is positive; moreover, the magnitude of the result is always less than the magnitude of the divisor.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lrem.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.lrem.runtime-100"></a> If the value of the divisor for a <code class="literal">long</code> remainder operator is 0, <span class="emphasis"><em>lrem</em></span> throws an <code class="literal">ArithmeticException</code>.</p></div></div><div class="section-execution" title="lreturn"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lreturn"></a><span class="emphasis"><em>lreturn</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23281"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">long</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23285"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lreturn</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23289"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lreturn</em></span> = 173 (0xad)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23293"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lreturn.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lreturn.desc-100"></a> The current method must have return type <code class="literal">long</code>. The <span class="emphasis"><em>value</em></span> must be of type <code class="literal">long</code>. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, <span class="emphasis"><em>value</em></span> is popped from the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</p><p class="norm-dynamic"><a name="jvms-6.5.lreturn.desc-110"></a> The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lreturn.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.lreturn.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>lreturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is <code class="literal">synchronized</code>.</p><p class="norm-error"><a name="jvms-6.5.lreturn.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>lreturn</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="lshl"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lshl"></a><span class="emphasis"><em>lshl</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23329"></a>Operation</h4></div></div></div><p class="norm">Shift left <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23333"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lshl</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23337"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lshl</em></span> = 121 (0x79)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23341"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lshl.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lshl.desc-100"></a> The <span class="emphasis"><em>value1</em></span> must be of type <code class="literal">long</code>, and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> left by <span class="emphasis"><em>s</em></span> bit positions, where <span class="emphasis"><em>s</em></span> is the low 6 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lshl.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lshl.notes-100"></a> This is equivalent (even if overflow occurs) to multiplication by 2 to the power <span class="emphasis"><em>s</em></span>. The shift distance actually used is therefore always in the range 0 to 63, inclusive, as if <span class="emphasis"><em>value2</em></span> were subjected to a bitwise logical AND with the mask value 0x3f.</p></div></div><div class="section-execution" title="lshr"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lshr"></a><span class="emphasis"><em>lshr</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23371"></a>Operation</h4></div></div></div><p class="norm">Arithmetic shift right <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23375"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lshr</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23379"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lshr</em></span> = 123 (0x7b)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23383"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lshr.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lshr.desc-100"></a> The <span class="emphasis"><em>value1</em></span> must be of type <code class="literal">long</code>, and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> right by <span class="emphasis"><em>s</em></span> bit positions, with sign extension, where <span class="emphasis"><em>s</em></span> is the value of the low 6 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lshr.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lshr.notes-100"></a> The resulting value is <span class="emphasis"><em>floor</em></span>(<span class="emphasis"><em>value1</em></span> / 2<sup><span class="emphasis"><em>s</em></span></sup>), where <span class="emphasis"><em>s</em></span> is <span class="emphasis"><em>value2</em></span> & 0x3f. For non-negative <span class="emphasis"><em>value1</em></span>, this is equivalent to truncating <code class="literal">long</code> division by 2 to the power <span class="emphasis"><em>s</em></span>. The shift distance actually used is therefore always in the range 0 to 63, inclusive, as if <span class="emphasis"><em>value2</em></span> were subjected to a bitwise logical AND with the mask value 0x3f.</p></div></div><div class="section-execution" title="lstore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lstore"></a><span class="emphasis"><em>lstore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23421"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">long</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23425"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lstore</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23430"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lstore</em></span> = 55 (0x37)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23434"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lstore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lstore.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">long</code>. It is popped from the operand stack, and the local variables at <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>index</em></span>+1 are set to <span class="emphasis"><em>value</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lstore.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lstore.notes-100"></a> The <span class="emphasis"><em>lstore</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="lstore_"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lstore_n"></a><span class="emphasis"><em>lstore_<n></em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23461"></a>Operation</h4></div></div></div><p class="norm">Store <code class="literal">long</code> into local variable</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23465"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lstore_<n></em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23469"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lstore_0</em></span> = 63 (0x3f)</p><p class="norm"><span class="emphasis"><em>lstore_1</em></span> = 64 (0x40)</p><p class="norm"><span class="emphasis"><em>lstore_2</em></span> = 65 (0x41)</p><p class="norm"><span class="emphasis"><em>lstore_3</em></span> = 66 (0x42)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23479"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lstore_n.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lstore_n.desc-100"></a> Both <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 must be indices into the local variable array of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>). The <span class="emphasis"><em>value</em></span> on the top of the operand stack must be of type <code class="literal">long</code>. It is popped from the operand stack, and the local variables at <<span class="emphasis"><em>n</em></span>> and <<span class="emphasis"><em>n</em></span>>+1 are set to <span class="emphasis"><em>value</em></span>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lstore_n.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lstore_n.notes-100"></a> Each of the <span class="emphasis"><em>lstore_<n></em></span> instructions is the same as <span class="emphasis"><em>lstore</em></span> with an <span class="emphasis"><em>index</em></span> of <<span class="emphasis"><em>n</em></span>>, except that the operand <<span class="emphasis"><em>n</em></span>> is implicit.</p></div></div><div class="section-execution" title="lsub"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lsub"></a><span class="emphasis"><em>lsub</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23507"></a>Operation</h4></div></div></div><p class="norm">Subtract <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23511"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lsub</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23515"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lsub</em></span> = 101 (0x65)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23519"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lsub.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lsub.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. The values are popped from the operand stack. The <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is <span class="emphasis"><em>value1</em></span> - <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.lsub.desc-200"></a> For <code class="literal">long</code> subtraction, <code class="literal">a-b</code> produces the same result as <code class="literal">a+(-b)</code>. For <code class="literal">long</code> values, subtraction from zero is the same as negation.</p><p class="norm-dynamic"><a name="jvms-6.5.lsub.desc-300"></a> The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type <code class="literal">long</code>. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical difference of the two values.</p><p class="norm-dynamic"><a name="jvms-6.5.lsub.desc-400"></a> Despite the fact that overflow may occur, execution of an <span class="emphasis"><em>lsub</em></span> instruction never throws a run-time exception.</p></div></div><div class="section-execution" title="lushr"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lushr"></a><span class="emphasis"><em>lushr</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23550"></a>Operation</h4></div></div></div><p class="norm">Logical shift right <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23554"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lushr</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23558"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lushr</em></span> = 125 (0x7d)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23562"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lushr.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lushr.desc-100"></a> The <span class="emphasis"><em>value1</em></span> must be of type <code class="literal">long</code>, and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">int</code>. The values are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by shifting <span class="emphasis"><em>value1</em></span> right logically by <span class="emphasis"><em>s</em></span> bit positions, with zero extension, where <span class="emphasis"><em>s</em></span> is the value of the low 6 bits of <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lushr.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.lushr.notes-100"></a> If <span class="emphasis"><em>value1</em></span> is positive and <span class="emphasis"><em>s</em></span> is <span class="emphasis"><em>value2</em></span> & 0x3f, the result is the same as that of <span class="emphasis"><em>value1</em></span> <code class="literal">>></code> <span class="emphasis"><em>s</em></span>; if <span class="emphasis"><em>value1</em></span> is negative, the result is equal to the value of the expression (<span class="emphasis"><em>value1</em></span> <code class="literal">>></code> <span class="emphasis"><em>s</em></span>) + (2L <code class="literal"><<</code> ~<span class="emphasis"><em>s</em></span>). The addition of the (2L <code class="literal"><<</code> ~<span class="emphasis"><em>s</em></span>) term cancels out the propagated sign bit. The shift distance actually used is always in the range 0 to 63, inclusive.</p></div></div><div class="section-execution" title="lxor"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.lxor"></a><span class="emphasis"><em>lxor</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23604"></a>Operation</h4></div></div></div><p class="norm">Boolean XOR <code class="literal">long</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23608"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>lxor</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23612"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>lxor</em></span> = 131 (0x83)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23616"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>result</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.lxor.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.lxor.desc-100"></a> Both <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> must be of type <code class="literal">long</code>. They are popped from the operand stack. A <code class="literal">long</code> <span class="emphasis"><em>result</em></span> is calculated by taking the bitwise exclusive OR of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span>. The <span class="emphasis"><em>result</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="monitorenter"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.monitorenter"></a><span class="emphasis"><em>monitorenter</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23638"></a>Operation</h4></div></div></div><p class="norm">Enter monitor for object</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23641"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>monitorenter</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23645"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>monitorenter</em></span> = 194 (0xc2)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23649"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorenter.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.monitorenter.desc-100"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.monitorenter.desc-200"></a> Each object is associated with a monitor. A monitor is locked if and only if it has an owner. The thread that executes <span class="emphasis"><em>monitorenter</em></span> attempts to gain ownership of the monitor associated with <span class="emphasis"><em>objectref</em></span>, as follows:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.monitorenter.desc-200-A"></a> If the entry count of the monitor associated with <span class="emphasis"><em>objectref</em></span> is zero, the thread enters the monitor and sets its entry count to one. The thread is then the owner of the monitor.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.monitorenter.desc-200-B"></a> If the thread already owns the monitor associated with <span class="emphasis"><em>objectref</em></span>, it reenters the monitor, incrementing its entry count.</p></li><li class="listitem"><p class="norm-dynamic"><a name="jvms-6.5.monitorenter.desc-200-C"></a> If another thread already owns the monitor associated with <span class="emphasis"><em>objectref</em></span>, the thread blocks until the monitor's entry count is zero, then tries again to gain ownership.</p></li></ul></div></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorenter.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.monitorenter.runtime-100"></a> If <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>monitorenter</em></span> throws a <code class="literal">NullPointerException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorenter.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.monitorenter.notes-100"></a> A <span class="emphasis"><em>monitorenter</em></span> instruction may be used with one or more <span class="emphasis"><em>monitorexit</em></span> instructions (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) to implement a <code class="literal">synchronized</code> statement in the Java programming language (<a class="xref" href="jvms-3.html#jvms-3.14" title="3.14. Synchronization">§3.14</a>). The <span class="emphasis"><em>monitorenter</em></span> and <span class="emphasis"><em>monitorexit</em></span> instructions are not used in the implementation of <code class="literal">synchronized</code> methods, although they can be used to provide equivalent locking semantics. Monitor entry on invocation of a <code class="literal">synchronized</code> method, and monitor exit on its return, are handled implicitly by the Java Virtual Machine's method invocation and return instructions, as if <span class="emphasis"><em>monitorenter</em></span> and <span class="emphasis"><em>monitorexit</em></span> were used.</p><p class="norm"><a name="jvms-6.5.monitorenter.notes-200"></a> The association of a monitor with an object may be managed in various ways that are beyond the scope of this specification. For instance, the monitor may be allocated and deallocated at the same time as the object. Alternatively, it may be dynamically allocated at the time when a thread attempts to gain exclusive access to the object and freed at some later time when no thread remains in the monitor for the object.</p><p class="norm"><a name="jvms-6.5.monitorenter.notes-300"></a> The synchronization constructs of the Java programming language require support for operations on monitors besides entry and exit. These include waiting on a monitor (<code class="literal">Object.wait</code>) and notifying other threads waiting on a monitor (<code class="literal">Object.notifyAll</code> and <code class="literal">Object.notify</code>). These operations are supported in the standard package <code class="literal">java.lang</code> supplied with the Java Virtual Machine. No explicit support for these operations appears in the instruction set of the Java Virtual Machine.</p></div></div><div class="section-execution" title="monitorexit"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.monitorexit"></a><span class="emphasis"><em>monitorexit</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23703"></a>Operation</h4></div></div></div><p class="norm">Exit monitor for object</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23706"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>monitorexit</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23710"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>monitorexit</em></span> = 195 (0xc3)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23714"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorexit.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.monitorexit.desc-100"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code>.</p><p class="norm-dynamic"><a name="jvms-6.5.monitorexit.desc-110"></a> The thread that executes <span class="emphasis"><em>monitorexit</em></span> must be the owner of the monitor associated with the instance referenced by <span class="emphasis"><em>objectref</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.monitorexit.desc-200"></a> The thread decrements the entry count of the monitor associated with <span class="emphasis"><em>objectref</em></span>. If as a result the value of the entry count is zero, the thread exits the monitor and is no longer its owner. Other threads that are blocking to enter the monitor are allowed to attempt to do so.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorexit.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.monitorexit.runtime-100"></a> If <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>monitorexit</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.monitorexit.runtime-110"></a> Otherwise, if the thread that executes <span class="emphasis"><em>monitorexit</em></span> is not the owner of the monitor associated with the instance referenced by <span class="emphasis"><em>objectref</em></span>, <span class="emphasis"><em>monitorexit</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p><p class="norm-error"><a name="jvms-6.5.monitorexit.runtime-120"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the second of those rules is violated by the execution of this <span class="emphasis"><em>monitorexit</em></span> instruction, then <span class="emphasis"><em>monitorexit</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.monitorexit.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.monitorexit.notes-100"></a> One or more <span class="emphasis"><em>monitorexit</em></span> instructions may be used with a <span class="emphasis"><em>monitorenter</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorenter" title="monitorenter">§<span class="emphasis"><em>monitorenter</em></span></a>) to implement a <code class="literal">synchronized</code> statement in the Java programming language (<a class="xref" href="jvms-3.html#jvms-3.14" title="3.14. Synchronization">§3.14</a>). The <span class="emphasis"><em>monitorenter</em></span> and <span class="emphasis"><em>monitorexit</em></span> instructions are not used in the implementation of <code class="literal">synchronized</code> methods, although they can be used to provide equivalent locking semantics.</p><p class="norm"><a name="jvms-6.5.monitorexit.notes-200"></a> The Java Virtual Machine supports exceptions thrown within <code class="literal">synchronized</code> methods and <code class="literal">synchronized</code> statements differently:</p><div class="norm"><ul class="norm" type="disc"><li class="listitem"><p class="norm"><a name="jvms-6.5.monitorexit.notes-200-A"></a> Monitor exit on normal <code class="literal">synchronized</code> method completion is handled by the Java Virtual Machine's return instructions. Monitor exit on abrupt <code class="literal">synchronized</code> method completion is handled implicitly by the Java Virtual Machine's <span class="emphasis"><em>athrow</em></span> instruction.</p></li><li class="listitem"><p class="norm"><a name="jvms-6.5.monitorexit.notes-200-B"></a> When an exception is thrown from within a <code class="literal">synchronized</code> statement, exit from the monitor entered prior to the execution of the <code class="literal">synchronized</code> statement is achieved using the Java Virtual Machine's exception handling mechanism (<a class="xref" href="jvms-3.html#jvms-3.14" title="3.14. Synchronization">§3.14</a>).</p></li></ul></div></div></div><div class="section-execution" title="multianewarray"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.multianewarray"></a><span class="emphasis"><em>multianewarray</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23775"></a>Operation</h4></div></div></div><p class="norm">Create new multidimensional array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23778"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>multianewarray</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br> <span class="emphasis"><em>dimensions</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23785"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>multianewarray</em></span> = 197 (0xc5)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23789"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>count1</em></span>, [<span class="emphasis"><em>count2</em></span>, ...] <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>arrayref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.multianewarray.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.multianewarray.desc-100"></a> The <span class="emphasis"><em>dimensions</em></span> operand is an unsigned byte that must be greater than or equal to 1. It represents the number of dimensions of the array to be created. The operand stack must contain <span class="emphasis"><em>dimensions</em></span> values. Each such value represents the number of components in a dimension of the array to be created, must be of type <code class="literal">int</code>, and must be non-negative. The <span class="emphasis"><em>count1</em></span> is the desired length in the first dimension, <span class="emphasis"><em>count2</em></span> in the second, etc.</p><p class="norm-dynamic"><a name="jvms-6.5.multianewarray.desc-200"></a> All of the <span class="emphasis"><em>count</em></span> values are popped off the operand stack. The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry 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 class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>). The resulting entry must be an array class type of dimensionality greater than or equal to <span class="emphasis"><em>dimensions</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.multianewarray.desc-300"></a> A new multidimensional array of the array type is allocated from the garbage-collected heap. If any <span class="emphasis"><em>count</em></span> value is zero, no subsequent dimensions are allocated. The components of the array in the first dimension are initialized to subarrays of the type of the second dimension, and so on. The components of the last allocated dimension of the array are initialized to the default initial value (<a class="xref" href="jvms-2.html#jvms-2.3" title="2.3. Primitive Types and Values">§2.3</a>, <a class="xref" href="jvms-2.html#jvms-2.4" title="2.4. Reference Types and Values">§2.4</a>) for the element type of the array type. A <code class="literal">reference</code> <span class="emphasis"><em>arrayref</em></span> to the new array is pushed onto the operand stack.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.multianewarray.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.multianewarray.linking-100"></a> During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in <a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a> can be thrown.</p><p class="norm-error"><a name="jvms-6.5.multianewarray.linking-110"></a> Otherwise, if the current class does not have permission to access the element type of the resolved array class, <span class="emphasis"><em>multianewarray</em></span> throws an <code class="literal">IllegalAccessError</code>.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.multianewarray.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.multianewarray.runtime-100"></a> Otherwise, if any of the <span class="emphasis"><em>dimensions</em></span> values on the operand stack are less than zero, the <span class="emphasis"><em>multianewarray</em></span> instruction throws a <code class="literal">NegativeArraySizeException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.multianewarray.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.multianewarray.notes-100"></a> It may be more efficient to use <span class="emphasis"><em>newarray</em></span> or <span class="emphasis"><em>anewarray</em></span> (<a class="xref" href="jvms-6.html#jvms-6.5.newarray" title="newarray">§<span class="emphasis"><em>newarray</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.anewarray" title="anewarray">§<span class="emphasis"><em>anewarray</em></span></a>) when creating an array of a single dimension.</p><p class="norm"><a name="jvms-6.5.multianewarray.notes-200"></a> The array class referenced via the run-time constant pool may have more dimensions than the <span class="emphasis"><em>dimensions</em></span> operand of the <span class="emphasis"><em>multianewarray</em></span> instruction. In that case, only the first <span class="emphasis"><em>dimensions</em></span> of the dimensions of the array are created.</p></div></div><div class="section-execution" title="new"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.new"></a><span class="emphasis"><em>new</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23848"></a>Operation</h4></div></div></div><p class="norm">Create new object</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23851"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>new</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23857"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>new</em></span> = 187 (0xbb)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23861"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>objectref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.new.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.new.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a class or interface type. The named class or interface type is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a>) and should result in a class type. Memory for a new instance of that class is allocated from the garbage-collected heap, and the instance variables of the new object are initialized to their default initial values (<a class="xref" href="jvms-2.html#jvms-2.3" title="2.3. Primitive Types and Values">§2.3</a>, <a class="xref" href="jvms-2.html#jvms-2.4" title="2.4. Reference Types and Values">§2.4</a>). The <span class="emphasis"><em>objectref</em></span>, a <code class="literal">reference</code> to the instance, is pushed onto the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.new.desc-200"></a> On successful resolution of the class, it is initialized if it has not already been initialized (<a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>).</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.new.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.new.linking-100"></a> During resolution of the symbolic reference to the class or interface type, any of the exceptions documented in <a class="xref" href="jvms-5.html#jvms-5.4.3.1" title="5.4.3.1. Class and Interface Resolution">§5.4.3.1</a> can be thrown.</p><p class="norm-error"><a name="jvms-6.5.new.linking-110"></a> Otherwise, if the symbolic reference to the class or interface type resolves to an interface or an <code class="literal">abstract</code> class, <span class="emphasis"><em>new</em></span> throws an <code class="literal">InstantiationError</code>.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.new.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.new.runtime-100"></a> Otherwise, if execution of this <span class="emphasis"><em>new</em></span> instruction causes initialization of the referenced class, <span class="emphasis"><em>new</em></span> may throw an <code class="literal">Error</code> as detailed in JLS §15.9.4.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.new.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.new.notes-100"></a> The <span class="emphasis"><em>new</em></span> instruction does not completely create a new instance; instance creation is not completed until an instance initialization method (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>) has been invoked on the uninitialized instance.</p></div></div><div class="section-execution" title="newarray"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.newarray"></a><span class="emphasis"><em>newarray</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23905"></a>Operation</h4></div></div></div><p class="norm">Create new array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23908"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>newarray</em></span><br> <span class="emphasis"><em>atype</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23913"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>newarray</em></span> = 188 (0xbc)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e23917"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>count</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>arrayref</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.newarray.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.newarray.desc-100"></a> The <span class="emphasis"><em>count</em></span> must be of type <code class="literal">int</code>. It is popped off the operand stack. The <span class="emphasis"><em>count</em></span> represents the number of elements in the array to be created.</p><p class="norm-dynamic"><a name="jvms-6.5.newarray.desc-110"></a> The <span class="emphasis"><em>atype</em></span> is a code that indicates the type of array to create. It must take one of the following values:</p><div class="table"><a name="jvms-6.5.newarray.desc-120"></a><p class="title"><b>Table 6.5.newarray-A. Array type codes</b></p><div class="table-contents"><table summary="Array type codes" border="1"><colgroup><col><col></colgroup><thead><tr><th>Array Type</th><th><span class="emphasis"><em>atype</em></span></th></tr></thead><tbody><tr><td><code class="literal">T_BOOLEAN</code></td><td>4</td></tr><tr><td><code class="literal">T_CHAR</code></td><td>5</td></tr><tr><td><code class="literal">T_FLOAT</code></td><td>6</td></tr><tr><td><code class="literal">T_DOUBLE</code></td><td>7</td></tr><tr><td><code class="literal">T_BYTE</code></td><td>8</td></tr><tr><td><code class="literal">T_SHORT</code></td><td>9</td></tr><tr><td><code class="literal">T_INT</code></td><td>10</td></tr><tr><td><code class="literal">T_LONG</code></td><td>11</td></tr></tbody></table></div></div><br class="table-break"><p class="norm-dynamic"><a name="jvms-6.5.newarray.desc-200"></a> A new array whose components are of type <span class="emphasis"><em>atype</em></span> and of length <span class="emphasis"><em>count</em></span> is allocated from the garbage-collected heap. A <code class="literal">reference</code> <span class="emphasis"><em>arrayref</em></span> to this new array object is pushed into the operand stack. Each of the elements of the new array is initialized to the default initial value (<a class="xref" href="jvms-2.html#jvms-2.3" title="2.3. Primitive Types and Values">§2.3</a>, <a class="xref" href="jvms-2.html#jvms-2.4" title="2.4. Reference Types and Values">§2.4</a>) for the element type of the array type.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.newarray.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.newarray.runtime-100"></a> If <span class="emphasis"><em>count</em></span> is less than zero, <span class="emphasis"><em>newarray</em></span> throws a <code class="literal">NegativeArraySizeException</code>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.newarray.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.newarray.notes-100"></a> In Oracle's Java Virtual Machine implementation, arrays of type <code class="literal">boolean</code> (<span class="emphasis"><em>atype</em></span> is <code class="literal">T_BOOLEAN</code>) are stored as arrays of 8-bit values and are manipulated using the <span class="emphasis"><em>baload</em></span> and <span class="emphasis"><em>bastore</em></span> instructions (<a class="xref" href="jvms-6.html#jvms-6.5.baload" title="baload">§<span class="emphasis"><em>baload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.bastore" title="bastore">§<span class="emphasis"><em>bastore</em></span></a>) which also access arrays of type <code class="literal">byte</code>. Other implementations may implement packed <code class="literal">boolean</code> arrays; the <span class="emphasis"><em>baload</em></span> and <span class="emphasis"><em>bastore</em></span> instructions must still be used to access those arrays.</p></div></div><div class="section-execution" title="nop"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.nop"></a><span class="emphasis"><em>nop</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24003"></a>Operation</h4></div></div></div><p class="norm">Do nothing</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24006"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>nop</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24010"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>nop</em></span> = 0 (0x0)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24014"></a>Operand Stack</h4></div></div></div><p class="norm">No change</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.nop.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.nop.desc-100"></a> Do nothing.</p></div></div><div class="section-execution" title="pop"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.pop"></a><span class="emphasis"><em>pop</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24023"></a>Operation</h4></div></div></div><p class="norm">Pop the top operand stack value</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24026"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>pop</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24030"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>pop</em></span> = 87 (0x57)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24034"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.pop.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.pop.desc-100"></a> Pop the top value from the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.pop.desc-110"></a> The <span class="emphasis"><em>pop</em></span> instruction must not be used unless <span class="emphasis"><em>value</em></span> is a value of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div></div><div class="section-execution" title="pop2"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.pop2"></a><span class="emphasis"><em>pop2</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24050"></a>Operation</h4></div></div></div><p class="norm">Pop the top one or two operand stack values</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24053"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>pop2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24057"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>pop2</em></span> = 88 (0x58)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.pop2.stack"></a>Operand Stack</h4></div></div></div><p class="norm"><a name="jvms-6.5.pop2.stack-100"></a>Form 1:</p><p class="norm"><a name="jvms-6.5.pop2.stack-100-A"></a>..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.pop2.stack-100-B"></a>...</p><p class="norm"><a name="jvms-6.5.pop2.stack-110"></a> where each of <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> is a value of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p><p class="norm"><a name="jvms-6.5.pop2.stack-200"></a>Form 2:</p><p class="norm"><a name="jvms-6.5.pop2.stack-200-A"></a>..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm"><a name="jvms-6.5.pop2.stack-200-B"></a>...</p><p class="norm"><a name="jvms-6.5.pop2.stack-210"></a> where <span class="emphasis"><em>value</em></span> is a value of a category 2 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.pop2.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.pop2.desc-100"></a> Pop the top one or two values from the operand stack.</p></div></div><div class="section-execution" title="putfield"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.putfield"></a><span class="emphasis"><em>putfield</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24087"></a>Operation</h4></div></div></div><p class="norm">Set field in object</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24090"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>putfield</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24096"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>putfield</em></span> = 181 (0xb5)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24100"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>objectref</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putfield.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a field (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor of the field as well as a symbolic reference to the class in which the field is to be found. The referenced field is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-200"></a> The type of a <span class="emphasis"><em>value</em></span> stored by a <span class="emphasis"><em>putfield</em></span> instruction must be compatible with the descriptor of the referenced field (<a class="xref" href="jvms-4.html#jvms-4.3.2" title="4.3.2. Field Descriptors">§4.3.2</a>). If the field descriptor type is <code class="literal">boolean</code>, <code class="literal">byte</code>, <code class="literal">char</code>, <code class="literal">short</code>, or <code class="literal">int</code>, then the <span class="emphasis"><em>value</em></span> must be an <code class="literal">int</code>. If the field descriptor type is <code class="literal">float</code>, <code class="literal">long</code>, or <code class="literal">double</code>, then the <span class="emphasis"><em>value</em></span> must be a <code class="literal">float</code>, <code class="literal">long</code>, or <code class="literal">double</code>, respectively. If the field descriptor type is a reference type, then the <span class="emphasis"><em>value</em></span> must be of a type that is assignment compatible (JLS §5.2) with the field descriptor type. If the field is <code class="literal">final</code>, it must be declared in the current class, and the instruction must occur in an instance initialization method of the current class (<a class="xref" href="jvms-2.html#jvms-2.9.1" title="2.9.1. Instance Initialization Methods">§2.9.1</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-300"></a> The <span class="emphasis"><em>value</em></span> and <span class="emphasis"><em>objectref</em></span> are popped from the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-310"></a> The <span class="emphasis"><em>objectref</em></span> must be of type <code class="literal">reference</code> but not an array type.</p><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-320"></a> If the <span class="emphasis"><em>value</em></span> is of type <code class="literal">int</code> and the field descriptor type is <code class="literal">boolean</code>, then the <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is narrowed by taking the bitwise AND of <span class="emphasis"><em>value</em></span> and 1, resulting in <span class="emphasis"><em>value</em></span>'. Otherwise, the <span class="emphasis"><em>value</em></span> undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'.</p><p class="norm-dynamic"><a name="jvms-6.5.putfield.desc-400"></a> The referenced field in <span class="emphasis"><em>objectref</em></span> is set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putfield.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.putfield.linking-100"></a> During resolution of the symbolic reference to the field, any of the exceptions pertaining to field resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.putfield.linking-110"></a> Otherwise, if the resolved field is a <code class="literal">static</code> field, <span class="emphasis"><em>putfield</em></span> throws an <code class="literal">IncompatibleClassChangeError</code>.</p><p class="norm-error"><a name="jvms-6.5.putfield.linking-120"></a> Otherwise, if the resolved field is <code class="literal">final</code>, it must be declared in the current class, and the instruction must occur in an instance initialization method of the current class. Otherwise, an <code class="literal">IllegalAccessError</code> is thrown.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putfield.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.putfield.runtime-100"></a> Otherwise, if <span class="emphasis"><em>objectref</em></span> is <code class="literal">null</code>, the <span class="emphasis"><em>putfield</em></span> instruction throws a <code class="literal">NullPointerException</code>.</p></div></div><div class="section-execution" title="putstatic"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.putstatic"></a><span class="emphasis"><em>putstatic</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24180"></a>Operation</h4></div></div></div><p class="norm">Set static field in class</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24183"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>putstatic</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24189"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>putstatic</em></span> = 179 (0xb3)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24193"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putstatic.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-100"></a> The unsigned <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> are used to construct an index into the run-time constant pool of the current class (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The run-time constant pool entry at the index must be a symbolic reference to a field (<a class="xref" href="jvms-5.html#jvms-5.1" title="5.1. The Run-Time Constant Pool">§5.1</a>), which gives the name and descriptor of the field as well as a symbolic reference to the class or interface in which the field is to be found. The referenced field is resolved (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-110"></a> On successful resolution of the field, the class or interface that declared the resolved field is initialized if that class or interface has not already been initialized (<a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-200"></a> The type of a <span class="emphasis"><em>value</em></span> stored by a <span class="emphasis"><em>putstatic</em></span> instruction must be compatible with the descriptor of the referenced field (<a class="xref" href="jvms-4.html#jvms-4.3.2" title="4.3.2. Field Descriptors">§4.3.2</a>). If the field descriptor type is <code class="literal">boolean</code>, <code class="literal">byte</code>, <code class="literal">char</code>, <code class="literal">short</code>, or <code class="literal">int</code>, then the <span class="emphasis"><em>value</em></span> must be an <code class="literal">int</code>. If the field descriptor type is <code class="literal">float</code>, <code class="literal">long</code>, or <code class="literal">double</code>, then the <span class="emphasis"><em>value</em></span> must be a <code class="literal">float</code>, <code class="literal">long</code>, or <code class="literal">double</code>, respectively. If the field descriptor type is a reference type, then the <span class="emphasis"><em>value</em></span> must be of a type that is assignment compatible (JLS §5.2) with the field descriptor type. If the field is <code class="literal">final</code>, it must be declared in the current class or interface, and the instruction must occur in the class or interface initialization method of the current class or interface (<a class="xref" href="jvms-2.html#jvms-2.9.2" title="2.9.2. Class Initialization Methods">§2.9.2</a>).</p><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-300"></a> The <span class="emphasis"><em>value</em></span> is popped from the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-310"></a> If the <span class="emphasis"><em>value</em></span> is of type <code class="literal">int</code> and the field descriptor type is <code class="literal">boolean</code>, then the <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is narrowed by taking the bitwise AND of <span class="emphasis"><em>value</em></span> and 1, resulting in <span class="emphasis"><em>value</em></span>'. Otherwise, the <span class="emphasis"><em>value</em></span> undergoes value set conversion (<a class="xref" href="jvms-2.html#jvms-2.8.3" title="2.8.3. Value Set Conversion">§2.8.3</a>), resulting in <span class="emphasis"><em>value</em></span>'.</p><p class="norm-dynamic"><a name="jvms-6.5.putstatic.desc-400"></a> The referenced field in the class or interface is set to <span class="emphasis"><em>value</em></span>'.</p></div><div class="section" title="Linking Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putstatic.linking"></a>Linking Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.putstatic.linking-100"></a> During resolution of the symbolic reference to the class or interface field, any of the exceptions pertaining to field resolution (<a class="xref" href="jvms-5.html#jvms-5.4.3.2" title="5.4.3.2. Field Resolution">§5.4.3.2</a>) can be thrown.</p><p class="norm-error"><a name="jvms-6.5.putstatic.linking-110"></a> Otherwise, if the resolved field is not a <code class="literal">static</code> (class) field or an interface field, <span class="emphasis"><em>putstatic</em></span> throws an <code class="literal">IncompatibleClassChangeError</code>.</p><p class="norm-error"><a name="jvms-6.5.putstatic.linking-120"></a> Otherwise, if the resolved field is <code class="literal">final</code>, it must be declared in the current class or interface, and the instruction must occur in the class or interface initialization method of the current class or interface. Otherwise, an <code class="literal">IllegalAccessError</code> is thrown.</p></div><div class="section" title="Run-time Exception"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putstatic.runtime"></a>Run-time Exception</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.putstatic.runtime-100"></a> Otherwise, if execution of this <span class="emphasis"><em>putstatic</em></span> instruction causes initialization of the referenced class or interface, <span class="emphasis"><em>putstatic</em></span> may throw an <code class="literal">Error</code> as detailed in <a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.putstatic.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.putstatic.notes-100"></a> A <span class="emphasis"><em>putstatic</em></span> instruction may be used only to set the value of an interface field on the initialization of that field. Interface fields may be assigned to only once, on execution of an interface variable initialization expression when the interface is initialized (<a class="xref" href="jvms-5.html#jvms-5.5" title="5.5. Initialization">§5.5</a>, JLS §9.3.1).</p></div></div><div class="section-execution" title="ret"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.ret"></a><span class="emphasis"><em>ret</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24274"></a>Operation</h4></div></div></div><p class="norm">Return from subroutine</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24277"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>ret</em></span><br> <span class="emphasis"><em>index</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24282"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>ret</em></span> = 169 (0xa9)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24286"></a>Operand Stack</h4></div></div></div><p class="norm">No change</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ret.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.ret.desc-100"></a> The <span class="emphasis"><em>index</em></span> is an unsigned byte between 0 and 255, inclusive. The local variable at <span class="emphasis"><em>index</em></span> in the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) must contain a value of type <code class="literal">returnAddress</code>. The contents of the local variable are written into the Java Virtual Machine's <code class="literal">pc</code> register, and execution continues there.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.ret.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.ret.notes-100"></a> Note that <span class="emphasis"><em>jsr</em></span> (<a class="xref" href="jvms-6.html#jvms-6.5.jsr" title="jsr">§<span class="emphasis"><em>jsr</em></span></a>) pushes the address onto the operand stack and <span class="emphasis"><em>ret</em></span> gets it out of a local variable. This asymmetry is intentional.</p><p class="norm"><a name="jvms-6.5.ret.notes-200"></a> In Oracle's implementation of a compiler for the Java programming language prior to Java SE 6, the <span class="emphasis"><em>ret</em></span> instruction was used with the <span class="emphasis"><em>jsr</em></span> and <span class="emphasis"><em>jsr_w</em></span> instructions (<a class="xref" href="jvms-6.html#jvms-6.5.jsr" title="jsr">§<span class="emphasis"><em>jsr</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.jsr_w" title="jsr_w">§<span class="emphasis"><em>jsr_w</em></span></a>) in the implementation of the <code class="literal">finally</code> clause (<a class="xref" href="jvms-3.html#jvms-3.13" title="3.13. Compiling finally">§3.13</a>, <a class="xref" href="jvms-4.html#jvms-4.10.2.5" title="4.10.2.5. Exceptions and finally">§4.10.2.5</a>).</p><p class="norm"><a name="jvms-6.5.ret.notes-300"></a> The <span class="emphasis"><em>ret</em></span> instruction should not be confused with the <span class="emphasis"><em>return</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.return" title="return">§<span class="emphasis"><em>return</em></span></a>). A <span class="emphasis"><em>return</em></span> instruction returns control from a method to its invoker, without passing any value back to the invoker.</p><p class="norm"><a name="jvms-6.5.ret.notes-400"></a> The <span class="emphasis"><em>ret</em></span> opcode can be used in conjunction with the <span class="emphasis"><em>wide</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.wide" title="wide">§<span class="emphasis"><em>wide</em></span></a>) to access a local variable using a two-byte unsigned index.</p></div></div><div class="section-execution" title="return"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.return"></a><span class="emphasis"><em>return</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24324"></a>Operation</h4></div></div></div><p class="norm">Return <code class="literal">void</code> from method</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24328"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>return</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24332"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>return</em></span> = 177 (0xb1)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24336"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">[empty]</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.return.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.return.desc-100"></a> The current method must have return type <code class="literal">void</code>. If the current method is a <code class="literal">synchronized</code> method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a <span class="emphasis"><em>monitorexit</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.monitorexit" title="monitorexit">§<span class="emphasis"><em>monitorexit</em></span></a>) in the current thread. If no exception is thrown, any values on the operand stack of the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>) are discarded.</p><p class="norm"><a name="jvms-6.5.return.desc-110"></a> The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.return.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.return.runtime-100"></a> If the Java Virtual Machine implementation does not enforce the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a>, then if the current method is a <code class="literal">synchronized</code> method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, <span class="emphasis"><em>return</em></span> throws an <code class="literal">IllegalMonitorStateException</code>. This can happen, for example, if a <code class="literal">synchronized</code> method contains a <span class="emphasis"><em>monitorexit</em></span> instruction, but no <span class="emphasis"><em>monitorenter</em></span> instruction, on the object on which the method is <code class="literal">synchronized</code>.</p><p class="norm-error"><a name="jvms-6.5.return.runtime-110"></a> Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in <a class="xref" href="jvms-2.html#jvms-2.11.10" title="2.11.10. Synchronization">§2.11.10</a> and if the first of those rules is violated during invocation of the current method, then <span class="emphasis"><em>return</em></span> throws an <code class="literal">IllegalMonitorStateException</code>.</p></div></div><div class="section-execution" title="saload"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.saload"></a><span class="emphasis"><em>saload</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24368"></a>Operation</h4></div></div></div><p class="norm">Load <code class="literal">short</code> from array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24372"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>saload</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24376"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>saload</em></span> = 53 (0x35)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24380"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.saload.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.saload.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">short</code>. The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code>. Both <span class="emphasis"><em>arrayref</em></span> and <span class="emphasis"><em>index</em></span> are popped from the operand stack. The component of the array at <span class="emphasis"><em>index</em></span> is retrieved and sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>value</em></span>. That <span class="emphasis"><em>value</em></span> is pushed onto the operand stack.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.saload.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.saload.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>saload</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.saload.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>saload</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="sastore"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.sastore"></a><span class="emphasis"><em>sastore</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24417"></a>Operation</h4></div></div></div><p class="norm">Store into <code class="literal">short</code> array</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24421"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>sastore</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24425"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>sastore</em></span> = 86 (0x56)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24429"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, <span class="emphasis"><em>value</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.sastore.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.sastore.desc-100"></a> The <span class="emphasis"><em>arrayref</em></span> must be of type <code class="literal">reference</code> and must refer to an array whose components are of type <code class="literal">short</code>. Both <span class="emphasis"><em>index</em></span> and <span class="emphasis"><em>value</em></span> must be of type <code class="literal">int</code>. The <span class="emphasis"><em>arrayref</em></span>, <span class="emphasis"><em>index</em></span>, and <span class="emphasis"><em>value</em></span> are popped from the operand stack. The <code class="literal">int</code> <span class="emphasis"><em>value</em></span> is truncated to a <code class="literal">short</code> and stored as the component of the array indexed by <span class="emphasis"><em>index</em></span>.</p></div><div class="section" title="Run-time Exceptions"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.sastore.runtime"></a>Run-time Exceptions</h4></div></div></div><p class="norm-error"><a name="jvms-6.5.sastore.runtime-100"></a> If <span class="emphasis"><em>arrayref</em></span> is <code class="literal">null</code>, <span class="emphasis"><em>sastore</em></span> throws a <code class="literal">NullPointerException</code>.</p><p class="norm-error"><a name="jvms-6.5.sastore.runtime-110"></a> Otherwise, if <span class="emphasis"><em>index</em></span> is not within the bounds of the array referenced by <span class="emphasis"><em>arrayref</em></span>, the <span class="emphasis"><em>sastore</em></span> instruction throws an <code class="literal">ArrayIndexOutOfBoundsException</code>.</p></div></div><div class="section-execution" title="sipush"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.sipush"></a><span class="emphasis"><em>sipush</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24468"></a>Operation</h4></div></div></div><p class="norm">Push <code class="literal">short</code></p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24472"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>sipush</em></span><br> <span class="emphasis"><em>byte1</em></span><br> <span class="emphasis"><em>byte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24478"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>sipush</em></span> = 17 (0x11)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24482"></a>Operand Stack</h4></div></div></div><p class="norm">... <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.sipush.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.sipush.desc-100"></a> The immediate unsigned <span class="emphasis"><em>byte1</em></span> and <span class="emphasis"><em>byte2</em></span> values are assembled into an intermediate <code class="literal">short</code>, where the value of the <code class="literal">short</code> is (<span class="emphasis"><em>byte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>byte2</em></span>. The intermediate value is then sign-extended to an <code class="literal">int</code> <span class="emphasis"><em>value</em></span>. That <span class="emphasis"><em>value</em></span> is pushed onto the operand stack.</p></div></div><div class="section-execution" title="swap"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.swap"></a><span class="emphasis"><em>swap</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24504"></a>Operation</h4></div></div></div><p class="norm">Swap the top two operand stack values</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24507"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>swap</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24511"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>swap</em></span> = 95 (0x5f)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24515"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>value2</em></span>, <span class="emphasis"><em>value1</em></span> <span class="symbol">→</span></p><p class="norm">..., <span class="emphasis"><em>value1</em></span>, <span class="emphasis"><em>value2</em></span></p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.swap.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.swap.desc-100"></a> Swap the top two values on the operand stack.</p><p class="norm-dynamic"><a name="jvms-6.5.swap.desc-200"></a> The <span class="emphasis"><em>swap</em></span> instruction must not be used unless <span class="emphasis"><em>value1</em></span> and <span class="emphasis"><em>value2</em></span> are both values of a category 1 computational type (<a class="xref" href="jvms-2.html#jvms-2.11.1" title="2.11.1. Types and the Java Virtual Machine">§2.11.1</a>).</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.swap.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.swap.notes-100"></a> The Java Virtual Machine does not provide an instruction implementing a swap on operands of category 2 computational types.</p></div></div><div class="section-execution" title="tableswitch"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.tableswitch"></a><span class="emphasis"><em>tableswitch</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24538"></a>Operation</h4></div></div></div><p class="norm">Access jump table by index and jump</p></div><div class="section" title="Format"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24541"></a>Format</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>tableswitch</em></span><br> <span class="emphasis"><em><0-3 byte pad></em></span><br> <span class="emphasis"><em>defaultbyte1</em></span><br> <span class="emphasis"><em>defaultbyte2</em></span><br> <span class="emphasis"><em>defaultbyte3</em></span><br> <span class="emphasis"><em>defaultbyte4</em></span><br> <span class="emphasis"><em>lowbyte1</em></span><br> <span class="emphasis"><em>lowbyte2</em></span><br> <span class="emphasis"><em>lowbyte3</em></span><br> <span class="emphasis"><em>lowbyte4</em></span><br> <span class="emphasis"><em>highbyte1</em></span><br> <span class="emphasis"><em>highbyte2</em></span><br> <span class="emphasis"><em>highbyte3</em></span><br> <span class="emphasis"><em>highbyte4</em></span><br> <span class="emphasis"><em>jump offsets...</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24559"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>tableswitch</em></span> = 170 (0xaa)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24563"></a>Operand Stack</h4></div></div></div><p class="norm">..., <span class="emphasis"><em>index</em></span> <span class="symbol">→</span></p><p class="norm">...</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.tableswitch.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.tableswitch.desc-100"></a> A <span class="emphasis"><em>tableswitch</em></span> is a variable-length instruction. Immediately after the <span class="emphasis"><em>tableswitch</em></span> opcode, between zero and three bytes must act as padding, such that <span class="emphasis"><em>defaultbyte1</em></span> 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 are bytes constituting three signed 32-bit values: <span class="emphasis"><em>default</em></span>, <span class="emphasis"><em>low</em></span>, and <span class="emphasis"><em>high</em></span>. Immediately following are bytes constituting a series of <span class="emphasis"><em>high</em></span> - <span class="emphasis"><em>low</em></span> + 1 signed 32-bit offsets. The value <span class="emphasis"><em>low</em></span> must be less than or equal to <span class="emphasis"><em>high</em></span>. The <span class="emphasis"><em>high</em></span> - <span class="emphasis"><em>low</em></span> + 1 signed 32-bit offsets are treated as a 0-based jump table. Each of these signed 32-bit values is constructed as (<span class="emphasis"><em>byte1</em></span> <code class="literal"><<</code> 24) | (<span class="emphasis"><em>byte2</em></span> <code class="literal"><<</code> 16) | (<span class="emphasis"><em>byte3</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>byte4</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.tableswitch.desc-200"></a> The <span class="emphasis"><em>index</em></span> must be of type <code class="literal">int</code> and is popped from the operand stack. If <span class="emphasis"><em>index</em></span> is less than <span class="emphasis"><em>low</em></span> or <span class="emphasis"><em>index</em></span> is greater than <span class="emphasis"><em>high</em></span>, then a target address is calculated by adding <span class="emphasis"><em>default</em></span> to the address of the opcode of this <span class="emphasis"><em>tableswitch</em></span> instruction. Otherwise, the offset at position <span class="emphasis"><em>index</em></span> - <span class="emphasis"><em>low</em></span> of the jump table is extracted. The target address is calculated by adding that offset to the address of the opcode of this <span class="emphasis"><em>tableswitch</em></span> instruction. Execution then continues at the target address.</p><p class="norm-dynamic"><a name="jvms-6.5.tableswitch.desc-300"></a> The target address that can be calculated from each jump table offset, as well as the one that can be calculated from <span class="emphasis"><em>default</em></span>, must be the address of an opcode of an instruction within the method that contains this <span class="emphasis"><em>tableswitch</em></span> instruction.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.tableswitch.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.tableswitch.notes-100"></a> The alignment required of the 4-byte operands of the <span class="emphasis"><em>tableswitch</em></span> instruction guarantees 4-byte alignment of those operands if and only if the method that contains the <span class="emphasis"><em>tableswitch</em></span> starts on a 4-byte boundary.</p></div></div><div class="section-execution" title="wide"><div class="titlepage"><div><div><h3 class="title"><a name="jvms-6.5.wide"></a><span class="emphasis"><em>wide</em></span></h3></div></div></div><div class="section" title="Operation"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24614"></a>Operation</h4></div></div></div><p class="norm">Extend local variable index by additional bytes</p></div><div class="section" title="Format 1"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24617"></a>Format 1</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>wide</em></span><br> <span class="emphasis"><em><opcode></em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br></p></div><p class="norm">where <span class="emphasis"><em><opcode></em></span> is one of <span class="emphasis"><em>iload</em></span>, <span class="emphasis"><em>fload</em></span>, <span class="emphasis"><em>aload</em></span>, <span class="emphasis"><em>lload</em></span>, <span class="emphasis"><em>dload</em></span>, <span class="emphasis"><em>istore</em></span>, <span class="emphasis"><em>fstore</em></span>, <span class="emphasis"><em>astore</em></span>, <span class="emphasis"><em>lstore</em></span>, <span class="emphasis"><em>dstore</em></span>, or <span class="emphasis"><em>ret</em></span></p></div><div class="section" title="Format 2"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24637"></a>Format 2</h4></div></div></div><div class="literallayout"><p><br> <span class="emphasis"><em>wide</em></span><br> <span class="emphasis"><em>iinc</em></span><br> <span class="emphasis"><em>indexbyte1</em></span><br> <span class="emphasis"><em>indexbyte2</em></span><br> <span class="emphasis"><em>constbyte1</em></span><br> <span class="emphasis"><em>constbyte2</em></span><br></p></div></div><div class="section" title="Forms"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24646"></a>Forms</h4></div></div></div><p class="norm"><span class="emphasis"><em>wide</em></span> = 196 (0xc4)</p></div><div class="section" title="Operand Stack"><div class="titlepage"><div><div><h4 class="title"><a name="d5e24650"></a>Operand Stack</h4></div></div></div><p class="norm">Same as modified instruction</p></div><div class="section" title="Description"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.wide.desc"></a>Description</h4></div></div></div><p class="norm-dynamic"><a name="jvms-6.5.wide.desc-100"></a> The <span class="emphasis"><em>wide</em></span> instruction modifies the behavior of another instruction. It takes one of two formats, depending on the instruction being modified. The first form of the <span class="emphasis"><em>wide</em></span> instruction modifies one of the instructions <span class="emphasis"><em>iload</em></span>, <span class="emphasis"><em>fload</em></span>, <span class="emphasis"><em>aload</em></span>, <span class="emphasis"><em>lload</em></span>, <span class="emphasis"><em>dload</em></span>, <span class="emphasis"><em>istore</em></span>, <span class="emphasis"><em>fstore</em></span>, <span class="emphasis"><em>astore</em></span>, <span class="emphasis"><em>lstore</em></span>, <span class="emphasis"><em>dstore</em></span>, or <span class="emphasis"><em>ret</em></span> (<a class="xref" href="jvms-6.html#jvms-6.5.iload" title="iload">§<span class="emphasis"><em>iload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.fload" title="fload">§<span class="emphasis"><em>fload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.aload" title="aload">§<span class="emphasis"><em>aload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.lload" title="lload">§<span class="emphasis"><em>lload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.dload" title="dload">§<span class="emphasis"><em>dload</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.istore" title="istore">§<span class="emphasis"><em>istore</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.fstore" title="fstore">§<span class="emphasis"><em>fstore</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.astore" title="astore">§<span class="emphasis"><em>astore</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.lstore" title="lstore">§<span class="emphasis"><em>lstore</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.dstore" title="dstore">§<span class="emphasis"><em>dstore</em></span></a>, <a class="xref" href="jvms-6.html#jvms-6.5.ret" title="ret">§<span class="emphasis"><em>ret</em></span></a>). The second form applies only to the <span class="emphasis"><em>iinc</em></span> instruction (<a class="xref" href="jvms-6.html#jvms-6.5.iinc" title="iinc">§<span class="emphasis"><em>iinc</em></span></a>).</p><p class="norm-dynamic"><a name="jvms-6.5.wide.desc-110"></a> In either case, the <span class="emphasis"><em>wide</em></span> opcode itself is followed in the compiled code by the opcode of the instruction <span class="emphasis"><em>wide</em></span> modifies. In either form, two unsigned bytes <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> follow the modified opcode and are assembled into a 16-bit unsigned index to a local variable in the current frame (<a class="xref" href="jvms-2.html#jvms-2.6" title="2.6. Frames">§2.6</a>), where the value of the index is (<span class="emphasis"><em>indexbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>indexbyte2</em></span>. The calculated index must be an index into the local variable array of the current frame. Where the <span class="emphasis"><em>wide</em></span> instruction modifies an <span class="emphasis"><em>lload</em></span>, <span class="emphasis"><em>dload</em></span>, <span class="emphasis"><em>lstore</em></span>, or <span class="emphasis"><em>dstore</em></span> instruction, the index following the calculated index (index + 1) must also be an index into the local variable array. In the second form, two immediate unsigned bytes <span class="emphasis"><em>constbyte1</em></span> and <span class="emphasis"><em>constbyte2</em></span> follow <span class="emphasis"><em>indexbyte1</em></span> and <span class="emphasis"><em>indexbyte2</em></span> in the code stream. Those bytes are also assembled into a signed 16-bit constant, where the constant is (<span class="emphasis"><em>constbyte1</em></span> <code class="literal"><<</code> 8) | <span class="emphasis"><em>constbyte2</em></span>.</p><p class="norm-dynamic"><a name="jvms-6.5.wide.desc-200"></a> The widened bytecode operates as normal, except for the use of the wider index and, in the case of the second form, the larger increment range.</p></div><div class="section" title="Notes"><div class="titlepage"><div><div><h4 class="title"><a name="jvms-6.5.wide.notes"></a>Notes</h4></div></div></div><p class="norm"><a name="jvms-6.5.wide.notes-100"></a> Although we say that <span class="emphasis"><em>wide</em></span> "modifies the behavior of another instruction," the <span class="emphasis"><em>wide</em></span> instruction effectively treats the bytes constituting the modified instruction as operands, denaturing the embedded instruction in the process. In the case of a modified <span class="emphasis"><em>iinc</em></span> instruction, one of the logical operands of the <span class="emphasis"><em>iinc</em></span> is not even at the normal offset from the opcode. The embedded instruction must never be executed directly; its opcode must never be the target of any control transfer instruction.</p></div></div>