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

📄 appa.htm

📁 JAVA Developing Professional JavaApplets
💻 HTM
📖 第 1 页 / 共 5 页
字号:
ifle=158 branch1 branch2&nbsp;&nbsp;&nbsp;Stack: ..., INT -&gt;...</TT></BLOCKQUOTE><H5>Comparison with Null</H5><BLOCKQUOTE><TT>ifnull=198 branch1 branch2&nbsp;&nbsp;&nbsp;&nbsp;Stack:..., OBJ -&gt; ...<BR>ifnonnull=199 branch1 branch2 Stack: ..., OBJ -&gt; ...</TT></BLOCKQUOTE><H5>Compare Two Integers</H5><BLOCKQUOTE><TT>if_icmpeq=159 branch1 branch2&nbsp;&nbsp;Stack:..., INT1, INT2 -&gt; ...<BR>if_icmpne=160 branch1 branch2&nbsp;&nbsp;Stack: ..., INT1, INT2-&gt; ...<BR>if_icmplt=161 branch1 branch2&nbsp;&nbsp;Stack: ..., INT1, INT2-&gt; ...<BR>if_icmpge=162 branch1 branch2&nbsp;&nbsp;Stack: ..., INT1, INT2-&gt; ...<BR>if_icmpgt=163 branch1 branch2&nbsp;&nbsp;Stack: ..., INT1, INT2-&gt; ...<BR>if_icmple=164 branch1 branch2&nbsp;&nbsp;Stack: ..., INT1, INT2-&gt; ...</TT></BLOCKQUOTE><H5>Compare Two Long Integers</H5><BLOCKQUOTE><TT>lcmp=148  Stack: ..., L1_1, L1_2, L2_1,L2_2 -&gt; ..., INT (One of [-1, 0, 1])</TT></BLOCKQUOTE><H5>Compare Two Floats </H5><P>l-&gt;-1 on NaN, g-&gt;1 on NaN.<BLOCKQUOTE><TT>fcmpl=149&nbsp;&nbsp;Stack: ..., FLOAT1,FLOAT2 -&gt; ..., INT (One of [-1, 0, 1])<BR>fcmpg=150&nbsp;&nbsp;Stack: ..., FLOAT1, FLOAT2 -&gt; ..., INT(One of [-1, 0, 1])</TT></BLOCKQUOTE><H5>Compare Two Doubles </H5><P>l-&gt;-1 on NaN, g-&gt;1 on NaN.<BLOCKQUOTE><TT>dcmpl=151&nbsp;&nbsp;Stack: ..., D1_1,D1_2, D2_1, D2_2 -&gt; ..., INT (One of [-1, 0, 1])<BR>dcmpg=152&nbsp;&nbsp;Stack: ..., D1_1, D1_2, D2_1, D2_2 -&gt;..., INT (One of [-1, 0, 1])</TT></BLOCKQUOTE><H5>Compare Two Objects</H5><BLOCKQUOTE><TT>if_acmpeq=165 branch1 branch2&nbsp;&nbsp;Stack:..., OBJ1, OBJ2 -&gt; ...<BR>if_acmpne=166 branch1 branch2&nbsp;&nbsp;Stack: ..., OBJ1, OBJ2-&gt; ...</TT></BLOCKQUOTE><H5>Unconditional Branching</H5><P>16-bit and 32-bit branching<BLOCKQUOTE><TT>goto=167 branch1 branch2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stack:... -&gt; ...<BR>goto_w=200 branch1 branch2 branch3 branch4&nbsp;&nbsp;Stack: ...-&gt; ...</TT></BLOCKQUOTE><H5>Jump Subroutine </H5><P>16-bit and 32-bit jumps<BLOCKQUOTE><TT>jsr=168 branch1 branch2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stack:... -&gt; ..., returnAddress<BR>jsr_w=201 branch1 branch2 branch3 branch4&nbsp;&nbsp;&nbsp;Stack:... -&gt; ..., returnAddress</TT></BLOCKQUOTE><H5>Return from Subroutine </H5><P>The return address is retrieved from a local variable, not thestack.<BLOCKQUOTE><TT>ret=169 vindex&nbsp;&nbsp;&nbsp;Stack:... -&gt; ...&nbsp;&nbsp;&nbsp;(returnAddress &lt;- vars[vindex])<BR>ret_w=209 vindex1 vindex2&nbsp;&nbsp;&nbsp;Stack: ... -&gt; ...&nbsp;&nbsp;&nbsp;(returnAddress&lt;- vars[vindex])</TT></BLOCKQUOTE><H5>Returning Primitives </H5><P>The current stack frame is destroyed. The top primitive is pushedonto the caller's operand stack.<BLOCKQUOTE><TT>ireturn=172&nbsp;&nbsp;Stack: ..., INT-&gt; [destroyed]<BR>lreturn=173&nbsp;&nbsp;Stack: ..., LONG1, LONG2 -&gt; [destroyed]<BR>freturn=174&nbsp;&nbsp;Stack: ..., FLOAT -&gt; [destroyed]<BR>dreturn=175&nbsp;&nbsp;Stack: ..., DOUBLE1, DOUBLE2 -&gt; [destroyed]<BR>areturn=176&nbsp;&nbsp;Stack: ..., OBJ -&gt; [destroyed]<BR>return=177&nbsp;&nbsp;Stack: ... -&gt; [destroyed]</TT></BLOCKQUOTE><H5>Calling the Breakpoint Handler</H5><BLOCKQUOTE><TT>breakpoint=202&nbsp;&nbsp;Stack: ...,-&gt; ...</TT></BLOCKQUOTE><H4>Manipulating Object Fields</H4><P>Construct a 16-bit index into the constant pool to retrieve theclass and field name, then resolve these names to determine thefield offset and width. Use the object reference on the stackas the target. The value will be 32 or 64 bits, depending on thefield information in the constant pool.<BLOCKQUOTE><TT>Getstatic=178&nbsp;&nbsp;index1 index2&nbsp;&nbsp;&nbsp;Stack:..., -&gt; ..., VAL<BR>Putstatic=179&nbsp;&nbsp;index1 index2&nbsp;&nbsp;&nbsp;Stack:..., VAL -&gt; ...<BR>Getfield=180&nbsp;&nbsp;&nbsp;index1 index2&nbsp;&nbsp;&nbsp;Stack:..., OBJ -&gt; ..., VAL<BR>Putfield=181&nbsp;&nbsp;&nbsp;index1 index2&nbsp;&nbsp;&nbsp;Stack:..., OBJ, VAL -&gt; ...</TT></BLOCKQUOTE><H4>Method Invocation</H4><P>There are four types of method invocation:<UL><LI><TT>invokevirtual=182</TT>-Normalmethod dispatch in Java. Use the index bytes to create a 16-bitindex into the constant table of the current class. Extract themethod name and signature. Search the method table of the stackobject to determine the method address. Use the method signatureto remove the method arguments from the operand stack and transferthem to the new method's local variables.<LI><TT>invokenonvirtual=183</TT>-Usedwhen a method is called with the super keyword. Use the indexbytes to create a 16-bit index into the constant pool of the currentclass. Extract the method name and signature. Search the namedclass's method table to determine the method address. Extractthe object and arguments and place them in the new method's localvariables.<LI><TT>invokestatic=184</TT>-Usedto call static methods. Create a 16-bit index into the currentclass's constant pool. Extract the method and search the namedclass's method table for the address. Transfer the arguments asbefore. There is no object to pass.<LI><TT>invokeinterface=185</TT>-Invokean interface function. Again, a 16-bit index is created to findthe method name and signature. This time, however, the numberof arguments is determined from the bytecodes, not the signature.<BR><BR><TT>virtual index1 index2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stack:..., OBJ, [arg1, [arg2, ...]] -&gt; ...<BR>nonvirtual index1 index2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stack: ..., OBJ, [arg1, [arg2, ...]] -&gt; ...<BR>static index1 index2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stack:..., [arg1, [arg2, ...]] -&gt; ...<BR>interface index1 index2 nargs resv Stack: ..., OBJ, [arg1, [arg2,...]] -&gt; ...</TT></UL><H4>Miscellaneous Operations</H4><P>These instructions don't fall under any other heading; they dealwith generic object operations, such as creation and casting.<H5>Throw Exception</H5><BLOCKQUOTE><TT>athrow=191&nbsp;&nbsp;Stack: ..., OBJ-&gt; [undefined]</TT></BLOCKQUOTE><H5>Create a New Object</H5><BLOCKQUOTE><TT>new=187 index1 index2&nbsp;&nbsp;Stack:... -&gt; ..., OBJ</TT></BLOCKQUOTE><H5>Check a Cast Operation</H5><BLOCKQUOTE><TT>checkcast=192 index1 index2&nbsp;&nbsp;Stack:..., OBJ -&gt; ..., OBJ</TT></BLOCKQUOTE><H5>Instanceof</H5><BLOCKQUOTE><TT>instanceof=193 index1 index2&nbsp;&nbsp;Stack:..., OBJ -&gt; ... INT (1 or 0)</TT></BLOCKQUOTE><H4>Monitors</H4><P>Monitor instructions are used for synchronization.<H5>Enter a Monitored Region of Code</H5><BLOCKQUOTE><TT>monitorenter=194&nbsp;&nbsp;Stack: ...,OBJ -&gt; ...</TT></BLOCKQUOTE><H5>Exit a Monitored Region of Code</H5><BLOCKQUOTE><TT>monitorexit=195&nbsp;&nbsp;Stack: ...,OBJ -&gt; ...</TT></BLOCKQUOTE><H3><A NAME="TestClassBytecodes">Test Class Bytecodes</A></H3><P>Sun supplies a tool, <TT>javap</TT>,that enables you to disassemble and view the bytecodes of a class.If the -c option is passed to <TT>javap</TT>,a listing of bytecodes is produced. These are the test class'sbytecodes:<BLOCKQUOTE><TT>Compiled from test.java<BR>public class test extends java.lang.Object {<BR>&nbsp;&nbsp;&nbsp;&nbsp;public static int st_one;<BR>&nbsp;&nbsp;&nbsp;&nbsp;public test();<BR>&nbsp;&nbsp;&nbsp;&nbsp;public test(int);<BR>&nbsp;&nbsp;&nbsp;&nbsp;public native boolean getData(int []);<BR>&nbsp;&nbsp;&nbsp;&nbsp;public int do_countdown();<BR>&nbsp;&nbsp;&nbsp;&nbsp;public int do_countdown(int);<BR><BR>Method test()<BR>&nbsp;&nbsp;&nbsp;0 aload_0<BR>&nbsp;&nbsp;&nbsp;1 invokenonvirtual #9 &lt;Method java.lang.Object.&lt;init&gt;()V&gt;<BR>&nbsp;&nbsp;&nbsp;4 bipush 100<BR>&nbsp;&nbsp;&nbsp;6 putstatic #7 &lt;Field test.st_one I&gt;<BR>&nbsp;&nbsp;&nbsp;9 return<BR><BR>Method test(int)<BR>&nbsp;&nbsp;&nbsp;0 aload_0<BR>&nbsp;&nbsp;&nbsp;1 invokenonvirtual #9 &lt;Method java.lang.Object.&lt;init&gt;()V&gt;<BR>&nbsp;&nbsp;&nbsp;4 iload_1<BR>&nbsp;&nbsp;&nbsp;5 putstatic #7 &lt;Field test.st_one I&gt;<BR>&nbsp;&nbsp;&nbsp;8 return<BR><BR>Method int do_countdown()<BR>&nbsp;&nbsp;&nbsp;0 getstatic #7 &lt;Field test.st_one I&gt;<BR>&nbsp;&nbsp;&nbsp;3 istore_1<BR>&nbsp;&nbsp;&nbsp;4 getstatic #6 &lt;Field java.lang.System.outLjava/io/PrintStream;&gt;<BR>&nbsp;&nbsp;&nbsp;7 ldc #1 &lt;String &quot;Performing countdown:&quot;&gt;<BR>&nbsp;&nbsp;&nbsp;9 invokevirtual #10 &lt;Method java.io.PrintStream.println(Ljava/lang/String;)V&gt;<BR>&nbsp;&nbsp;12 goto 22<BR>&nbsp;&nbsp;15 getstatic #6 &lt;Field java.lang.System.out Ljava/io/PrintStream;&gt;<BR>&nbsp;&nbsp;18 iload_1<BR>&nbsp;&nbsp;19 invokevirtual #8 &lt;Method java.io.PrintStream.println(I)V&gt;<BR>&nbsp;&nbsp;22 iload_1<BR>&nbsp;&nbsp;23 iinc 1 -1<BR>&nbsp;&nbsp;26 ifne 15<BR>&nbsp;&nbsp;29 getstatic #7 &lt;Field test.st_one I&gt;<BR>&nbsp;&nbsp;32 ireturn<BR><BR>Method int do_countdown(int)<BR>&nbsp;&nbsp;&nbsp;0 iload_1<BR>&nbsp;&nbsp;&nbsp;1 istore_2<BR>&nbsp;&nbsp;&nbsp;2 getstatic #6 &lt;Field java.lang.System.outLjava/io/PrintStream;&gt;<BR>&nbsp;&nbsp;&nbsp;5 ldc #1 &lt;String &quot;Performing countdown:&quot;&gt;<BR>&nbsp;&nbsp;&nbsp;7 invokevirtual #10 &lt;Method java.io.PrintStream.println(Ljava/lang/String;)V&gt;<BR>&nbsp;&nbsp;10 goto 20<BR>&nbsp;&nbsp;13 getstatic #6 &lt;Field java.lang.System.out Ljava/io/PrintStream;&gt;<BR>&nbsp;&nbsp;16 iload_1<BR>&nbsp;&nbsp;17 invokevirtual #8 &lt;Method java.io.PrintStream.println(I)V&gt;<BR>&nbsp;&nbsp;20 iload_1<BR>&nbsp;&nbsp;21 iinc 1 -1<BR>&nbsp;&nbsp;24 ifne 13<BR>&nbsp;&nbsp;27 iload_2<BR>&nbsp;&nbsp;28 ireturn<BR>}</TT></BLOCKQUOTE><P>The left-hand column displays the offset of the instruction. <TT>Javap</TT>automatically converts jump displacements to actual offsets. Inaddition, it looks up constant pool references in order to outputthe corresponding strings.<H2><A NAME="GarbageCollection"><FONT SIZE=5 COLOR=#FF0000>GarbageCollection</FONT></A></H2><P>Java uses a multitiered security mechanism. The bytecode verifierprovides the lowest layer of  security. Above the verifier, thesecurity manager is the next sentry. In addition to these twoexplicit checks, there are a number of language features thatprovide security as well. Chief among these is the garbage collector.<P>Failing to free memory blocks or file handles is a common bugin most modern programs. The problem quickly escalates until thesystem crashes in some unforeseen manner. Java, like Smalltalkbefore it, uses implicit garbage collection to solve the problem.The virtual machine spec does not mandate a particular type ofgarbage collection; it requires only that some type be used.<P>In Sun's runtime, a mark and sweep algorithm is used. This enablesthe garbage collector to run incrementally in the background.<P><HR WIDTH="100%"></P></P></CENTER><P><HR WIDTH="100%"></P><!-- reference library footer #1--></CENTER><IMG SRC="/images/rule.gif" WIDTH="460" HEIGHT="5" VSPACE="5"ALT="Ruler image"><br><FONT SIZE="-1">Contact <a href="mailto:reference@developer.com">reference@developer.com</a> with questions or comments.<br><a href="/legal/">Copyright 1998</a> <a href="http://www.earthweb.com" target="_top">EarthWeb Inc.</a>,  All rights reserved.<BR>PLEASE READ THE <a href="/reference/usage.html">ACCEPTABLE USAGE STATEMENT</a>.<BR>Copyright 1998 Macmillan Computer Publishing. All rights reserved.</FONT></BLOCKQUOTE><!--outer table--><TD VALIGN="TOP"><!--right side ads --><a target="resource window" href="http://adserver.developer.com/cgi-bin/accipiter/adclick.exe/AREA=DCAD1.REF" alt="Click here for more info"><img src="http://adserver.developer.com/cgi-bin/accipiter/adserver.exe/AREA=DCAD1.REF" alt="Click here for more info" height="88" width="88" border="0"></a><P><a target="resource window" href="http://adserver.developer.com/cgi-bin/accipiter/adclick.exe/AREA=DCAD2.REF" alt="Click here for more info"><img src="http://adserver.developer.com/cgi-bin/accipiter/adserver.exe/AREA=DCAD2.REF" alt="Click here for more info" height="88" width="88" border="0"></a><P></td></tr></table></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -