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

📄 instructions2.doc6.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.doc5.html">Prev</a> | <a href="Instructions2.doc7.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="getfield">
</a><h2>getfield</h2>
<a name="getfield.Operation"></a>
<b>Operation</h3></b>
<a name="68230"></a>
Fetch field from object<p><Table Border="1">
<tr><td><a name="68225"></a>
 <i>getfield</i>
<td><a name="87568"></a>
 

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

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

</Table><br><br><p>
<a name="getfield.Forms"></a>
<b>Forms</h3></b>
<a name="68231"></a>
<i>getfield</i> = 180 (0xb4)<p>
<a name="getfield.Stack"></a>
<b>Stack</h3></b>
<a name="68232"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value</i> <p>
<a name="68233"></a>
OR<p>
<a name="getfield.Stack"></a>
<b>Stack</h3></b>
<a name="68234"></a>
..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value.word1</i>, <i>value.word2</i><p>
<a name="getfield.Description"></a>
<b>Description</h3></b>
<a name="68235"></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">(&#167;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">(&#167;4.4.2)</a>, a reference to a class name and a field name. If the field is <code>protected</code> <a href="ClassFile.doc.html#1513">(&#167;4.6)</a>, then it must be either a member of the current class or a member of a superclass of the current class, and the class of <i>objectref</i> must be either the current class or a subclass of the current class.<p>
<a name="68245"></a>
The item is resolved <a href="ConstantPool.doc.html#49425">(&#167;5.2)</a>, determining both the field width and the field offset. 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.Linking"></a>
<b>Linking Exceptions</h3></b>
<a name="109588"></a>
During resolution of the <code>CONSTANT_Fieldref</code> constant pool item, any of the errors documented in <a href="ConstantPool.doc.html#49425">&#167;5.2</a> can be thrown.<p>
<a name="68247"></a>
Otherwise, if the specified field exists but is a <code>static</code> field, <i>getfield</i> throws an <code>IncompatibleClassChangeError</code>.<p>
<a name="getfield.Runtime"></a>
<b>Runtime Exception</h3></b>
<a name="68249"></a>
Otherwise, if <i>objectref</i><em> </em>is <code>null</code>, the <i>getfield</i> instruction throws a <code>NullPointerException</code>.<p>
<a name="getfield.Notes"></a>
<b>Notes</h3></b>
<a name="68250"></a>
The <i>getfield</i> instruction operates on both one- and two-word wide fields.<p>

<a name="getstatic"></a>
<hr><h2>getstatic</h2>
<a name="getstatic.Operation"></a>
<b>Operation</h3></b>
<a name="68261"></a>
Get <code>static</code> field from class<p><Table Border="1">
<tr><td><a name="68256"></a>
 <i>getstatic</i>
<td><a name="87568"></a>
 

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

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

</Table><br><br><p>
<a name="getstatic.Forms"></a>
<b>Forms</h3></b>
<a name="68262"></a>
<i>getstatic</i> = 178 (0xb2)<p>
<a name="getstatic.Stack"></a>
<b>Stack</h3></b>
<a name="68263"></a>
...,<em> </em><img src="chars/arrwdbrt.gif"> ..., <i>value</i>	<p>
<a name="68264"></a>
OR<p>
<a name="getstatic.Stack"></a>
<b>Stack</h3></b>
<a name="68265"></a>
..., <img src="chars/arrwdbrt.gif"> ..., <i>value.word1</i>, <i>value.word2</i><p>
<a name="getstatic.Description"></a>
<b>Description</h3></b>
<a name="68266"></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 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">(&#167;4.4.2)</a>, a reference to a class name and a field name. If the field is <code>protected</code> <a href="ClassFile.doc.html#1513">(&#167;4.6)</a>, then it must be either a member of the current class or a member of a superclass of the current class.<p>
<a name="68279"></a>
The item is resolved <a href="ConstantPool.doc.html#49425">(&#167;5.2)</a>, determining both the class field and its width. The <i>value</i> of the class field is fetched and pushed onto the operand stack.<p>
<a name="getstatic.Linking"></a>
<b>Linking Exceptions</h3></b>
<a name="113139"></a>
During resolution of the <code>CONSTANT_Fieldref</code> constant pool item, any of the exceptions documented in <a href="ConstantPool.doc.html#49425">&#167;5.2</a> can be thrown.<p>
<a name="110052"></a>
Otherwise, if the specified field exists but is not a <code>static</code> (class) field, <i>getstatic</i> throws an <code>IncompatibleClassChangeError</code>.<p>
<a name="getstatic.Notes"></a>
<b>Notes</h3></b>
<a name="68282"></a>
The <i>getstatic</i> instruction operates on both one- and two-word wide fields. <p>

<a name="goto"></a>
<hr><h2>goto</h2>
<a name="goto.Operation"></a>
<b>Operation</h3></b>
<a name="68293"></a>
Branch <p><Table Border="1">
<tr><td><a name="68288"></a>
 <i>goto</i>
<td><a name="87568"></a>
 

<tr><td><a name="68290"></a>
 <i>branchbyte1</i>
<td><a name="87568"></a>
 

<tr><td><a name="68292"></a>
 <i>branchbyte2</i>
<td><a name="87568"></a>
 

</Table><br><br>always<p>
<a name="goto.Forms"></a>
<b>Forms</h3></b>
<a name="68294"></a>
<i>goto</i> = 167 (0xa7)<p>
<a name="goto.Stack"></a>
<b>Stack</h3></b>
<a name="68295"></a>
No change<p>
<a name="goto.Description"></a>
<b>Description</h3></b>
<a name="68296"></a>
The unsigned bytes <i>branchbyte1</i> and <i>branchbyte2</i> are used to construct a signed 16-bit <i>branchoffset</i>, where <i>branchoffset</i> is (<i>branchbyte1</i> << 8) | <i>branchbyte2</i>. Execution proceeds at that offset from the address of the opcode of this <i>goto</i> instruction. The target address must be that of an opcode of an instruction within the method that contains this <i>goto</i> instruction.<p>

<a name="goto_w"></a>
<hr><h2>goto_w</h2>
<a name="goto_w.Operation"></a>
<b>Operation</h3></b>
<a name="68311"></a>
Branch always (wide index)<p><Table Border="1">
<tr><td><a name="68302"></a>
 <i>goto_w</i>
<td><a name="87568"></a>
 

<tr><td><a name="68304"></a>
 <i>branchbyte1</i>
<td><a name="87568"></a>
 

<tr><td><a name="68306"></a>
 <i>branchbyte2</i>
<td><a name="87568"></a>
 

<tr><td><a name="68308"></a>
 <i>branchbyte3</i>
<td><a name="87568"></a>
 

<tr><td><a name="68310"></a>
 <i>branchbyte4</i>
<td><a name="87568"></a>
 

</Table><br><br><p>
<a name="goto_w.Forms"></a>
<b>Forms</h3></b>
<a name="68312"></a>
<i>goto_w</i> = 200 (0xc8)<p>
<a name="goto_w.Stack"></a>
<b>Stack</h3></b>
<a name="68313"></a>
No change<p>
<a name="goto_w.Description"></a>
<b>Description</h3></b>
<a name="68314"></a>
The unsigned bytes <i>branchbyte1</i>, <i>branchbyte2</i>, <i>branchbyte3</i>, and <i>branchbyte4</i> are used to construct a signed 32-bit <i>branchoffset</i>, where <i>branchoffset</i> is (<i>branchbyte1</i> << 24) | (<i>branchbyte2</i> << 16) | (<i>branchbyte3</i> << 8) | <i>branchbyte4</i>. Execution proceeds at that offset from the address of the opcode of this <i>goto_w</i> instruction. The target address must be that of an opcode of an instruction within the method that contains this <i>goto_w</i> instruction.<p>
<a name="goto_w.Notes"></a>
<b>Notes</h3></b>
<a name="68315"></a>
Although the <i>goto_w</i> instruction has a 4-byte branch offset, other factors limit the size of a Java method to 65535 bytes <a href="ClassFile.doc.html#6253">(&#167;4.10)</a>. This limit may be raised in a future release of the Java Virtual Machine.<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc5.html">Prev</a> | <a href="Instructions2.doc7.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 + -