public class LivenessAnalyzer extends java.lang.Object implements AttributeVisitor, InstructionVisitor, ExceptionInfoVisitor
AttributeVisitor
analyzes the liveness of the variables in the code attributes that
it visits, based on partial evaluation.Constructor and Description |
---|
LivenessAnalyzer()
Creates a new LivenessAnalyzer.
|
LivenessAnalyzer(PartialEvaluator partialEvaluator,
boolean runPartialEvaluator,
InitializationFinder initializationFinder,
boolean runInitializationFinder)
Creates a new LivenessAnalyzer that will use the given partial evaluator and initialization
finder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isAliveAfter(int instructionOffset,
int variableIndex)
Returns whether the specified variable is alive after the instruction at the given offset.
|
boolean |
isAliveBefore(int instructionOffset,
int variableIndex)
Returns whether the specified variable is alive before the instruction at the given offset.
|
boolean |
isCategory2(int instructionOffset,
int variableIndex)
Returns whether the specified variable takes up two entries after the instruction at the given
offset.
|
boolean |
isTraced(int instructionOffset)
Returns whether the instruction at the given offset has ever been executed during the partial
evaluation.
|
void |
setAliveAfter(int instructionOffset,
int variableIndex,
boolean alive)
Sets whether the specified variable is alive after the instruction at the given offset.
|
void |
setAliveBefore(int instructionOffset,
int variableIndex,
boolean alive)
Sets whether the specified variable is alive before the instruction at the given offset.
|
void |
setCategory2(int instructionOffset,
int variableIndex,
boolean category2)
Sets whether the specified variable takes up two entries after the instruction at the given
offset.
|
void |
visitAnyAttribute(Clazz clazz,
Attribute attribute)
Visits any Attribute instance.
|
void |
visitAnyInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
Instruction instruction)
Visits any Instruction instance.
|
void |
visitCodeAttribute(Clazz clazz,
Method method,
CodeAttribute codeAttribute) |
void |
visitConstantInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
ConstantInstruction constantInstruction) |
void |
visitExceptionInfo(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
ExceptionInfo exceptionInfo) |
void |
visitVariableInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
VariableInstruction variableInstruction) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visitAnnotationDefaultAttribute, visitAnyAnnotationsAttribute, visitAnyParameterAnnotationsAttribute, visitAnyTypeAnnotationsAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitEnclosingMethodAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTypeTableAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitPermittedSubclassesAttribute, visitRecordAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSourceDebugExtensionAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitStackMapAttribute, visitStackMapTableAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttribute
visitAnySwitchInstruction, visitBranchInstruction, visitLookUpSwitchInstruction, visitSimpleInstruction, visitTableSwitchInstruction
public LivenessAnalyzer()
public LivenessAnalyzer(PartialEvaluator partialEvaluator, boolean runPartialEvaluator, InitializationFinder initializationFinder, boolean runInitializationFinder)
partialEvaluator
- the evaluator to be used for the analysis.runPartialEvaluator
- specifies whether to run this evaluator on every code attribute that
is visited.initializationFinder
- the initialization finder to be used for the analysis.runInitializationFinder
- specifies whether to run this initialization finder on every
code attribute that is visited.public boolean isTraced(int instructionOffset)
public boolean isAliveBefore(int instructionOffset, int variableIndex)
public void setAliveBefore(int instructionOffset, int variableIndex, boolean alive)
public boolean isAliveAfter(int instructionOffset, int variableIndex)
public void setAliveAfter(int instructionOffset, int variableIndex, boolean alive)
public boolean isCategory2(int instructionOffset, int variableIndex)
public void setCategory2(int instructionOffset, int variableIndex, boolean category2)
public void visitAnyAttribute(Clazz clazz, Attribute attribute)
AttributeVisitor
visitAnyAttribute
in interface AttributeVisitor
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
visitCodeAttribute
in interface AttributeVisitor
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
InstructionVisitor
visitAnyInstruction
in interface InstructionVisitor
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
visitVariableInstruction
in interface InstructionVisitor
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
visitConstantInstruction
in interface InstructionVisitor
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
visitExceptionInfo
in interface ExceptionInfoVisitor