Operation
Push null reference.
Format
aconst_null
Forms
aconst_null = 1 (0x00000001)
Operand Stack
... ..., null
Description
The value denoting a null reference is pushed onto the operand stack.
Operation
Load reference from local variable.
Format
aload index
Forms
aload = 25 (0x00000019)
Operand Stack
... ..., objectref
Description
The index must be an index into the local variable array of the current frame. The objectref in the local variable at index is pushed onto the operand stack.
Operation
Return reference from method.
Format
areturn
Forms
areturn = 176 (0x000000b0)
Operand Stack
..., objectref [empty]
Description
objectref is popped from the operand stack of the current frame and pushed onto the operand stack of the frame of the invoker. Execution is returned to the invoker of the current method, reinstating the frame of the invoker.
Operation
Store reference into local variable.
Format
astore index
Forms
astore = 58 (0x0000003a)
Operand Stack
..., objectref ...
Description
The index must be an index into the local variable array of the current frame. The objectref on the top of the operand stack is popped, and the value of the local variable at index is set to objectref.
Operation
Check whether object is of a given type.
Format
checkcast class
Forms
checkcast = 192 (0x000000c0)
Operand Stack
..., ref1, ref2 ..., objectref
Description
class must denote a class in the class table (i.e. it is the address of a class descriptor). ref2 must denote an Integer instance. If the value of ref2 is 0, then objectref will be a new Integer instance whose value is 1 if ref1 is either null or an instance of the class indicated by class, otherwise its value is 0. If the value of ref2 is not 0, then objectref will be ref1 if ref1 is either null or an instance of the class indicated by class, otherwise the VM halts with an appropriate error message.
Operation
Duplicate the top value on the operand stack.
Format
dup
Forms
dup = 89 (0x00000059)
Operand Stack
..., value ..., value, value
Description
The top value on the operand stack is replicated onto the top of the stack.
Operation
Duplicate the top value on the operand stack and insert it two values down.
Format
dup_x1
Forms
dup = 251 (0x000000fb)
Operand Stack
..., value2, value1 ..., value1, value2, value1
Description
Duplicate the top value on the operand stack and insert it two values down.
Operation
Fetch a field from an object.
Format
getfield index
Forms
getfield = 180 (0x000000b4)
Operand Stack
..., objectref ..., value
Description
The objectref is popped from the operand stack. It must not be null and the index must denote a field in the class of the object it references. The value of this field is retrieved and pushed onto the stack.
Operation
Branch always.
Format
goto address
Forms
goto = 167 (0x000000a7)
Operand Stack
No change.
Description
Execution proceeds at the given address. The target address must be that of an opcode of an instruction within the current method.
Operation
Branch if comparison with zero succeeds.
Format
ifeq address
Forms
ifeq = 153 (0x00000099)
Operand Stack
..., objectref ...
Description
The objectref is popped from the operand stack. It must not be null and it must denote an Integer object. If the value denoted by the Integer object is zero, then execution proceeds at the given address. The target address must be that of an opcode of an instruction within the current method.
Operation
Read string from input.
Format
in
Forms
in = 243 (0x000000f3)
Operand Stack
... ..., objectref
Description
A string is read from stdin, a String object is created to contain the input value, and the object reference for that newly created object is pushed onto the operand stack. To read a string, first any whitespace characters next in the input are read and discarded. Then non-whitespace characters are read and saved into the string until a whitespace character is read or EOF is encountered. If EOF is encountered at the start of the operation, then null is pushed onto the operand stack.
Operation
Invoke native method.
Format
invokenative index
Forms
invokenative = 244 (0x000000f4)
Operand Stack
..., objectref, [arg1 [, arg2 ... [, argn ] ] ] ...
Description
objectref must not be null. The index must be an index into the native method table. The argument values and objectref are popped from the operand stack. They are passed as parameters to the code that implements the method. The parameters are passed and the code is invoked in an implementation-dependent manner.The mapping of native methods to indices is given here.
Operation
Invoke a method using special handling for constructor or superclass methods.
Format
invokespecial address n locals
Forms
invokespecial = 183 (0x000000b7)
Operand Stack
..., objectref, [arg1 [, arg2 ... [, argn-1 ] ] ] ...
Description
address must denote the first instruction of the method body that should be invoked. n denotes the number of arguments being passed to the method, including the objectref. locals denotes the number of locals to be used by the method. objectref must not be null. The n argument values, including objectref, are popped from the operand stack. A new frame is created for the method being invoked. The objectref and the argument values are consecutively made the values of local variables of the new frame, with objectref in local variable 0, arg1 in local variable 1, and so on. The new frame is then made current and execution continues with the first instruction of the method.
Operation
Invoke method with the dispatch based on class.
Format
invokevirtual index n
Forms
invokevirtual = 182 (0x000000b6)
Operand Stack
..., objectref, [arg1 [, arg2 ... [, argn-1 ] ] ] ...
Description
objectref must not be null. index must be an index into the method table of the class of the object denoted by objectref. The n argument values, including the objectref, are popped from the operand stack. A new frame is created for the method being invoked. The objectref and the argument values are consecutively made the values of local variables of the new frame, with objectref in local variable 0, arg1 in local variable 1, and so on. The new frame is then made current and execution continues with the first instruction of the method selected by index. However, if the address retrieved from the method table is zero, then a native method is invoked as in invokenative.
Operation
Create new object.
Format
new class
Forms
new = 187 (0x000000bb)
Operand Stack
... ..., objectref
Description
class must denote a class described in the class table and indicates the class of the object to be created. Memory for a new instance of that class is allocated, instance variables (if any) of the new object are initialized to their default initial values, and the objectref for the new object is pushed onto the operand stack.
Operation
Create new Integer object.
Format
newint value
Forms
newint = 247 (0x000000f7)
Operand Stack
... ..., objectref
Description
value is the value of the new Integer object to be created. Memory for a new instance of Integer is allocated, the value is assigned, and the objectref for the new object is pushed onto the operand stack.
Operation
Create new object.
Format
newstr byte0 ... byten
Forms
newstr = 248 (0x000000f8)
Operand Stack
... ..., objectref
Description
The value of the new String object to be created is stored inline in the instruction. Each byte of the string is stored in one 32-bit word and the string is terminated with a zero word. Memory for a new instance of String is allocated, the value is assigned, and the objectref for the new object is pushed onto the operand stack.
Operation
Write a string to output.
Format
out
Forms
out = 245 (0x000000f5)
Operand Stack
..., objectref ...
Description
The objectref is popped from the stack. It must not be null and must denote an instance of String. This string is printed to stdout.
Operation
Pop top operand stack value.
Format
pop
Forms
pop = 250 (0x000000fa)
Operand Stack
..., value ...
Description
The top value on the operand stack is popped and discarded.
Operation
Set a field in an object.
Format
putfield index
Forms
putfield = 181 (0x000000b5)
Operand Stack
..., objectref, value ...
Description
The value and the objectref are popped from the operand stack. The objectref must not be null and the index must denote a field in the class of the object it references. The value popped from the stack is stored into this field.
Operation
Compare references.
Format
refcmp
Forms
refcmp = 249 (0x000000f9)
Operand Stack
..., objectref1, objectref2 ..., objectref
Description
Two object references are popped from the operand stack and compared. A reference to a new Integer object is pushed onto the operand stack. The new Integer object has value 1 if the two popped references denote the same object and value 0 otherwise.
Operation
Return without a value from method.
Format
return
Forms
return = 246 (0x000000f6)
Operand Stack
... [empty]
Description
Execution is returned to the invoker of the current method, reinstating the frame of the invoker.
Comments and questions should be directed to hatcher@unh.edu