Computer Science Department
Programming Methods Laboratory

Compilation     winter 99/00
Ecole Polytechnique Federale de Lausanne
JVM Instruction Summary

Data types:

byte

1 byte integer

short

2 byte integer

int

4 byte integer

ref

4 byte reference


Address modes:

local

(e.g. aload, astore)

global (static)

(e.g. get_static, put_static)

indexed

(e.g. iaload, iastore)

constant

(e.g. bipush, sipush)


Instructions

Instruction and Operands

Effect on stack

Other effect

Load & Store

 

 

aload (n: byte)

_ ==> <local variable #n>: ref

 

iload (n: byte)

_ ==> <local variable #n>: int

 

astore (n: byte)

(x: ref) ==> _

<local variable #n>: ref := x;

istore (n: byte)

(x: int) ==> _

<local variable #n>: int := x;

iaload

(a: ref) (index: int) ==> a[index]: int

 

aaload

(a: ref) (index: int) ==> a[index]: ref

 

iastore

(a: ref) (index: int) (x: int) ==> _

a[index] := x

aastore

(a: ref) (index: int) (x: ref) ==> _

a[index] := x

getstatic(field_ref: short)

_ ==> field

 

putstatic(field_ref: short)

x ==> _

field := x

 

 

 

iconst_n (n = 0,..,5)

_ ==> n

 

aconst_null

_ ==> null

 

bipush (n: byte)

_ ==> n

 

sipush (n: short)

_ ==> n

 

ldc1(const-ref: byte)

_ ==> constant at pool slot const-ref

 

ldc_w(const-ref: short)

_ ==> constant at pool slot const-ref

 

 

 

 

Operations:

 

 

iadd

(x1: int) (x2: int) ==> x1 + x2

 

isub

(x1: int) (x2: int) ==> x1 - x2

 

imul

(x1: int) (x2: int) ==> x1 * x2

 

imod

(x1: int) (x2: int) ==> x1 % x2

 

idiv

(x1: int) (x2: int) ==> x1 / x2

 

iand

(x1: int) (x2: int) ==> x1 & x2

 

ior

(x1: int) (x2: int) ==> x1 | x2

 

ineg

(x: int) ==> - x

 

dup

x ==> x x

 

 

 

 

Function call:

 

 

invokestatic(meth-ref: short)

arg_1, ..., arg_n ==> meth(arg_1, ..., arg_n)

execute meth

 

 

 

Object creation:

 

 

new(clazz-ref: short)

_ ==> new object: clazz.

 

newarray(10: byte)

length: int ==> new int[length]

 

anewarray(clazz-ref: short)

length: int ==> new clazz[length]

 

 

 

 

Control:

 

 

goto(target: short)

_ ==> _

goto target

ifeq(target: short)

(x1: int) ==> _

goto target if x1 == 0

ifne(target: short)

(x1: int) ==> _

goto target if x1 != 0

if_acmpeq(target: short)

(a1: ref) (a2: ref) ==> _

goto target if a1 == a2

if_acmpne(target: short)

(a1: ref) (a2: ref) ==> _

goto target if a1 != a2

 

 

 

if_icmpeq(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 = x2

if_icmpne(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 != x2

if_icmplt(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 < x2

if_icmpgt(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 x2

if_icmple(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 <= x2

if_icmpg2(jumptarget: short)

(x1: int) (x2: int) ==> _

goto target if x1 = x2

 

 

 

return_

_ ==> _

return

ireturn

(result: int) ==> _

return result

return

(result: ref) ==> _

return result