📄 quick2.doc.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="Quick.doc.html">Prev</a> | <a href="Mnemonics.doc.html">Next</a> | <a href="Lindholm.INDEX.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 name="anewarray_quick"></a>
<h2>anewarray_quick</h2>
<a name="anewarray_quick.Operation"></a>
<b>Operation</h3></b>
<a name="12436"></a>
Create new array<p><Table Border="1">
<tr><td><a name="12431"></a>
<i>anewarray_quick</i>
<td><a name="26"></a>
<tr><td><a name="12433"></a>
<i>indexbyte1</i>
<td><a name="33"></a>
<tr><td><a name="12435"></a>
<i>indexbyte2</i>
<td><a name="40"></a>
</Table><br><br> of <code>reference</code><p>
<a name="anewarray_quick.Forms"></a>
<b>Forms</h3></b>
<a name="12441"></a>
<i>anewarray_quick</i> = 222 (0xde)<p>
<a name="anewarray_quick.Stack"></a>
<b>Stack</h3></b>
<a name="12438"></a>
..., <i>count</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>arrayref</i><p>
<a name="anewarray_quick.Description"></a>
<b>Description</h3></b>
<a name="20629"></a>
The <i>count</i> must be of type <code>int</code>. It is popped off the operand stack. The <i>count</i> represents the number of components of the array to be created. The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the constant pool of the current class <a href="Overview.doc.html#17257">(§3.6)</a>, where the value of the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The item at that index in the constant pool must already have been successfully resolved and must be a class or interface type. A new array of that type, of length <i>count</i>, is allocated from the garbage-collected heap, and a <code>reference</code> <i>arrayref</i> to this new array object is pushed onto the operand stack. All components of the new array are initialized to <code>null</code>, the default value for reference types <a href="Concepts.doc.html#15858">(§2.5.1)</a>.<p>
<a name="anewarray_quick.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="12060"></a>
If <i>count</i> is less than zero, the <i>anewarray_quick</i> instruction throws a <code>NegativeArraySizeException</code>.<p>
<a name="anewarray_quick.Notes"></a>
<b>Notes</h3></b>
<a name="5062"></a>
The opcode of this instruction was originally <i>anewarray</i>. The operands of the <i>anewarray</i> instruction are not modified.<p>
<a name="8220"></a>
The<i> anewarray_quick</i> instruction is used to create a single dimension of an array of object references. It can also be used to create the first dimension of a multidimensional array.<p>
<a name="checkcast_quick"></a>
<hr><h2>checkcast_quick</h2>
<a name="checkcast_quick.Operation"></a>
<b>Operation</h3></b>
<a name="5287"></a>
Check whether object is of given type<p><Table Border="1">
<tr><td><a name="5282"></a>
<i>checkcast_quick</i>
<td><a name="397"></a>
<tr><td><a name="5284"></a>
<i>indexbyte1</i>
<td><a name="404"></a>
<tr><td><a name="5286"></a>
<i>indexbyte2</i>
<td><a name="411"></a>
</Table><br><br><p>
<a name="checkcast_quick.Forms"></a>
<b>Forms</h3></b>
<a name="5288"></a>
<i>checkcast_quick</i> = 224 (0xe0)<p>
<a name="checkcast_quick.Stack"></a>
<b>Stack</h3></b>
<a name="12449"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>objectref</i><p>
<a name="checkcast_quick.Description"></a>
<b>Description</h3></b>
<a name="5289"></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 constant pool of the current class <a href="Overview.doc.html#17257">(§3.6)</a>, where the value of the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The object at that index of the constant pool must already have been successfully resolved and must be a class or interface type.<p>
<a name="18707"></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_quick</i> instruction throws a <code>ClassCastException</code>.<p>
<a name="18708"></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_quick</i> determines whether <i>objectref</i> can be cast to type T as follows:<p>
<ul><a name="11836"></a>
<li>If S is an ordinary (non-array) class, then:
<ul>
<a name="11840"></a>
<li>If T is a class type, then S must be the same class <a href="Concepts.doc.html#20389">(§2.8.1)</a> as T, or S must be a subclass of T;
<a name="11844"></a>
<li>If T is an interface type, then S must implement <a href="Concepts.doc.html#16432">(§2.13)</a> interface T.
</ul>
</ul>
<a name="checkcast_quick"></a>
<ul><a name="11845"></a>
<li>If S is a class representing the array type SC<code>[]</code>, that is, an array of components of type SC, then:
<ul>
<a name="11849"></a>
<li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(§2.4.6)</a>.
<a name="11850"></a>
<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:
<ul>
<a name="11854"></a>
<li>TC and SC are the same primitive type <a href="Concepts.doc.html#19511">(§2.4.1)</a>.
<a name="11858"></a>
<li>TC and SC are reference types <a href="Concepts.doc.html#25376">(§2.4.5)</a> and type SC can be cast to TC by these runtime rules.
</ul>
</ul>
</ul><a name="8098"></a>
S cannot be an interface type, because there are no instances of interfaces, only instances of classes and arrays.<p>
<a name="checkcast_quick.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="12063"></a>
If <i>objectref</i><em> </em>cannot be cast to the type of the resolved class, the <i>checkcast_quick</i> instruction throws a <code>ClassCastException</code>.<p>
<a name="checkcast_quick.Notes"></a>
<b>Notes</h3></b>
<a name="5295"></a>
The opcode of this instruction was originally <i>checkcast</i>. The operands of the <i>checkcast</i> instruction are not modified.<p>
<a name="8217"></a>
The <i>checkcast_quick</i> instruction is very similar to the <i>instanceof_quick</i> instruction. It differs in its treatment of <code>null</code>, its behavior when its test fails (<i>checkcast_quick</i> throws an exception, <i>instanceof_quick</i> pushes a result code), and its effect on the operand stack.<p>
<a name="getfield_quick"></a>
<hr><h2>getfield_quick</h2>
<a name="getfield_quick.Operation"></a>
<b>Operation</h3></b>
<a name="5081"></a>
Fetch field from object<p><Table Border="1">
<tr><td><a name="5076"></a>
<i>getfield_quick</i>
<td><a name="222"></a>
<tr><td><a name="5078"></a>
<i>offset</i>
<td><a name="229"></a>
<tr><td><a name="5080"></a>
<i><unused></i>
<td><a name="236"></a>
</Table><br><br><p>
<a name="getfield_quick.Forms"></a>
<b>Forms</h3></b>
<a name="12450"></a>
<i>getfield_quick</i> = 206 (0xce)<p>
<a name="getfield_quick.Stack"></a>
<b>Stack</h3></b>
<a name="5082"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value</i> <p>
<a name="getfield_quick.Description"></a>
<b>Description</h3></b>
<a name="5083"></a>
The <i>objectref</i>, which must be of type <code>reference</code>, is popped from the operand stack. The <i>value</i> of the one-word field at <i>offset</i> into the class instance referenced by <i>objectref</i> is fetched and pushed onto the operand stack.<p>
<a name="getfield_quick.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="12066"></a>
If <i>objectref</i> is <code>null</code>, the <i>getfield_quick</i> instruction throws a <code>NullPointerException</code>.<p>
<a name="getfield_quick.Notes"></a>
<b>Notes</h3></b>
<a name="6425"></a>
The opcode of this instruction was originally <i>getfield</i>, operating on a field determined dynamically to have an offset into the class instance data of 255 words or less and to have a width of one word. <p>
<a name="17428"></a>
When the constant pool entry referenced by a <i>getfield</i> instruction is resolved, the offset for the field it references is generated. That offset replaces the first operand byte of the original <i>getfield</i> instruction. The second operand byte of the <i>getfield</i> is unused by <i>getfield_quick</i>. <p>
<a name="getfield_quick_w"></a>
<hr><h2>getfield_quick_w</h2>
<a name="getfield_quick_w.Operation"></a>
<b>Operation</h3></b>
<a name="6628"></a>
Fetch field from object<p><Table Border="1">
<tr><td><a name="6623"></a>
<i>getfield_quick_w</i>
<td><a name="553"></a>
<tr><td><a name="6625"></a>
<i>indexbyte1</i>
<td><a name="560"></a>
<tr><td><a name="6627"></a>
<i>indexbyte2</i>
<td><a name="567"></a>
</Table><br><br><p>
<a name="getfield_quick_w.Forms"></a>
<b>Forms</h3></b>
<a name="12451"></a>
<i>getfield_quick_w</i> = 227 (0xe3)<p>
<a name="getfield_quick_w.Stack"></a>
<b>Stack</h3></b>
<a name="6629"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value</i> <p>
<a name="17034"></a>
OR<p>
<a name="getfield_quick_w.Stack"></a>
<b>Stack</h3></b>
<a name="14768"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value.word1</i>, <i>value.word2</i><p>
<a name="getfield_quick_w.Description"></a>
<b>Description</h3></b>
<a name="6630"></a>
The <i>objectref</i>, which must be of type <code>reference</code>, is popped from the operand stack. The unsigned <i>indexbyte1</i> and <i>indexbyte2</i> are used to construct an index into the constant pool of the current class <a href="Overview.doc.html#17257">(§3.6)</a>, where the index is (<i>indexbyte1</i> << 8) | <i>indexbyte2</i>. The constant pool item at the index must be a <code>CONSTANT_Fieldref</code> <a href="ClassFile.doc.html#4723">(§4.4.2)</a> which must already have been resolved and must not be a class (<code>static</code>) field. A field offset must have been stored in the constant pool. The <i>value</i> at that offset into the class instance referenced by <i>objectref</i> is fetched and pushed onto the operand stack.<p>
<a name="getfield_quick_w.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="12069"></a>
If <i>objectref</i> is <code>null</code>, the <i>getfield_quick_w</i> instruction throws a <code>NullPointerException</code>.<p>
<a name="getfield_quick_w.Notes"></a>
<b>Notes</h3></b>
<a name="6632"></a>
The opcode of this instruction was originally <i>getfield</i>, operating on a field determined dynamically to have an offset into the class instance data of more than 255 words. <p>
<a name="getfield_quick_w"></a>
<a name="17427"></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -