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

📄 instructions2.doc14.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.doc13.html">Prev</a> | <a href="Instructions2.doc15.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="tableswitch">
</a><h2>tableswitch</h2>
<a name="tableswitch.Operation"></a>
<b>Operation</h3></b>
<a name="70136"></a>
Access jump table by index and jump<p><Table Border="1">
<tr><td><a name="70107"></a>
 <i>tableswitch</i>
<td><a name="87535"></a>
 

<tr><td><a name="70109"></a>
 <0-3 byte pad>
<td><a name="87537"></a>
 

<tr><td><a name="70111"></a>
 <i>defaultbyte1</i>
<td><a name="87539"></a>
 

<tr><td><a name="70113"></a>
 <i>defaultbyte2</i>
<td><a name="87541"></a>
 

<tr><td><a name="70115"></a>
 <i>defaultbyte3</i>
<td><a name="87543"></a>
 

<tr><td><a name="70117"></a>
 <i>defaultbyte4</i>
<td><a name="87545"></a>
 

<tr><td><a name="70119"></a>
 <i>lowbyte1</i>
<td><a name="87547"></a>
 

<tr><td><a name="70121"></a>
 <i>lowbyte2</i>
<td><a name="87549"></a>
 

<tr><td><a name="70123"></a>
 <i>lowbyte3</i>
<td><a name="87551"></a>
 

<tr><td><a name="70125"></a>
 <i>lowbyte4</i>
<td><a name="87553"></a>
 

<tr><td><a name="70127"></a>
 <i>highbyte1</i>
<td><a name="87555"></a>
 

<tr><td><a name="70129"></a>
 <i>highbyte2</i>
<td><a name="87557"></a>
 

<tr><td><a name="70131"></a>
 <i>highbyte3</i>
<td><a name="87559"></a>
 

<tr><td><a name="70133"></a>
 <i>highbyte4</i>
<td><a name="87561"></a>
 

<tr><td><a name="70135"></a>
 <i>jump offsets</i>...
<td><a name="87563"></a>
 

</Table><br><br><p>
<a name="tableswitch.Forms"></a>
<b>Forms</h3></b>
<a name="70137"></a>
<i>tableswitch</i> = 170 (0xaa)<p>
<a name="tableswitch.Stack"></a>
<b>Stack</h3></b>
<a name="70138"></a>
..., <i>index</i><em> </em><img src="chars/arrwdbrt.gif"> ...<p>
<a name="tableswitch.Description"></a>
<b>Description</h3></b>
<a name="159620"></a>
A <i>tableswitch</i> is a variable-length instruction. Immediately after the <i>tableswitch</i> opcode, between zero and three null bytes (zeroed bytes, not the null object) are inserted as padding. The number of null bytes is chosen so that the following byte 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 the bytes constituting a series of signed 32-bit values: <i>default</i>, <i>low</i>, <i>high</i>, and then <i>high </i>- <i>low </i>+ 1 further signed 32-bit offsets. The value <i>low</i> must be less than or equal to <i>high</i>. The <i>high </i>- <i>low </i>+ 1 signed 32-bit offsets are treated as a 0-based jump table. Each of these signed 32-bit values is constructed as (<i>byte1</i> << 24) | (<i>byte2</i> << 16) | (<i>byte3</i> << 8) | <i>byte4</i>.<p>
<a name="70140"></a>
The <i>index</i> must be of type <code>int</code> and is popped from the operand stack. If <i>index</i> is less than <i>low</i> or <i>index</i> is greater than <i>high</i>, then a target address is calculated by adding <i>default</i> to the address of the opcode of this <i>tableswitch</i> instruction. Otherwise, the offset at position <i>index </i>- <i>low</i> of the jump table is extracted. The target address is calculated by adding that offset to the address of the opcode of this <i>tableswitch</i> instruction. Execution then continues at the target address.<p>
<a name="70141"></a>
The target address which can be calculated from each jump table offset, as well as the ones that can be calculated from <i>default</i>, must be the address of an opcode of an instruction within the method that contains this <i>tableswitch</i> instruction.<p>
<a name="tableswitch.Notes"></a>
<b>Notes</h3></b>
<a name="70142"></a>
The alignment required of the 4-byte operands of the <i>tableswitch</i> instruction guarantees 4-byte alignment of those operands if and only if the method that contains the <i>tableswitch</i> starts on a 4-byte boundary.<p>


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