Bytecode Instrumentation

| 2004 JavaOne
SM
Conference | Session 3042 Copyright Hewlett Packard Co., 2004.
9
Bytecode Instructions
Interesting instructions and their side-effects
Control flow
goto, jsr, ret, if*, *cmp*, athrow
Table jumping: lookupswitch, tableswitch
Challenging because of the jump table representation
Targets are indices into the array of bytecodes
Method invocation
Method call: invokestatic, invokevirtual, invokespecial, invokeinterface
Method return: return, {I,l,f,d,a}return
Stack operations and loads/stores
Push, pop, dup, load, *load, *store, …
max_stack must be updated with control flow information after traversal of the basic blocks
Field access
get/put field and static
Arithmetic operations
Impact the stack size
Type conversions and checks
checkcast, typecast, instanceof
Object allocation
new
Arrays: newarray, anewarray, multianewarray