Skip to content

Java instruction set

Sono edited this page Jun 4, 2021 · 3 revisions

This placeholder page will soon contain a table with all Java bytecode instructions, timings, and the observed behavior for each Java instruction, along with some quirks and unexpected register usage.

This header will be left here until all instructions are manually entered into tables

Instruction set

Here is the Java instruction set as found on Wikipedia, except some instructions translate easily to ARM instructions, and some are always callbacks.

The HW column represents how an instruction is handled by Jazelle:

HW Description
Always translate natively to ARM
x Always executed via callback in r5 table
? Instruction not yet tested at all, or not tested properly
c Conditional native execution or callback (see instruction notes)

Please note that the table is still under investigation, so some fields in the HW column might be bad


Hex HW Official instruction name Notes
00 NOP
01 ? ACONST_NULL
02 ICONST_M1
03 ICONST_0
04 ICONST_1
05 ICONST_2
06 ICONST_3
07 ICONST_4
08 ICONST_5
09 ? LCONST_0
0A ? LCONST_1
0B FCONST_0
0C ? FCONST_1
0D ? FCONST_2
0E ? DCONST_0
0F ? DCONST_1 TODO: test this instruction
10 BIPUSH
11 SIPUSH
12 x LDC
13 x LDC_W
14 x LDC2_W
15 ILOAD
16 LLOAD
17 FLOAD
18 DLOAD
19 ALOAD
1A ILOAD_0
1B ILOAD_1
1C ILOAD_2
1D ILOAD_3
1E LLOAD_0
1F LLOAD_1
20 LLOAD_2
21 LLOAD_3
22 FLOAD_0
23 FLOAD_1
24 FLOAD_2
25 FLOAD_3
26 DLOAD_0
27 DLOAD_1
28 DLOAD_2
29 DLOAD_3
2A ALOAD_0
2B ALOAD_1
2C ALOAD_2
2D ALOAD_3
2E c IALOAD Sometimes calls the callback function, sometimes not.
TODO: what causes this?
2F c LALOAD * Same as 2E IALOAD *
30 c FALOAD * Same as 2E IALOAD *
31 c DALOAD * Same as 2E IALOAD *
32 ? AALOAD * Same as 2E IALOAD *
33 c BALOAD * Same as 2E IALOAD *
34 c CALOAD * Same as 2E IALOAD *
35 c SALOAD * Same as 2E IALOAD *
36 ISTORE
37 LSTORE
38 FSTORE
39 DSTORE
3A ASTORE
3B ISTORE_0
3C ISTORE_1
3D ISTORE_2
3E ISTORE_3
3F LSTORE_0
40 LSTORE_1
41 LSTORE_2
42 LSTORE_3
43 FSTORE_0
44 FSTORE_1
45 FSTORE_2
46 FSTORE_3
47 DSTORE_0
48 DSTORE_1
49 DSTORE_2
4A DSTORE_3
4B ? ASTORE_0
4C ? ASTORE_1
4D ? ASTORE_2
4E ? ASTORE_3
4F ? IASTORE * Same as 2E IALOAD *
50 ? LASTORE * Same as 2E IALOAD *
51 ? FASTORE * Same as 2E IALOAD *
52 ? DASTORE * Same as 2E IALOAD *
53 ? AASTORE TODO: do more tests with this instruction
54 ? BASTORE
55 ? CASTORE
56 ? SASTORE
57 POP
58 POP2
59 DUP
5A DUP_X1
5B DUP_X2
5C DUP2
5D DUP2_X1
5E DUP2_X2
5F SWAP
60 IADD
61 LADD
62 ? FADD
63 ? DADD
64 ISUB
65 LSUB
66 ? FSUB
67 ? DSUB
68 IMUL
69 LMUL
6A ? FMUL
6B ? DMUL
6C x IDIV
6D x LDIV
6E ? FDIV
6F ? DDIV
70 x IREM
71 x LREM
72 ? FREM
73 ? DREM
74 INEG
75 LNEG
76 ? FNEG
77 ? DNEG
78 ISHL
79 ? LSHL
7A ISHR
7B ? LSHR
7C ? IUSHR
7D ? LUSHR
7E IAND
7F ? LAND
80 IOR
81 ? LOR
82 IXOR
83 ? LXOR
84 IINC
85 ? I2L
86 x I2F
87 x I2D
88 ? L2I
89 x L2F
8A x L2D
8B x F2I
8C x F2L
8D x F2D
8E x D2I
8F x D2L
90 x D2F
91 I2B
92 I2C
93 I2S
94 ? LCMP
95 x FCMPL
96 x FCMPG
97 x DCMPL
98 x DCMPG
99 IFEQ
9A IFNE
9B IFLT
9C IFGE
9D IFGT
9E IFLE
9F IF_ICMPEQ
A0 IF_ICMPNE
A1 IF_ICMPLT
A2 IF_ICMPGE
A3 IF_ICMPGT
A4 IF_ICMPLE
A5 IF_ACMPEQ
A6 IF_ACMPNE
A7 GOTO
A8 ? JSR
A9 ? RET
AA ? TABLESWITCH
AB ? LOOKUPSWITCH
AC x IRETURN
AD x LRETURN
AE x FRETURN
AF x DRETURN
B0 x ARETURN
B1 x RETURN
B2 ? GETSTATIC
B3 ? PUTSTATIC
B4 ? GETFIELD
B5 ? PUTFIELD
B6 x INVOKEVIRTUAL
B7 x INVOKESPECIAL
B8 x INVOKESTATIC
B9 x INVOKEINTERFACE
BA x INVOKEDYNAMIC
BB x NEW
BC x NEWARRAY
BD x ANEWARRAY
BE ? ARRAYLENGTH
BF x ATHROW
C0 x CHECKCAST
C1 x INSTANCEOF
C2 ? MONITORENTER
C3 ? MONITOREXIT
C4 ? WIDE
C5 x MULTIANEWARRAY
C6 ? IFNULL
C7 ? IFNONNULL
C8 ? GOTO_W
C9 ? JSR_W
CA ? BREAKPOINT
CB
to
FE
x * undefined *
FF BKPT #0 Executes an ARM BKPT #0 instruction
Clone this wiki locally