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

📄 instructions2.doc10.html

📁 Jvm 规范说明。The Java Virtual Machine was designed to support the Java programming language. Some concep
💻 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.doc9.html">Prev</a> | <a href="Instructions2.doc11.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="new">
</a><h2>new</h2>
<a name="new.Operation"></a>
<b>Operation</h3></b>
<a name="69784"></a>
Create new object<p><Table Border="1">
<tr><td><a name="69779"></a>
 <i>new</i>
<td><a name="87568"></a>
 

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

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

</Table><br><br><p>
<a name="new.Forms"></a>
<b>Forms</h3></b>
<a name="69785"></a>
<i>new</i> = 187 (0xbb)<p>
<a name="new.Stack"></a>
<b>Stack</h3></b>
<a name="69786"></a>
... <img src="chars/arrwdbrt.gif"> ..., <i>objectref</i><p>
<a name="new.Description"></a>
<b>Description</h3></b>
<a name="69787"></a>
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">(&#167;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 be a <code>CONSTANT_Class</code> <a href="ClassFile.doc.html#1221">(&#167;4.4.1)</a>. The symbolic reference is resolved <a href="ConstantPool.doc.html#51579">(&#167;5.1)</a> and must result in a class type (it must not result in an array or interface 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 href="Concepts.doc.html#15858">&#167;2.5.1</a>). The <i>objectref</i>, a <code>reference</code> to <em>the instance, </em>is pushed onto the operand stack.<p>
<a name="new.Linking"></a>
<b>Linking Exceptions</h3></b>
<a name="119223"></a>
During resolution of the <code>CONSTANT_Class</code> constant pool item, any of the exceptions documented in <a href="ConstantPool.doc.html#51579">&#167;5.1</a> can be thrown.<p>
<a name="69801"></a>
Otherwise, if the <code>CONSTANT_Class</code> constant pool item re-solves to an interface or is an <code>abstract</code> class, <i>new</i> throws an <code>InstantiationError</code>. <p>
Otherwise, if the current class does not have permission to access the resolved class <a href="Concepts.doc.html#18914">(&#167;2.7.8)</a>, <i>new</i> throws an <code>IllegalAccessError</code>.<p>
<a name="new.Note"></a>
<b>Note</h3></b>
<a name="100990"></a>
The <i>new</i> instruction does not completely create a new instance; instance creation is not completed until an instance initialization method has been invoked on the uninitialized instance.<p>

<a name="newarray"></a>
<hr><h2>newarray</h2>
<a name="newarray.Operation"></a>
<b>Operation</h3></b>
<a name="69816"></a>
Create new array<p><Table Border="1">
<tr><td><a name="69813"></a>
 <i>newarray</i>
<td><a name="87568"></a>
 

<tr><td><a name="69815"></a>
 <i>atype</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="newarray.Forms"></a>
<b>Forms</h3></b>
<a name="69817"></a>
<i>newarray</i> = 188 (0xbc)<p>
<a name="newarray.Stack"></a>
<b>Stack</h3></b>
<a name="69818"></a>
..., <i>count</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>arrayref</i><p>
<a name="newarray.Description"></a>
<b>Description</h3></b>
<a name="69819"></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 elements in the array to be created. <p>
<a name="69820"></a>
The <i>atype</i> is a code that indicates the type of array to create. It must take one of the following values:<p><Table Border="1">
<tr><td><b><i>Array Type
</i></b>
<td><a name="69825"></a>
<i>atype</i>

<tr><td><b><i><code>T_BOOLEAN
</code></i></b>
<td><a name="69829"></a>
<code>4</code>

<tr><td><b><i><code>T_CHAR
</code></i></b>
<td><a name="69833"></a>
<code>5</code>

<tr><td><b><i><code>T_FLOAT
</code></i></b>
<td><a name="69837"></a>
<code>6</code>

<tr><td><b><i><code>T_DOUBLE
</code></i></b>
<td><a name="69841"></a>
<code>7</code>

<tr><td><b><i><code>T_BYTE
</code></i></b>
<td><a name="69845"></a>
<code>8</code>

<tr><td><b><i><code>T_SHORT
</code></i></b>
<td><a name="69849"></a>
<code>9</code>

<tr><td><b><i><code>T_INT
</code></i></b>
<td><a name="69853"></a>
<code>10</code>

<tr><td><b><i><code>T_LONG
</code></i></b>
<td><a name="69857"></a>
<code>11</code>

</Table><br><br><p>
<a name="69858"></a>
A new array whose components are of type <i>atype</i>, of length <i>count</i>, is allocated from the garbage-collected heap. A <code>reference</code> <i>arrayref</i> to this new array object is pushed into the operand stack. All of the elements of the new array are initialized to the default initial values for its type (<a href="Concepts.doc.html#15858">&#167;2.5.1</a>).<p>
<b>Runtime Exception</h3></b>
<a name="69863"></a>
If <i>count</i><em> </em>is less than zero, <i>newarray</i> throws a <code>NegativeArraySizeException</code>. <p>
<a name="newarray.Notes"></a>
<b>Notes</h3></b>
<a name="69865"></a>
In Sun's implementation of the Java Virtual Machine, arrays of type <code>boolean</code> (<i>atype</i> is <code>T_BOOLEAN</code>) are stored as arrays of 8-bit values and are manipulated using the <i>baload</i> and <i>bastore</i> instructions, instructions that also access arrays of type <code>byte</code>. Other implementations may implement packed <code>boolean</code> arrays; the <i>baload</i> and <i>bastore</i> instructions must still be used to access those arrays.<p>

<a name="nop"></a>
<hr><h2>nop</h2>
<a name="nop.Operation"></a>
<b>Operation</h3></b>
<a name="69872"></a>
Do nothing<p><Table Border="1">
<tr><td><a name="69871"></a>
 <i>nop</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="nop.Forms"></a>
<b>Forms</h3></b>
<a name="69873"></a>
<i>nop</i> = 0 (0x0)<p>
<a name="nop.Stack"></a>
<b>Stack</h3></b>
<a name="69874"></a>
No change<p>
<a name="nop.Description"></a>
<b>Description</h3></b>
<a name="69875"></a>
Do nothing.<p>
<a name="69876"></a>
<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc9.html">Prev</a> | <a href="Instructions2.doc11.html">Next</a> | <a href="Lindholm.INDEX.html">Index</a>
<p>
<font size = -1>Java Virtual Machine Specification <br>
<!--(HTML generated by dkramer on March 31, 1997)-->
<!--
(HTML generated by dkramer on March 25, 1997)-->
<br>
<i><a href="Copyright.doc.html">Copyright &#169 1996, 1997 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 + -