Package daikon.chicory
Class Instrument
- Object
-
- StackMapUtils
-
- InstructionListUtils
-
- Instrument
-
- All Implemented Interfaces:
ClassFileTransformer
public class Instrument extends InstructionListUtils implements ClassFileTransformer
The Instrument class is responsible for modifying another class' bytecode. Specifically, its main task is to add "hooks" into the other class at method entries and exits for instrumentation purposes.
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleLog
debug_transform
Debug information about which classes are transformed and why.
-
Constructor Summary
Constructors Constructor Description Instrument()
Create a new Instrument.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump_code_attributes(MethodGen mg)
static boolean
shouldIgnore(String className, String methodName, String pptName)
Returns true if the given ppt should be ignored.byte @Nullable []
transform(ClassLoader loader, @InternalForm String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
Given a class, return a transformed version of the class that contains "hooks" at method entries and exits.-
Methods inherited from class InstructionListUtils
append_inst, build_il, calculateLiveLocalTypes, calculateLiveStackTypes, delete_instructions, insertAtMethodStart, insertBeforeHandle, replaceInstructions
-
Methods inherited from class StackMapUtils
addNewParameter, addString, adjust_code_for_locals_change, bcelCalcStackTypes, buildUninitializedNewMap, create_local_from_live_range, create_method_scope_local, createNewStackMapAttribute, findStackMapEqual, findStackMapIndexAfter, findStackMapIndexBefore, fixLocalVariableTable, gen_locals, gen_locals_from_byte_codes, gen_locals_from_byte_codes, generate_Type_from_StackMapType, generateStackMapTypeFromType, get_attribute_name, get_local_variable_type_table_attribute, getSize, getStackMapTable_attribute, is_local_variable_type_table, isStackMapTable, modifyStackMapsForSwitches, printStackMapTable, remove_local_variable_type_table, set_method_stackTypes, setCurrentStackMapTable, typeToClassGetName, update_full_frameStackMap_entries, updateStackMapOffset, updateUninitializedNewOffsets
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ClassFileTransformer
transform
-
-
-
-
Field Detail
-
debug_transform
public static SimpleLog debug_transform
Debug information about which classes are transformed and why.
-
-
Constructor Detail
-
Instrument
public Instrument()
Create a new Instrument. Sets up debug logging.
-
-
Method Detail
-
shouldIgnore
public static boolean shouldIgnore(String className, String methodName, String pptName)
Returns true if the given ppt should be ignored. Uses the patterns inRuntime.ppt_omit_pattern
andRuntime.ppt_select_pattern
. This method is used by both Chicory and Dyncomp.- Parameters:
className
- class name to be checkedmethodName
- method name to be checkedpptName
- ppt name to be checked- Returns:
- true if the item should be filtered out
-
transform
public byte @Nullable [] transform(ClassLoader loader, @InternalForm String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException
Given a class, return a transformed version of the class that contains "hooks" at method entries and exits. Because Chicory is invoked as a javaagent, the transform method is called by the Java runtime each time a new class is loaded.- Specified by:
transform
in interfaceClassFileTransformer
- Throws:
IllegalClassFormatException
-
dump_code_attributes
public void dump_code_attributes(MethodGen mg)
-
-