Bytecode Instrumentation
| 2004 JavaOne
SM
Conference | Session 3042 Copyright Hewlett Packard Co., 2004.
23
java_crw_demo BCI Library
• Non-instrumented methods
─ init methods
─ finalize methods whose length is 1
─ "system" classes clinit methods
─ java.lang.Thread.currentThread()
•
Modifications
─ No methods or fields added to any class
─ Only add new constant pool entries at end of original constant pool table
─ Exception, line, and local variable tables for each method adjusted
─ Bytecode optimization to use
─ Smaller offsets
─ Fewest 'wide' opcodes
•
Goals
─ Minimize number of bytecodes at each injection site
─ Classes with N return opcodes or N newarray opcodes will get N
injections
─ Input arguments to java_crw_demo determine injections made