Bytecode Instrumentation

| 2004 JavaOne
SM
Conference | Session 3042 Copyright Hewlett Packard Co., 2004.
26
java_crw_demo
Example: Injection at Method Entry
injection_template
Insertion of the actual bytecodes
entry_injection_code - create injection code at entry to a method
injection_template
method_inject_and_write_code
entry_injection_code
Write bytecode image
method_write_bytecodes
method_inject_and_write_code
Adjust all offsets:
Code length
Maximum stack
Exception table
Code attributes
Attribute length