|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.cunit.instrumentors.util.AInsertAtOpcodeStrategy
public abstract class AInsertAtOpcodeStrategy
Abstract instrumentation strategy that insert code before an opcode.
Field Summary | |
---|---|
protected IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> |
_afterOpcodePredicate
Predicate that decides if code should be inserted AFTER this opcode. |
protected IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> |
_beforeOpcodePredicate
Predicate that decides if code should be inserted BEFORE this opcode. |
protected IPredicate<ClassFile> |
_classPredicate
Predicate that decides if this class should be instrumented. |
protected IPredicate.Binary<ClassFile,MethodInfo> |
_methodPredicate
Predicate that decides if this method should be instrumented. |
protected static IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> |
OPCODE_NEVER
A predicate that always returns false, i.e. |
Constructor Summary | |
---|---|
protected |
AInsertAtOpcodeStrategy(IPredicate<ClassFile> classPredicate,
IPredicate.Binary<ClassFile,MethodInfo> methodPredicate,
IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> beforeOpcodePredicate,
IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> afterOpcodePredicate)
Create a new strategy with the specified predicates. |
Method Summary | |
---|---|
void |
done()
Instrumentation of all classes is done. |
abstract boolean |
insertEndOfMethod(ClassFile cf,
MethodInfo mi,
InstructionList il,
boolean insertBefore,
boolean insertAfter)
Insert instructions at the end of the method. |
abstract void |
insertInstructionsAfter(ClassFile cf,
MethodInfo mi,
InstructionList il)
Insert instructions after and advance past the instruction. |
abstract void |
insertInstructionsBefore(ClassFile cf,
MethodInfo mi,
InstructionList il)
Insert instructions before. |
void |
instrument(ClassFile cf)
Instrument the class. |
abstract void |
modifyStackAndLocals(ClassFile cf,
MethodInfo mi,
InstructionList il,
boolean insertBefore,
boolean insertAfter,
boolean insertEndOfMethod)
Modify the stack size and number of local variables so that the added instructions can execute. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IPredicate<ClassFile> _classPredicate
protected IPredicate.Binary<ClassFile,MethodInfo> _methodPredicate
protected IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> _beforeOpcodePredicate
protected IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> _afterOpcodePredicate
protected static final IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> OPCODE_NEVER
Constructor Detail |
---|
protected AInsertAtOpcodeStrategy(IPredicate<ClassFile> classPredicate, IPredicate.Binary<ClassFile,MethodInfo> methodPredicate, IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> beforeOpcodePredicate, IPredicate.Ternary<ClassFile,MethodInfo,InstructionList> afterOpcodePredicate)
classPredicate
- predicate that decides if this class should be instrumentedmethodPredicate
- predicate that decides if this method should be instrumentedbeforeOpcodePredicate
- predicate that decides if this opcode should be instrumentedafterOpcodePredicate
- predicate that decides if this opcode should be instrumentedMethod Detail |
---|
public void instrument(ClassFile cf)
instrument
in interface IInstrumentationStrategy
cf
- class file infopublic abstract void insertInstructionsBefore(ClassFile cf, MethodInfo mi, InstructionList il)
cf
- class filemi
- method informationil
- instruction listpublic abstract void insertInstructionsAfter(ClassFile cf, MethodInfo mi, InstructionList il)
cf
- class filemi
- method informationil
- instruction listpublic abstract boolean insertEndOfMethod(ClassFile cf, MethodInfo mi, InstructionList il, boolean insertBefore, boolean insertAfter)
cf
- class filemi
- method informationil
- instruction listinsertBefore
- true if code was inserted before an opcodeinsertAfter
- true if code was inserted after an opcode
public abstract void modifyStackAndLocals(ClassFile cf, MethodInfo mi, InstructionList il, boolean insertBefore, boolean insertAfter, boolean insertEndOfMethod)
cf
- class filemi
- method informationil
- instruction listinsertBefore
- true if code was inserted before an opcodeinsertAfter
- true if code was inserted after an opcodeinsertEndOfMethod
- true if code was inserted at the end of the methodpublic void done()
done
in interface IInstrumentationStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |