Homework Assignments Week 2.3: Virtual Machines
Bytecode Execution
Execute the bytecode instructions of A/main()V
, starting with an empty stack.
The initial value of local variable 0
is 4242 4103
, pointing to an object of class A. Show stacks and local variables after each instruction.
Code for A/main()V
aload_0
bipush 5
iconst_4
isub
invokevirtual A/m(I)V
Code for A/m(I)V
goto l2
l1: iinc 1 -1
l2: iload_1
ifne l1
return
Code for Hint: iinc 1 -1
iload_1
ldc -1
iadd
istore_1