I am working on an amateur JVM implementation and I am trying to make sure that I have coverage for testing all opcodes in the specification. I got to the last, but nop and swap eluded me. For example, here is a simple function that can use swap :
static int do_swap() { int a = 56; int b = 32; return b%a; }
But the bytecode created by javac 1.6 avoids the replacement instead of local storage:
static int do_swap(); Code: 0: bipush 56 2: istore_0 3: bipush 32 5: istore_1 6: iload_1 7: iload_0 8: irem 9: ireturn
Any ideas?
java jvm bytecode javac opcode
perimosocordiae Mar 15 '12 at 15:00 2012-03-15 15:00
source share