📄 jcvm07instr.html
字号:
</LI><P CLASS="Linebreak"></P><UL><LI CLASS="Bullet2"><A NAME="pgfId-48251"></A>If T is a class type, then T must be Object (<A HREF="JCVM02lang.html#Classes" CLASS="XRef">Section 2.2.2.4, Classes</A>);</LI><P CLASS="Linebreak"></P><LI CLASS="Bullet2"><A NAME="pgfId-48356"></A>If T is an interface type, T must be the same interface as S or a superinterface of S.</LI><P CLASS="Linebreak"></P></UL><LI CLASS="Bullet1"><A NAME="pgfId-48357"></A>If S is an array type, namely the type SC[], that is, an array of components of type SC, then:</LI><P CLASS="Linebreak"></P><UL><LI CLASS="Bullet2"><A NAME="pgfId-48254"></A>If T is a class type, then T must be Object.</LI><P CLASS="Linebreak"></P><LI CLASS="Bullet2"><A NAME="pgfId-48255"></A>If T is an array type, namely the type TC[], an array of components of type TC, then one of the following must be true:</LI><P CLASS="Linebreak"></P></UL></UL><P CLASS="ParaIndent2"><A NAME="pgfId-48256"></A>TC and SC are the same primitive type (<A HREF="JCVM03structVM.html#91374" CLASS="XRef">Section 3.1, Data Types and Values</A>").</P><P CLASS="ParaIndent2"><A NAME="pgfId-48257"></A>TC and SC are reference types<A NAME="fnote2"></A><A HREF="#pgfId-53438" CLASS="footnote"><SUP>[2]</SUP></A> (<A HREF="JCVM03structVM.html#91374" CLASS="XRef">Section 3.1, Data Types and Values</A>) with type SC assignable to TC, by these rules.</P><UL><LI CLASS="Bullet1"><A NAME="pgfId-53387"></A>If T is an interface type, T must be one of the interfaces implemented by arrays.</LI><P CLASS="Linebreak"></P></UL><P CLASS="Paragraph"><A NAME="pgfId-53391"></A>Runtime Exceptions</P><P CLASS="Paragraph"><A NAME="pgfId-7054"></A>If arrayref is null, aastore throws a NullPointerException.</P><P CLASS="Paragraph"><A NAME="pgfId-7055"></A>Otherwise, if index is not within the bounds of the array referenced by arrayref, the aastore instruction throws an ArrayIndexOutOfBoundsException.</P><P CLASS="Paragraph"><A NAME="pgfId-7056"></A>Otherwise, if arrayref is not null and the actual type of value is not assignment compatible with the actual type of the component of the array, aastore throws an ArrayStoreException.</P><P CLASS="Paragraph"><A NAME="pgfId-26626"></A>Notes</P><P CLASS="Paragraph"><A NAME="pgfId-50823"></A>In some circumstances, the aastore instruction may throw a SecurityException if the current context (<A HREF="JCVM03structVM.html#33311" CLASS="XRef">Section 3.4, Contexts</A>) is not the owning context (<A HREF="JCVM03structVM.html#33311" CLASS="XRef">Section 3.4, Contexts</A>) of the array referenced by arrayref. The exact circumstances when the exception will be thrown are specified in Chapter 6 of the <EM CLASS="Emphasis">Runtime Environment Specification, Java Card Platform, Version 2.2.2</EM>.</P><H3 CLASS="Head2"><A NAME="pgfId-50824"></A>7.5.3 <A NAME="marker-54561"></A>aconst_null</H3><P CLASS="Paragraph"><A NAME="pgfId-50825"></A>Push null</P><P CLASS="Paragraph"><A NAME="pgfId-7059"></A>Format</P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 BORDER="1" DIR="LTR"><CAPTION></CAPTION><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18664"></A><I CLASS="Variable">aconst_null</I></P></TD></TR></TBODY></TABLE><BR><P CLASS="Paragraph"><A NAME="pgfId-7061"></A>Forms</P><P CLASS="Paragraph"><A NAME="pgfId-7062"></A>aconst_null = 1 (0x1)</P><P CLASS="Paragraph"><A NAME="pgfId-7063"></A>Stack</P><P CLASS="Paragraph"><A NAME="pgfId-7064"></A>... -> <BR>..., null</P><P CLASS="Paragraph"><A NAME="pgfId-7065"></A>Description</P><P CLASS="Paragraph"><A NAME="pgfId-7066"></A>Push the null object reference onto the operand stack.</P><H3 CLASS="Head2"><A NAME="pgfId-7067"></A>7.5.4 <A NAME="marker-54562"></A>aload</H3><P CLASS="Paragraph"><A NAME="pgfId-7068"></A>Load reference from local variable</P><P CLASS="Paragraph"><A NAME="pgfId-7069"></A>Format</P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 BORDER="1" DIR="LTR"><CAPTION></CAPTION><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-21334"></A><I CLASS="Variable">aload</I></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-21336"></A><I CLASS="Variable">index</I></P></TD></TR></TBODY></TABLE><BR><P CLASS="Paragraph"><A NAME="pgfId-7072"></A>Forms</P><P CLASS="Paragraph"><A NAME="pgfId-7073"></A>aload = 21 (0x15)</P><P CLASS="Paragraph"><A NAME="pgfId-7074"></A>Stack</P><P CLASS="Paragraph"><A NAME="pgfId-7075"></A>... -><BR>..., objectref</P><P CLASS="Paragraph"><A NAME="pgfId-7076"></A>Description</P><P CLASS="Paragraph"><A NAME="pgfId-7077"></A>The index is an unsigned byte that must be a valid index into the local variables of the current frame (<A HREF="JCVM03structVM.html#13656" CLASS="XRef">Section 3.5, Frames</A>). The local variable at index must contain a reference. The objectref in the local variable at index is pushed onto the operand stack.</P><P CLASS="Paragraph"><A NAME="pgfId-7078"></A>Notes</P><P CLASS="Paragraph"><A NAME="pgfId-7079"></A>The <KBD CLASS="Filename-Command">aload</KBD> instruction cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the <KBD CLASS="Filename-Command">astore</KBD> instruction is intentional.</P><H3 CLASS="Head2"><A NAME="pgfId-7080"></A>7.5.5 <A NAME="marker-54563"></A>aload_<n></H3><P CLASS="Paragraph"><A NAME="pgfId-7081"></A>Load reference from local variable</P><P CLASS="Paragraph"><A NAME="pgfId-7082"></A>Format </P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 BORDER="1" DIR="LTR"><CAPTION></CAPTION><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18666"></A><I CLASS="Variable">aload_<n></I></P></TD></TR></TBODY></TABLE><BR><P CLASS="Paragraph"><A NAME="pgfId-7084"></A>Forms</P><P CLASS="Paragraph"><A NAME="pgfId-7085"></A>aload_0 = 24 (0x18)<BR>aload_1 = 25 (0x19)<BR>aload_2 = 26 (0x1a)<BR>aload_3 = 27 (0x1b)</P><P CLASS="Paragraph"><A NAME="pgfId-7086"></A>Stack</P><P CLASS="Paragraph"><A NAME="pgfId-7087"></A>... -><BR>..., objectref</P><P CLASS="Paragraph"><A NAME="pgfId-7088"></A>Description</P><P CLASS="Paragraph"><A NAME="pgfId-7089"></A>The <n> must be a valid index into the local variables of the current frame (<A HREF="JCVM03structVM.html#13656" CLASS="XRef">Section 3.5, Frames</A>). The local variable at <n> must contain a reference. The objectref in the local variable at <n> is pushed onto the operand stack.</P><P CLASS="Paragraph"><A NAME="pgfId-7090"></A>Notes</P><P CLASS="Paragraph"><A NAME="pgfId-7091"></A>An aload_<n> instruction cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the corresponding astore_<n> instruction is intentional.</P><P CLASS="Paragraph"><A NAME="pgfId-7092"></A>Each of the aload_<n> instructions is the same as aload with an index of <n>, except that the operand <n> is implicit.</P><H3 CLASS="Head2"><A NAME="pgfId-7093"></A>7.5.6 <A NAME="marker-54564"></A>anewarray</H3><P CLASS="Paragraph"><A NAME="pgfId-7094"></A>Create new array of reference</P><P CLASS="Paragraph"><A NAME="pgfId-7095"></A>Format</P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 BORDER="1" DIR="LTR"><CAPTION></CAPTION><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18668"></A><I CLASS="Variable">anewarray</I></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18670"></A><I CLASS="Variable">indexbyte1</I></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18672"></A><I CLASS="Variable">indexbyte2</I></P></TD></TR></TBODY></TABLE><BR><P CLASS="Paragraph"><A NAME="pgfId-7099"></A>Forms</P><P CLASS="Paragraph"><A NAME="pgfId-7100"></A>anewarray = 145 (0x91)</P><P CLASS="Paragraph"><A NAME="pgfId-7101"></A>Stack</P><P CLASS="Paragraph"><A NAME="pgfId-7102"></A>..., count -><BR>..., arrayref</P><P CLASS="Paragraph"><A NAME="pgfId-7103"></A>Description</P><P CLASS="Paragraph"><A NAME="pgfId-26384"></A>The count must be of type short. It is popped off the operand stack. The count represents the number of components of the array to be created. The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current package (<A HREF="JCVM03structVM.html#13656" CLASS="XRef">Section 3.5, Frames</A>), where the value of the index is (indexbyte1 << 8) | indexbyte2. The item at that index in the constant pool must be of type CONSTANT_Classref (<A HREF="JCVM06cap.html#39801" CLASS="XRef">Section 6.7.1, CONSTANT_Classref</A>), a reference to a class or interface type. The reference is resolved. A new array with components of that type, of length count, is allocated from the heap, and a reference arrayref to this new array object is pushed onto the operand stack. All components of the new array are initialized to null, the default value for reference types.</P><P CLASS="Paragraph"><A NAME="pgfId-7105"></A>Runtime Exception</P><P CLASS="Paragraph"><A NAME="pgfId-7106"></A>If count is less than zero, the anewarray instruction throws a NegativeArraySizeException.</P><H3 CLASS="Head2"><A NAME="pgfId-7107"></A>7.5.7 <A NAME="marker-54565"></A>areturn</H3><P CLASS="Paragraph"><A NAME="pgfId-7108"></A>Return reference from method</P><P CLASS="Paragraph"><A NAME="pgfId-7109"></A>Format</P><BR><TABLE CLASS="Titled" BORDER=1 BORDERCOLORLIGHT="#FFFFFF" BORDERCOLORDARK="#000000" CELLPADDING=5 CELLSPACING=0 BORDER="1" DIR="LTR"><CAPTION></CAPTION><TBODY><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-18674"></A><I CLASS="Variable">areturn</I></P></TD></TR></TBODY></TABLE><BR><P CLASS="Paragraph"><A NAME="pgfId-7111"></A>Forms</P><P CLASS="Paragraph"><A NAME="pgfId-7112"></A>areturn = 119 (0x77)</P><P CLASS="Paragraph"><A NAME="pgfId-7113"></A>Stack</P><P CLASS="Paragraph"><A NAME="pgfId-7114"></A>..., objectref -><BR>[empty]</P><P CLASS="Paragraph"><A NAME="pgfId-7115"></A>Description</P><P CLASS="Paragraph"><A NAME="pgfId-7116"></A>The objectref must be of type reference. The objectref is popped from the operand stack of the current frame (<A HREF="JCVM03structVM.html#13656" CLASS="XRef">Section 3.5, Frames</A>) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</P><P CLASS="Paragraph"><A NAME="pgfId-7117"></A>The virtual machine then reinstates the frame of the invoker and returns control to the invoker.</P><H3 CLASS="Head2"><A NAME="pgfId-7118"></A>7.5.8 <A NAME="marker-54566"></A>arraylength</H3><P CLASS="Paragraph"><A NAME="pgfId-7119"></A>Get length of array</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -