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

📄 instructions2.doc2.html

📁 A Java virtual machine instruction consists of an opcode specifying the operation to be performed, f
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head><title>VM Spec  </title></head><body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000><table width=100%><tr><td><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc1.html">Prev</a> | <a href="Instructions2.doc3.html">Next</a> | <a href="VMSpecIX.fm.html">Index</a></td><td align=right><i><i>The Java<sup><font size=-2>TM</font></sup> Virtual Machine Specification</i></i></td></tr></table><hr><br> <a href="Instructions2.doc.html">A</a><a href="Instructions2.doc1.html">B</a><a href="Instructions2.doc2.html">C</a><a href="Instructions2.doc3.html">D</a><a href="Instructions2.doc4.html">F</a><a href="Instructions2.doc5.html">G</a><a href="Instructions2.doc6.html">I</a><a href="Instructions2.doc7.html">J</a><a href="Instructions2.doc8.html">L</a><a href="Instructions2.doc9.html">M</a><a href="Instructions2.doc10.html">N</a><a href="Instructions2.doc11.html">P</a><a href="Instructions2.doc12.html">R</a><a href="Instructions2.doc13.html">S</a><a href="Instructions2.doc14.html">T</a><a href="Instructions2.doc15.html">W</a><a name="caload"></a><hr><h2>caload</h2><a name="caload.Operation"></a><p><b>Operation</b><br><blockquote><a name="67348"></a>Load <code>char</code> from array<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67347"></a> <i>caload</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="caload.Forms"></a><p><b>Forms</b><br><blockquote><a name="67349"></a><i>caload</i><em> </em>= 52 (0x34)</blockquote><p><a name="caload.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67350"></a>..., <i>arrayref</i>, <i>index</i> <img src="chars/arrwdbrt.gif"> ..., <i>value</i></blockquote><p><a name="caload.Description"></a><p><b>Description</b><br><blockquote><a name="67351"></a>The <i>arrayref</i> must be of type <code>reference</code> and must refer to an array whose components are of type <code>char</code>. The <i>index</i> must be of type <code>int</code>. Both <i>arrayref</i> and <i>index</i> are popped from the operand stack. The component of the array at <i>index</i> is retrieved and zero-extended to an <code>int</code> <i>value</i>. That <i>value </i>is pushed onto the operand stack.</blockquote><p><a name="caload.Runtime"></a><p><b>Runtime Exceptions</b><br><blockquote><a name="67353"></a>If <i>arrayref</i><em> </em>is <code>null</code>, <i>caload</i> throws a <code>NullPointerException</code>. </blockquote><p><blockquote><a name="67354"></a>Otherwise, if <i>index</i> is not within the bounds of the array referenced by <i>arrayref</i>, the <i>caload</i> instruction throws an <code>ArrayIndexOutOfBoundsException</code>.</blockquote><p><a name="castore"></a><hr><h2>castore</h2><a name="castore.Operation"></a><p><b>Operation</b><br><blockquote><a name="67363"></a>Store into <code>char</code> array<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67362"></a> <i>castore</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="castore.Forms"></a><p><b>Forms</b><br><blockquote><a name="67364"></a><i>castore</i> = 85 (0x55)</blockquote><p><a name="castore.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67365"></a>..., <i>arrayref</i>, <i>index</i>, <i>value</i> <img src="chars/arrwdbrt.gif"> ...</blockquote><p><a name="castore.Description"></a><p><b>Description</b><br><blockquote><a name="67366"></a>The <i>arrayref</i> must be of type <code>reference</code> and must refer to an array whose components are of type <code>char</code>. The <i>index</i> and the <i>value</i> must both be of type <code>int</code>. The <i>arrayref</i>, <i>index</i>, and <i>value</i> are popped from the operand stack. The <code>int</code> <i>value</i> is truncated to a <code>char</code> and stored as the component of the array indexed by <i>index</i>. </blockquote><p><a name="castore.Runtime"></a><p><b>Runtime Exceptions</b><br><blockquote><a name="67368"></a>If <i>arrayref</i><em> </em>is <code>null</code>, <i>castore</i> throws a <code>NullPointerException</code>. </blockquote><p><blockquote><a name="67369"></a>Otherwise, if <i>index</i> is not within the bounds of the array referenced by <i>arrayref</i>, the <i>castore</i> instruction throws an <code>ArrayIndexOutOfBoundsException</code>.</blockquote><p><a name="checkcast"></a><hr><h2>checkcast</h2><a name="checkcast.Operation"></a><p><b>Operation</b><br><blockquote><a name="67380"></a>Check whether object is of given type<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="67375"></a> <i>checkcast</i><td><a name="87568"></a> <tr><td><a name="67377"></a> <i>indexbyte1</i><td><a name="87568"></a> <tr><td><a name="67379"></a> <i>indexbyte2</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="checkcast.Forms"></a><p><b>Forms</b><br><blockquote><a name="67381"></a><i>checkcast</i> = 192 (0xc0)</blockquote><p><a name="checkcast.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="67382"></a>..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>objectref</i></blockquote><p><a name="checkcast.Description"></a><p><b>Description</b><br><blockquote><a name="153291"></a>The <i>objectref</i> must be of type <code>reference</code>. The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the runtime constant pool of the current class <a href="Overview.doc.html#17257">(&#167;3.6)</a>, where the value of the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The runtime constant pool item at the index must be a symbolic reference to a class, array, or interface type. The named class, array, or interface type is resolved <a href="ConstantPool.doc.html#71636">(&#167;5.4.3.1)</a>.</blockquote><p><blockquote><a name="140250"></a>If <i>objectref</i> is <code>null</code> or can be cast to the resolved class, array, or interface type, the operand stack is unchanged; otherwise, the <i>checkcast</i> instruction throws a <code>ClassCastException</code>.</blockquote><p><blockquote><a name="140259"></a>The following rules are used to determine whether an <i>objectref</i> that is not <code>null</code> can be cast to the resolved type: if S is the class of the object referred to by <i>objectref</i> and T is the resolved class, array, or interface type, <i>checkcast</i> determines whether <i>objectref</i> can be cast to type T as follows:</blockquote><p><ul><li>If S is an ordinary (nonarray) class, then:<p><ul><li>If T is a class type, then S must be the same class <a href="Concepts.doc.html#20389">(&#167;2.8.1)</a>  as T, or a subclass of T.<p><li>If T is an interface type, then S must implement <a href="Concepts.doc.html#16432">(&#167;2.13)</a>  interface T.</ul></ul><blockquote><a name="214480"></a></blockquote><p><ul><li>If S is an interface type, then:<p><ul><li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.7)</a>.<p><li>If T is an interface type, then T must be the same interface as S or a superinterface of S <a href="Concepts.doc.html#20603">(&#167;2.13.2)</a>.<p></ul><li>If S is a class representing the array type SC<code>[]</code>, that is, an array of components of type SC, then:<p><ul><li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.7)</a>.<p><li>If T is an array type TC<code>[]</code>, that is, an array of components of type TC, then one of the following must be true:<p><ul><li>TC and SC are the same primitive type <a href="Concepts.doc.html#19511">(&#167;2.4.1)</a>.<p><li>TC and SC are reference types <a href="Concepts.doc.html#29375">(&#167;2.4.6)</a>, and type SC can be cast to TC by recursive application of these rules. <p></ul><li>If T is an interface type, T must be one of the interfaces implemented by arrays <a href="Concepts.doc.html#16446">(&#167;2.15)</a>. </ul></ul><a name="checkcast.Linking"></a><p><b>Linking Exceptions</b><br><blockquote><a name="140427"></a>During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in <a href="ConstantPool.doc.html#71636">Section 5.4.3.1</a> can be thrown.</blockquote><p><a name="checkcast.Runtime"></a><p><b>Runtime Exception</b><br><blockquote><a name="67420"></a>Otherwise, if <i>objectref</i><em> </em>cannot be cast to the resolved class, array, or interface type, the <i>checkcast</i> instruction throws a <code>ClassCast</code><code>Exception</code>.</blockquote><p><a name="checkcast.Notes"></a><p><b>Notes</b><br><blockquote><a name="67421"></a>The <i>checkcast</i> instruction is very similar to the <i>instanceof</i> instruction. It differs in its treatment of <code>null</code>, its behavior when its test fails (<i>checkcast</i> throws an exception, <i>instanceof</i> pushes a result code), and its effect on the operand stack.</blockquote><p><hr><!-- This inserts footnotes--><p><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc1.html">Prev</a> | <a href="Instructions2.doc3.html">Next</a> | <a href="VMSpecIX.fm.html">Index</a><p><font size="-1"><i>The Java</i><sup><font size=-2>TM</font></sup><i> Virtual Machine Specification </i><br><!-- HTML generated by Suzette Pelouch on March 30, 1999 --><i><a href="Copyright.doc.html">Copyright &#169 1999 Sun Microsystems, Inc.</a>All rights reserved</i><br>Please send any comments or corrections to <a href="mailto:jvm@java.sun.com">jvm@java.sun.com</a></font></body></html>

⌨️ 快捷键说明

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