亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? compiling.doc.html

?? java虛擬機文檔資料
?? HTML
?? 第 1 頁 / 共 5 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head><title>VM Spec  Compiling for the  Java Virtual Machine</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.doc.html">Prev</a> | <a href="Threads.doc.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 name="2839"></a><p><strong>CHAPTER 7 </strong></p><a name="2989"></a><h1>Compiling for the  Java Virtual Machine</h1><hr><p><a name="6043"></a><p>The Java virtual machine is designed to support the Java programming language. Sun's JDK releases and Java 2 SDK contain both a compiler from source code writtenin the Java programming language to the instruction set of the Java virtual machine, and a runtime system that implements the Java virtual machine itself. Understanding how one compiler utilizes the Java virtual machine is useful to the prospective compiler writer, as well as to one trying to understand the Java virtual machine itself.<p><a name="4054"></a>Although this chapter concentrates on compiling source code written in the Java programming language, the Java virtual machine does not assume that the instructions it executes were generated from such code. While there have been a number of efforts aimed at compiling other languages to the Java virtual machine, the current version of the Java virtual machine was not designed to support a wide range of languages. Some languages may be hosted fairly directly by the Java virtual machine. Other languages may be implemented only inefficiently. <p><a name="15152"></a>Note that the term "compiler" is sometimes used when referring to a translator from the instruction set of a Java virtual machine to the instruction set of a specific CPU. One example of such a translator is a just-in-time (JIT) code generator, which generates platform-specific instructions only after Java virtual machine code has been loaded. This chapter does not address issues associated with code generation, only those associated with compiling source code written in the Java programming language to Java virtual machine instructions.<p><a name="4083"></a><hr><h2>7.1    Format of Examples</h2>This chapter consists mainly of examples of source code together with annotated listings of the Java virtual machine code that the <code>javac</code> compiler in Sun's JDK release 1.0.2 generates for the examples. The Java virtual machine code is written in the informal "virtual machine assembly language" output by Sun's <code>javap</code> utility, distributed with the JDK software and the Java 2 SDK. You can use <code>javap</code> to generateadditional examples of compiled methods.<p><a name="15144"></a>The format of the examples should be familiar to anyone who has read assembly code. Each instruction takes the form<p><blockquote><pre>&lt;index&gt; &lt;opcode&gt; [&lt;operand1&gt; [&lt;operand2&gt;...]] [&lt;comment&gt;]</pre></blockquote>The &lt;index&gt; is the index of the opcode of the instruction in the array that contains the bytes of Java virtual machine code for this method. Alternatively, the &lt;index&gt; may be thought of as a byte offset from the beginning of the method. The &lt;opcode&gt; is the mnemonic for the instruction's opcode, and the zero or more &lt;operandN&gt; are the operands of the instruction. The optional &lt;comment&gt; is given in end-of-line comment syntax:<p><blockquote><pre>8 	bipush 100		// Push <code>int</code> constant <code>100</code></pre></blockquote>Some of the material in the comments is emitted by <code>javap</code>; the rest is supplied by the authors. The &lt;index&gt; prefacing each instruction may be used as the target of a control transfer instruction. For instance, a goto 8 instruction transfers control to the instruction at index 8. Note that the actual operands of Java virtual machine control transfer instructions are offsets from the addresses of the opcodes of those instructions;these operands are displayed by <code>javap</code> (and are shown in this chapter) as more easily read offsets into their methods.<p><a name="8695"></a>We preface an operand representing a runtime constant pool index with a hash sign and follow the instruction by a comment identifying the runtime constant pool item referenced, as in<p><blockquote><pre>  10   ldc #1 			// Push <code>float</code> constant <code>100.0</code>	</pre></blockquote>or<p><blockquote><pre>   9   invokevirtual #4		// Method <code>Example.addTwo(II)I</code></pre></blockquote>For the purposes of this chapter, we do not worry about specifying details such as operand sizes.<p><a name="4182"></a><hr><h2>7.2    Use of Constants, Local Variables, and Control Constructs</h2>Java virtual machine code exhibits a set of general characteristics imposed by the Java virtual machine's design and use of types. In the first example we encounter many of these, and we consider them in some detail.<p><a name="4154"></a>The <code>spin</code> method simply spins around an empty <code>for</code> loop 100 times:<p><blockquote><pre><code>void spin() {</code><code>    int i;</code><code>    for (i = 0; i &lt; 100; i++) {</code><code>     	;			// Loop body is empty</code><code>    }</code><code>}</code></pre></blockquote><a name="4112"></a>A compiler might compile <code>spin</code> to<p><blockquote><pre>Method <code>void</code> <code>spin()</code>   0	iconst_0		// Push <code>int</code> constant <code>0</code>   1 	istore_1		// Store into local variable 1 (<code>i</code>=<code>0</code>)   2	goto 8			// First time through don't increment   5	iinc 1 1		// Increment local variable 1 by 1 (<code>i++</code>)   8	iload_1			// Push local variable 1 (<code>i</code>)   9	bipush 100		// Push <code>int</code> constant <code>100</code>  11	if_icmplt 5		// Compare and loop if less than (<code>i</code> < <code>100</code>)  14	return			// Return <code>void</code> when done</pre></blockquote><a name="10105"></a>The Java virtual machine is stack-oriented, with most operations taking one or more operands from the operand stack of the Java virtual machine's current frame or pushing results back onto the operand stack. A new frame is created each time a method is invoked, and with it is created a new operand stack and set of local variables for use by that method (see <a href="Overview.doc.html#17257">Section 3.6, "Frames"</a>). At any one point of the computation, there are thus likely to be many frames and equally many operand stacks per thread of control, corresponding to many nested method invocations. Only the operand stack in the current frame is active. <p><a name="4169"></a>The instruction set of the Java virtual machine distinguishes operand types by using distinct bytecodes for operations on its various data types. The method <code>spin</code> operates only on values of type <code>int</code>. The instructions in its compiled code chosen to operate on typed data (iconst_0, istore_1, iinc, iload_1, if_icmplt) are all specialized for type <code>int</code>.<p><a name="4172"></a>The two constants in <code>spin</code>, <code>0</code> and <code>100</code>, are pushed onto the operand stack using two different instructions. The <code>0</code> is pushed using an iconst_0 instruction, one of the family of iconst_&lt;i&gt; instructions. The <code>100</code> is pushed using a bipush instruction, which fetches the value it pushes as an immediate operand.<p><a name="14767"></a>The Java virtual machine frequently takes advantage of the likelihood of certain operands (<code>int</code> constants -1, 0, 1, 2, 3, 4 and 5 in the case of the iconst_&lt;i&gt; instructions) by making those operands implicit in the opcode. Because the iconst_0 instruction knows it is going to push an <code>int</code> <code>0</code>, iconst_0 does not need to store an operand to tell it what value to push, nor does it need to fetch or decode an operand. Compiling the push of <code>0</code> as bipush 0 would have been correct, but would have made the compiled code for <code>spin</code> one byte longer. A simple virtual machine would have also spent additional time fetching and decoding the explicit operand each time around the loop. Use of implicit operands makes compiled code more compact and efficient. <p><a name="15090"></a>The <code>int</code> <code>i</code> in <code>spin</code> is stored as Java virtual machine local variable 1. Because most Java virtual machine instructions operate on values popped from the operand stack rather than directly on local variables, instructions that transfer values between local variables and the operand stack are common in code compiled for the Java virtual machine. These operations also have special support in the instruction set. In <code>spin</code>, values are transferred to and from local variables using the istore_1 and iload_1 instructions, each of which implicitly operates on local variable 1. The istore_1 instruction pops an <code>int</code> from the operand stack and stores it in local variable 1. The iload_1 instruction pushes the value in local variable 1 onto the operand stack.<p><a name="4941"></a>The use (and reuse) of local variables is the responsibility of the compiler writer. The specialized load and store instructions should encourage the compiler writer to reuse local variables as much as is feasible. The resulting code is faster, more compact, and uses less space in the frame.<p><a name="15074"></a>Certain very frequent operations on local variables are catered to specially by the Java virtual machine. The iinc instruction increments the contents of a local variable by a one-byte signed value. The iinc instruction in <code>spin</code> increments the first local variable (its first operand) by 1 (its second operand). The iinc instruction is very handy when implementing looping constructs. <p><a name="12225"></a>The <code>for</code> loop of <code>spin</code> is accomplished mainly by these instructions:<p><blockquote><pre>   5	iinc 1 1		// Increment local 1 by 1 (<code>i++</code>)   8	iload_1			// Push local variable 1 (<code>i</code>)   9	bipush 100		// Push <code>int</code> constant <code>100</code>  11	if_icmplt 5		// Compare and loop if less than (<code>i</code> < <code>100</code>)</pre></blockquote>The bipush instruction pushes the value 100 onto the operand stack as an <code>int</code>, then the if_icmplt instruction pops that value off the operand stack and compares it against i. If the comparison succeeds (the variable <code>i</code> is less than <code>100</code>), control is transferred to index 5 and the next iteration of the <code>for</code> loop begins. Otherwise, controlpasses to the instruction following the if_icmplt.<p><a name="4229"></a>If the <code>spin</code> example had used a data type other than <code>int</code> for the loop counter, the compiled code would necessarily change to reflect the different data type. For instance, if instead of an <code>int</code> the <code>spin</code> example uses a <code>double</code>, as shown,<p><blockquote><pre><code>void dspin() {</code><code>    double i;</code><code>    for (i = 0.0; i &lt; 100.0; i++) {</code><code>        ;			// Loop body is empty</code><code>    }</code><code>}</code></pre></blockquote>the compiled code is<p><blockquote><pre>Method <code>void</code> d<code>spin()</code>   0 	dconst_0		// Push <code>double</code> constant <code>0.0</code>   1 	dstore_1		// Store into local variables 1 and 2   2 	goto 9			// First time through don't increment   5 	dload_1			// Push local variables 1 and 2    6 	dconst_1		// Push <code>double</code> constant <code>1.0</code>    7 	dadd			// Add; there is no dinc instruction   8 	dstore_1		// Store result in local variables 1 and 2   9 	dload_1			// Push local variables 1 and 2   10 	ldc2_w #4 		// Push <code>double</code> constant <code>100.0</code>   13 	dcmpg			// There is no if_dcmplt instruction  14 	iflt 5			// Compare and loop if less than (<code>i</code> < <code>100.0</code>)  17 	return			// Return <code>void</code> when done</pre></blockquote>The instructions that operate on typed data are now specialized for type <code>double</code>. (The ldc2_w instruction will be discussed later in this chapter.)<p><a name="10228"></a>Recall that <code>double</code> values occupy two local variables, although they are only accessed using the lesser index of the two local variables. This is also the case for values of type <code>long</code>. Again for example,<p><blockquote><pre><code>double doubleLocals(double d1, double d2) {</code><code>    return d1 + d2;</code><code>}</code></pre></blockquote>becomes<p><blockquote><pre>Method <code>double</code> <code>doubleLocals(double,double)</code>   0 	dload_1			// First argument in local variables 1 and 2   1 	dload_3			// Second argument in local variables 3 and 4   2 	dadd			   3 	dreturn</pre></blockquote><a name="16197"></a>Note that local variables of the local variable pairs used to store <code>double</code> values in <code>doubleLocals</code> must never be manipulated individually.<p><a name="16186"></a>The Java virtual machine's opcode size of 1 byte results in its compiled code being very compact. However, 1-byte opcodes also mean that the Java virtual machine instruction set must stay small. As a compromise, the Java virtual machine does not provide equal support for all data types: it is not completely orthogonal (see <a href="Overview.doc.html#37356">Table 3.2, "Type support in the Java virtual machine instruction set"</a>). <p><a name="17566"></a>For example, the comparison of values of type <code>int</code> in the <code>for</code> statement of example <code>spin</code> can be implemented using a single if_icmplt instruction; however, there is no single instruction in the Java virtual machine instruction set that performs a conditional branch on values of type <code>double</code>. Thus, <code>dspin</code> must implement its comparison of values of type <code>double</code> using a dcmpg instruction followed by an iflt instruction.<p><a name="4595"></a>The Java virtual machine provides the most direct support for data of type <code>int</code>. This is partly in anticipation of efficient implementations of the Java virtual machine's operand stacks and local variable arrays. It is also motivated by the frequency of <code>int</code> data in typical programs. Other integral types have less direct support. There are no <code>byte</code>, <code>char</code>, or <code>short</code> versions of the store, load, or add instructions, for instance. Here is the <code>spin</code> example written using a <code>short</code>:<p><blockquote><pre><code>void sspin() {</code><code>    short i;</code><code>    for (i = 0; i &lt; 100; i++) {</code><code>        ;			// Loop body is empty</code><code>    }</code><code>}</code></pre></blockquote>It must be compiled for the Java virtual machine, as follows, using instructions operating on another type, most likely <code>int</code>, converting between <code>short</code> and <code>int</code> values as necessary to ensure that the results of operations on <code>short</code> data stay within the appropriate range:<p><blockquote><pre>Method <code>void</code> <code>sspin()</code>   0 	iconst_0   1 	istore_1   2 	goto 10   5 	iload_1			// The <code>short</code> is treated as though an <code>int</code>   6 	iconst_1   7	iadd   8 	i2s		 	// Truncate <code>int</code> to <code>short</code>   9 	istore_1  10 	iload_1  11 	bipush 100  13 	if_icmplt 5  16 	return</pre></blockquote>The lack of direct support for <code>byte</code>, <code>char</code>, and <code>short</code> types in the Java virtual machine is not particularly painful, because values of those types are internally promotedto <code>int</code> (<code>byte</code> and <code>short</code> are sign-extended to <code>int</code>, <code>char</code> is zero-extended). Operations on <code>byte</code>, <code>char</code>, and <code>short</code> data can thus be done using <code>int</code> instructions. The only additional cost is that of truncating the values of <code>int</code> operations to valid ranges. <p><a name="5831"></a>The <code>long</code> and floating-point types have an intermediate level of support in the Java virtual machine, lacking only the full complement of conditional control transfer instructions. <p><a name="4228"></a><hr><h2>7.3    Arithmetic</h2>The Java virtual machine generally does arithmetic on its operand stack. (The exception is the iinc instruction, which directly increments the value of a local variable.) For instance, the <code>align2grain</code> method aligns an <code>int</code> value to a given power 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免播放器亚洲一区| 久久久久久99久久久精品网站| 国产精品亲子伦对白| 国产一区高清在线| 久久综合久色欧美综合狠狠| 国产制服丝袜一区| 国产欧美日产一区| 成人免费观看视频| 亚洲人成在线观看一区二区| 91久久奴性调教| 首页综合国产亚洲丝袜| 日韩一区二区三区四区| 久久99国产精品久久99| 亚洲国产精品传媒在线观看| 99热在这里有精品免费| 亚洲国产wwwccc36天堂| 日韩一级片在线播放| 国产乱子伦一区二区三区国色天香| 国产色婷婷亚洲99精品小说| 99r精品视频| 婷婷开心久久网| 久久综合色天天久久综合图片| 成人涩涩免费视频| 天堂成人免费av电影一区| 精品国一区二区三区| 成人av网站免费| 日日夜夜精品视频免费| 久久久久99精品国产片| 在线视频中文字幕一区二区| 久久精品二区亚洲w码| 国产精品夫妻自拍| 欧美一区二区久久| 制服视频三区第一页精品| 狠狠狠色丁香婷婷综合激情| 成人免费在线视频观看| 91精品国产乱码| 成人av在线电影| 奇米影视7777精品一区二区| 中文幕一区二区三区久久蜜桃| 欧美午夜电影在线播放| 国产精品1区二区.| 热久久一区二区| 亚洲欧美另类在线| 久久久亚洲精品一区二区三区 | 亚洲国产成人午夜在线一区| 91视频免费看| 另类综合日韩欧美亚洲| 亚洲你懂的在线视频| 久久婷婷国产综合精品青草| 欧美伦理电影网| a美女胸又www黄视频久久| 韩国女主播一区| 婷婷国产v国产偷v亚洲高清| 中文字幕一区二区三区在线不卡| 欧美成人三级电影在线| 欧美日韩精品欧美日韩精品一| 成人免费高清视频| 国产综合久久久久久鬼色| 日韩成人一区二区| 亚洲成av人综合在线观看| 中文字幕在线不卡国产视频| 国产日韩影视精品| 精品国内片67194| 日韩网站在线看片你懂的| 欧美亚一区二区| 一本一本大道香蕉久在线精品 | 国产三级一区二区| 欧美mv日韩mv国产网站app| 欧美日韩国产精品自在自线| 欧美性受xxxx| 色先锋久久av资源部| 99国产精品视频免费观看| 国产v综合v亚洲欧| 国产成人av电影在线观看| 国产在线麻豆精品观看| 狠狠色丁香婷综合久久| 国产在线精品国自产拍免费| 激情成人午夜视频| 国产一区二区在线影院| 国产精品资源在线看| 国产一二精品视频| 国产激情视频一区二区在线观看 | 亚洲精品福利视频网站| 中文字幕一区二区三区色视频| 欧美激情一区二区三区蜜桃视频| 久久丝袜美腿综合| 国产日韩在线不卡| 成人欧美一区二区三区| 亚洲精品一二三| 亚洲国产精品一区二区www| 亚洲国产wwwccc36天堂| 奇米色777欧美一区二区| 蜜臀av一区二区在线免费观看| 久久99久久精品| 国产·精品毛片| 99re热视频这里只精品| 欧美亚洲精品一区| 日韩欧美中文字幕制服| 久久影视一区二区| 国产欧美日韩激情| 亚洲欧美色综合| 亚洲bt欧美bt精品| 久久99精品久久久| 成年人网站91| 欧美日韩精品一区二区三区| 日韩欧美一级二级三级久久久| 久久香蕉国产线看观看99| 欧美国产欧美亚州国产日韩mv天天看完整| 国产精品天美传媒沈樵| 一区二区成人在线| 久久99精品国产麻豆婷婷| 成人av免费网站| 欧美久久久久久久久久| 国产亚洲综合av| 亚洲综合在线视频| 精品一区二区三区免费播放| 99久精品国产| 日韩欧美国产一区二区三区 | 欧美欧美午夜aⅴ在线观看| 欧美mv日韩mv国产| 一区二区三区日韩| 国产综合成人久久大片91| 色噜噜狠狠成人中文综合| 日韩女优制服丝袜电影| 尤物av一区二区| 国产精品白丝jk白祙喷水网站| 在线视频欧美区| 久久美女艺术照精彩视频福利播放| 亚洲欧美国产三级| 国产麻豆精品theporn| 欧洲生活片亚洲生活在线观看| 精品国产一区二区三区久久影院| 亚洲人亚洲人成电影网站色| 韩国女主播成人在线| 91久久久免费一区二区| 国产日韩欧美精品在线| 奇米四色…亚洲| 在线精品国精品国产尤物884a| 国产肉丝袜一区二区| 青青草97国产精品免费观看| 91成人国产精品| 国产精品欧美一区喷水| 精品在线一区二区| 欧美卡1卡2卡| 一区二区三区在线视频免费观看| 国产精品系列在线观看| 欧美一区二区私人影院日本| 一区二区三区四区激情| 99久久精品久久久久久清纯| 久久久精品国产免费观看同学| 日本大胆欧美人术艺术动态| 91丝袜美腿高跟国产极品老师 | 91视视频在线观看入口直接观看www | 亚洲成国产人片在线观看| www.久久久久久久久| 国产偷国产偷亚洲高清人白洁 | 久久久久久久久免费| 免费在线观看视频一区| 欧美日本一区二区三区四区| 亚洲制服丝袜一区| 色成人在线视频| 日韩一区欧美一区| 91视频www| 最新热久久免费视频| 成人av电影在线| 国产精品欧美一级免费| 成人免费毛片app| 国产精品青草综合久久久久99| 国产激情精品久久久第一区二区 | 亚洲一区二区在线观看视频| 成人h动漫精品一区二区| 中文字幕的久久| 成人妖精视频yjsp地址| 中文字幕第一区二区| 99久久精品国产毛片| 中文字幕在线观看不卡| 91小视频在线免费看| 一区二区三区在线播放| 欧美视频一区在线| 午夜精品久久久久久久久久久| 欧美日韩一区二区不卡| 午夜精品久久久久久久99樱桃 | 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美丰满少妇xxxbbb| 免费视频最近日韩| 精品国产一区二区三区久久久蜜月| 在线观看免费视频综合| 亚洲一二三四久久| 91精品国产综合久久久蜜臀图片| 日韩国产欧美在线播放| 精品国产在天天线2019| 国产成人综合在线| 亚洲欧洲综合另类| 69av一区二区三区| 黄色精品一二区| 最新欧美精品一区二区三区| 欧美日韩一级视频| 韩国理伦片一区二区三区在线播放| 欧美经典一区二区| 欧美午夜精品一区二区三区|