1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
Java assembly reference
Ŀ
%BJava Summary%b
Ĵ
%IDescription%i
The Java virtual machine is an %Uabstract%u machine. The Java virtual
machine specified here will support the Java programming language
specified in The JavaTM Language Specification (Addison-Wesley, 1996).
It is compatible with the Java platform implemented by Sun's JDK
releases %U1.0.2%u and %U1.1%u and the %UJavaTM 2%u platform implemented by Sun's
JavaTM 2 SDK, Standard Edition, v1.2 (formerly known as JDK release 1.2)
A Java virtual machine instruction consists of an opcode specifying the
operation to be performed, followed by zero or more operands embodying
values to be operated upon.
The Java virtual machine is an abstract computing machine. Like a real
computing machine, it has an instruction set and manipulates various
memory areas at run time. It is reasonably common to implement a
programming language using a virtual machine; the best-known virtual
machine may be the %UP-Code%u machine of %UUCSD Pascal%u.
The Java virtual machine defines various runtime data areas that are
used during execution of a program.
The Java virtual machine can support many %Uthreads%u of execution at once.
Each Java virtual machine thread has its own %Upc (program counter)%u
register. At any point, each Java virtual machine thread is executing
the code of a single method, the current method for that thread.
Each Java virtual machine thread has a private Java %Uvirtual machine%u
%Ustack%u, created at the same time as the thread. A Java virtual machine
stack stores frames. A Java virtual machine stack is analogous to the
stack of a conventional language such as C: it holds local variables
and partial results, and plays a part in method invocation and return.
Because the Java virtual machine stack is never manipulated directly
except to push and pop frames, frames may be heap allocated. The memory
for a Java virtual machine stack does not need to be contiguous.
The Java virtual machine specification permits Java virtual machine
stacks either to be of a %Ufixed size%u or to %Udynamically expand%u and
contract as required by the computation. If the Java virtual machine
stacks are of a fixed size, the size of each Java virtual machine
stack may be chosen independently when that stack is created. A Java
virtual machine implementation may provide the programmer or the user
control over the initial size of Java virtual machine stacks, as well
as, in the case of dynamically expanding or contracting Java virtual
machine stacks, control over the maximum and minimum sizes.
The Java virtual machine has a %Uheap%u that is shared among all Java
virtual machine threads. The heap is the runtime data area from which
memory for all class instances and arrays is allocated.
The Java virtual machine has a %Umethod area%u that is shared among all
Java virtual machine threads. The method area is analogous to the
storage area for compiled code of a conventional language or analogous
to the "%Utext%u" segment in a UNIX process.
A runtime %Uconstant pool%u is a per-class or per-interface runtime
representation of the constant_pool table in a class file. It contains
several kinds of constants, ranging from numeric literals known at
compile time to method and field references that must be resolved at
run time. The runtime constant pool serves a function similar to that
of a symbol table for a conventional programming language, although
it contains a wider range of data than a typical symbol table.
An implementation of the Java virtual machine may use conventional
stacks, colloquially called "%UC stacks%u" to support native methods,
methods written in a language other than the Java programming language.
Native method stacks may also be used by the implementation of an
interpreter for the Java virtual machine's instruction set in a language
such as %UC%u.
Ĵ
aaload [32] Load reference from array
aastore [53] Store into reference array
aconst_null [01] Push %Unull%u
aload [19,i1] Load reference from local variable
aload_0 [2A] Load reference from local variable #0
aload_1 [2B] Load reference from local variable #1
aload_2 [2C] Load reference from local variable #2
aload_3 [2D] Load reference from local variable #3
anewarray [BD,i2] Create new array of reference
areturn [B0] Return reference from method
arraylength [BE] Get length of array
astore [3A,i1] Store reference into local variable
astore_0 [4B] Store reference into local variable #0
astore_1 [4C] Store reference into local variable #1
astore_2 [4D] Store reference into local variable #2
astore_3 [4E] Store reference into local variable #3
athrow [BF] Throw exception or error
baload [33] Load byte or boolean from array
bastore [54] Store into byte or boolean array
bipush [10,b1] Push byte
breakpoint [CA] Breakpoint
caload [34] Load char from array
castore [55] Store char into array
checkcast [C0,i2] Check whether object is of given type
d2f [90] Convert double to float
d2i [8E] Convert double to int
d2l [8F] Convert double to long
dadd [63] Add double
daload [31] Load double from array
dastore [52] Store into double array
dcmpg [98] Compare double; %Ust0>st1?1:st0==st1?0:-1%u
dcmpl [97] Compare double. Differs only by NaN treating
dconst_0 [0E] Push 0.0
dconst_1 [0F] Push 1.0
ddiv [6F] Divide double
dload [18,i1] Load double from local variable
dload_0 [26] Load double from local variable #0
dload_1 [27] Load double from local variable #1
dload_2 [28] Load double from local variable #2
dload_3 [29] Load double from local variable #3
dmul [6B] Multiply double
dneg [77] Negate double
drem [73] Remainder double
dreturn [AF] Return double from method
dstore [39,i1] Store double into local variable
dstore_0 [47] Store double into local variable #0
dstore_1 [48] Store double into local variable #1
dstore_2 [49] Store double into local variable #2
dstore_3 [4A] Store double into local variable #3
dsub [67] Substract double
dup [59] Duplicate the top operand stack value
dup_x1 [5A] Dup the top opstack value & insert 2 val dn
dup_x2 [5B] Dup the top opstack value & insert 3 val dn
dup2 [5C] Duplicate the top upto 2 operand stack value
dup2_x1 [5D] Dup the top upto 2 opstack value&insert 3 dn
dup2_x2 [5E] Dup the top upto 2 opstack value&insert 4 dn
f2d [8D] Convert float to double
f2i [8B] Convert float to int
f2l [8C] Convert float to long
fadd [62] Add float
faload [30] Load float from array
fastore [51] Store into float array
fcmpg [96] Compare float; %Ust0>st1?1:st0==st1?0:-1%u
fcmpl [95] Compare float. Differs only by NaN treating
fconst_0 [0B] Push 0.0
fconst_1 [0C] Push 1.0
fconst_2 [0D] Push 2.0
fdiv [6E] Divide float
fload [17,i1] Load float from local variable
fload_0 [22] Load float from local variable #0
fload_1 [23] Load float from local variable #1
fload_2 [24] Load float from local variable #2
fload_3 [25] Load float from local variable #3
fmul [6A] Multiply float
fneg [76] Negate float
frem [72] Remainder float
freturn [AE] Return float from method
fstore [38,i1] Store float into local variable
fstore_0 [43] Store float into local variable #0
fstore_1 [44] Store float into local variable #1
fstore_2 [45] Store float into local variable #2
fstore_3 [46] Store float into local variable #3
fsub [66] Substract float
getfield [B4,i2] Fetch field from object
getstatic [B2,i2] Get static field from class
goto [A7,c2] Branch always
goto_w [C8,c4] Branch always (wide index)
i2b [91] Convert int to byte
i2c [92] Convert int to char
i2d [87] Convert int to double
i2f [86] Convert int to float
i2l [85] Convert int to long
i2s [93] Convert int to short
iadd [60] Add int
iaload [2E] Load int from array
iand [7E] Boolean AND int
iastore [4F] Store into int array
iconst_m1 [02] Push -1
iconst_0 [03] Push 0
iconst_1 [04] Push 1
iconst_2 [05] Push 2
iconst_3 [06] Push 3
iconst_4 [07] Push 4
iconst_5 [08] Push 5
idiv [6C] Divide int
if_acmpeq [A5,c2] Branch if st0==st1
if_acmpne [A6,c2] Branch if st0!=st1
if_icmpeq [9F,c2] Branch if (int)st0==(int)st1
if_icmpne [A0,c2] Branch if (int)st0!=(int)st1
if_icmplt [A1,c2] Branch if (int)st0<(int)st1
if_icmpge [A2,c2] Branch if (int)st0>=(int)st1
if_icmpgt [A3,c2] Branch if (int)st0>(int)st1
if_icmple [A4,c2] Branch if (int)st0<=(int)st1
ifeq [99,c2] Branch if (int)st0==0
ifne [9A,c2] Branch if (int)st0!=0
iflt [9B,c2] Branch if (int)st0<0
ifge [9C,c2] Branch if (int)st0>=0
ifgt [9D,c2] Branch if (int)st0>0
ifle [9E,c2] Branch if (int)st0<=0
ifnonnull [C7,c2] Branch if reference not null
ifnull [C6,c2] Branch if reference null
iinc [84,i1,v1] Increment local variable by constant
iload [15,i1] Load int from local variable
iload_0 [1A] Load int from local variable #0
iload_1 [1B] Load int from local variable #1
iload_2 [1C] Load int from local variable #2
iload_3 [1D] Load int from local variable #3
imul [68] Multiply int
impdep1 [FE] RESERVED
impdep2 [FF] RESERVED
ineg [74] Negate int
instanceof [C1,i2] Determine if object is of given type
invokeinterface [B9,i2,v1] Invoke interface method
invokespecial [B7,i2] Invoke instance method
invokestatic [B8,i2] Invoke static method
invokevirtual [B6,i2] Invoke virtual method
ior [80] Boolean OR int
irem [70] Remainder int
ireturn [AC] Return int from method
ishl [78] Shift left int
ishr [7A] Arithmentic shift right int
istore [36,i1] Store int into local variable
istore_0 [3B] Store int into local variable #0
istore_1 [3C] Store int into local variable #1
istore_2 [3D] Store int into local variable #2
istore_3 [3E] Store int into local variable #3
isub [64] Substract int
iushr [7C] Logical shift right int
ixor [82] Boolean XOR int
jsr [A8,c2] Jump subroutine
jsr_w [C9,c4] Jump subroutine (wide index)
l2d [8A] Convert long to double
l2f [89] Convert long to float
l2i [88] Convert long to int
ladd [61] Add long
laload [2F] Load long from array
land [7F] Boolean AND long
lastore [50] Store into long array
lcmp [94] Compare long
lconst_0 [09] Push 0
lconst_1 [0A] Push 1
ldc [12,i1] Push item from runtime constant pool
ldc_w [13,i2] Push item from runtime constant pool (wide)
ldc2_w [14,i2] Push l or d from runtime constant pool(wide)
ldiv [6D] Divide long
lload [16,i1] Load long from local variable
lload_0 [1E] Load long from local variable #0
lload_1 [1F] Load long from local variable #1
lload_2 [20] Load long from local variable #2
lload_3 [21] Load long from local variable #3
lmul [69] Multiply long
lneg [75] Negate long
lookupswitch [AB,...] Access jump table by key match and jump
lor [81] Boolean OR long
lrem [71] Remainder long
lreturn [AD] Return long from method
lshl [79] Shift left
lshr [7B] Arithmetic shift right long
lstore [37,i1] Store long into local variable
lstore_0 [3F] Store long into local variable #0
lstore_1 [40] Store long into local variable #1
lstore_2 [41] Store long into local variable #2
lstore_3 [42] Store long into local variable #3
lsub [65] Substract long
lushr [7D] Logical shift right long
lxor [83] Logical XOR long
monitorenter [C2] Enter monitor for object
monitorexit [C3] Exit monitor for object
multinewarray [C5,i2,v1] Create new multidimensional array
new [BB,i2] Create new object
newarray [BB,v1] Create new array
nop [00] Do nothing
pop [57] Pop the top operand stack value
pop2 [58] Pop the top one or two operand stack values
putfield [B5,i2] Set field in object
putstatic [B3,i2] Set static field in class
ret [A9,i1] Return from subroutine
return [B1] Return void from method
saload [35] Load short from array
sastore [56] Store into short array
sipush [11,v2] Push short
swap [5F] Swap the top two operand stack values
tableswitch [AA,...] Access jump table by index and jump
wide [C4,opc] Extend local var index by additional bytes
Ĵ
%ILimitations%i
The per-class or per-interface constant pool is limited to 65535
entries by the 16-bit constant_pool_count field
The amount of code per non-native, non-abstract method is limited to
65536 bytes by the sizes of the indices in the exception_table of the
Code attribute.
The greatest number of local variables in the local variables array of
a frame created upon invocation of a method is limited to 65535 by the
size of the max_locals item of the Code attribute.
The number of fields that may be declared by a class or interface is
limited to 65535 by the size of the fields_count item of the ClassFile
structure
The number of methods that may be declared by a class or interface is
limited to 65535 by the size of the methods_count item of the
ClassFile structure.
The number of direct superinterfaces of a class or interface is limited
to 65535 by the size of the interfaces_count item of the ClassFile
structure.
The size of an operand stack in a frame is limited to 65535 values
by the max_stack field of the Code_attribute structure.
The number of local variables in a frame is limited to 65535 by the
max_locals field of the Code_attribute structure and the 16-bit local
variable indexing of the Java virtual machine instruction set.
The number of dimensions in an array is limited to 255 by the size of
the dimensions opcode of the multianewarray instruction and by the
constraints imposed on the multianewarray, anewarray, and newarray
instructions.
The number of method parameters is limited to 255 by the definition
of a method descriptor, where the limit includes one unit for this
in the case of instance or interface method invocations. Note that
a method descriptor is defined in terms of a notion of method
parameter length in which a parameter of type long or double
contributes two units to the length, so parameters of these types
further reduce the limit.
The length of field and method names, field and method descriptors,
and other constant string values is limited to 65535 characters by
the 16-bit unsigned length item of the CONSTANT_Utf8_info structure.
|