Instruction | Opcode | Meaning (how to obtain the next state) | |
NOP | 0 | ||
ILOAD | 21 |
|
|
ISTORE | 54 |
|
|
BIPUSH | 16 |
|
|
POP | 87 |
|
|
DUP | 89 |
|
|
SWAP | 95 |
|
|
ISUB | 100 |
|
|
IADD | 96 |
|
|
IMUL | 104 |
|
|
IAND | 126 |
|
|
IOR | 128 |
|
|
GOTO | 167 |
|
|
IFEQ | 153 |
|
|
IFNE | 154 |
|
|
IFGT | 157 |
|
|
INVOKESTATIC1 | 184 |
|
|
IRETURN | 172 |
|
1: The part that differs signficantly from the iJVM is the
call/return mechanism. iJVM2 does not have classes and
there is no need to resolve method calls. An invokestatic
instruction specifies the beginning address of the method.
At that address, the first byte indicates the number of arguments
to the method and the second byte is the number of local
variables in the method. The method can access the
arguments and locals using iload and istore. The arguments
are numbered 0, ..., nargs-1 and the locals are
numbered nargs, ..., nargs+nlocs-1.
An ireturn instruction saves the top of the stack,
restores the previous frame and pushes the saved value onto the
new stack.