类 PartialEvaluator
- java.lang.Object
-
- proguard.evaluation.PartialEvaluator
-
- 所有已实现的接口:
AttributeVisitor,ExceptionInfoVisitor
public class PartialEvaluator extends java.lang.Object implements AttributeVisitor, ExceptionInfoVisitor
ThisAttributeVisitorperforms partial evaluation on the code attributes that it visits.
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classPartialEvaluator.Builderstatic classPartialEvaluator.InstructionBlockThis class represents an instruction block that has to be executed, starting with a given state at a given instruction offset.
-
字段概要
字段 修饰符和类型 字段 说明 static intAT_CATCH_ENTRYstatic intAT_METHOD_ENTRYstatic booleanENABLE_NEW_EXCEPTIONSEnables new exceptions to be thrown during evaluation.static intNONE
-
构造器概要
构造器 构造器 说明 PartialEvaluator()Creates a simple PartialEvaluator.PartialEvaluator(ValueFactory valueFactory)Creates a new PartialEvaluator.PartialEvaluator(ValueFactory valueFactory, InvocationUnit invocationUnit, boolean evaluateAllCode)Creates a new PartialEvaluator.PartialEvaluator(ValueFactory valueFactory, InvocationUnit invocationUnit, boolean evaluateAllCode, InstructionVisitor extraInstructionVisitor)Creates a new PartialEvaluator.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 InstructionOffsetValuebranchOrigins(int instructionOffset)Returns the instruction offsets that branch to the given instruction offset.InstructionOffsetValuebranchTargets(int instructionOffset)Returns the instruction offsets to which the given instruction offset branches.TracedStackgetStackAfter(int instructionOffset)Returns the stack after execution of the instruction at the given offset.TracedStackgetStackBefore(int instructionOffset)Returns the stack before execution of the instruction at the given offset.TracedVariablesgetVariablesAfter(int instructionOffset)Returns the variables after execution of the instruction at the given offset.TracedVariablesgetVariablesBefore(int instructionOffset)Returns the variables before execution of the instruction at the given offset.booleanisBranchOrExceptionTarget(int instructionOffset)Returns whether the instruction at the given offset is the target of a branch instruction or an exception.booleanisBranchOrigin(int instructionOffset)Returns whether the instruction at the given offset is the origin of a branch instruction.booleanisBranchTarget(int instructionOffset)Returns whether the instruction at the given offset is the target of a branch instruction.booleanisCreation(int offset)Returns whether the instruction at the given offset creates a new, uninitialized instance.booleanisExceptionHandler(int instructionOffset)Returns whether the instruction at the given offset is the start of an exception handler.booleanisInitializer(int offset)Returns whether the instruction at the given offset is the special invocation of an instance initializer.booleanisInstruction(int instructionOffset)Returns whether there is an instruction at the given offset.booleanisSubroutine(int instructionOffset)Returns whether the instruction at the given offset is part of a subroutine.booleanisSubroutineInvocation(int instructionOffset)Returns whether the instruction at the given offset is a subroutine invocation.booleanisSubroutineReturning(int instructionOffset)Returns whether the subroutine at the given offset is ever returning by means of a regular 'ret' instruction.booleanisSubroutineStart(int instructionOffset)Returns whether the instruction at the given offset is the start of a subroutine.booleanisTarget(int instructionOffset)Returns whether the instruction at the given offset is the target of any kind.booleanisTraced(int instructionOffset)Returns whether the instruction at the given offset has ever been executed during the partial evaluation.booleanisTraced(int startOffset, int endOffset)Returns whether a block of instructions is ever used.PartialEvaluatorstopAnalysisAfterNEvaluations(int stopAnalysisAfterNEvaluations)It the analysis visits an instruction this many times (this can happen e.g. for big switches), the analysis of this method is forcibly stopped and a ExcessiveComplexityException is thrown.intsubroutineEnd(int instructionOffset)Returns the offset after the subroutine that starts at the given offset.InstructionVisitortracedInstructionFilter(boolean traced, InstructionVisitor instructionVisitor)Returns a filtering version of the given instruction visitor that only visits traced or untraced instructions.InstructionVisitortracedInstructionFilter(InstructionVisitor instructionVisitor)Returns a filtering version of the given instruction visitor that only visits traced instructions.voidvisitAnyAttribute(Clazz clazz, Attribute attribute)Visits any Attribute instance.voidvisitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)voidvisitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)voidvisitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 proguard.classfile.attribute.visitor.AttributeVisitor
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
-
-
-
-
字段详细资料
-
ENABLE_NEW_EXCEPTIONS
public static boolean ENABLE_NEW_EXCEPTIONS
Enables new exceptions to be thrown during evaluation. These are exceptions that are not thrown by the original ProGuard code. This is a temporary flag to allow the new exceptions to be tested. TODO: Remove this flag when the new exceptions are stable and will not break any dependent code.
-
NONE
public static final int NONE
- 另请参阅:
- 常量字段值
-
AT_METHOD_ENTRY
public static final int AT_METHOD_ENTRY
- 另请参阅:
- 常量字段值
-
AT_CATCH_ENTRY
public static final int AT_CATCH_ENTRY
- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
PartialEvaluator
public PartialEvaluator()
Creates a simple PartialEvaluator.
-
PartialEvaluator
public PartialEvaluator(ValueFactory valueFactory)
Creates a new PartialEvaluator.- 参数:
valueFactory- the value factory that will create all values during evaluation.
-
PartialEvaluator
public PartialEvaluator(ValueFactory valueFactory, InvocationUnit invocationUnit, boolean evaluateAllCode)
Creates a new PartialEvaluator.- 参数:
valueFactory- the value factory that will create all values during the evaluation.invocationUnit- the invocation unit that will handle all communication with other fields and methods.evaluateAllCode- a flag that specifies whether all casts, branch targets, and exception handlers should be evaluated, even if they are unnecessary or unreachable.
-
PartialEvaluator
public PartialEvaluator(ValueFactory valueFactory, InvocationUnit invocationUnit, boolean evaluateAllCode, InstructionVisitor extraInstructionVisitor)
Creates a new PartialEvaluator.- 参数:
valueFactory- the value factory that will create all values during the evaluation.invocationUnit- the invocation unit that will handle all communication with other fields and methods.evaluateAllCode- a flag that specifies whether all branch targets and exception handlers should be evaluated, even if they are unreachable.extraInstructionVisitor- an optional extra visitor for all instructions right before they are executed.
-
-
方法详细资料
-
visitAnyAttribute
public void visitAnyAttribute(Clazz clazz, Attribute attribute)
从接口复制的说明:AttributeVisitorVisits any Attribute instance. The more specific default implementations of this interface delegate to this method.- 指定者:
visitAnyAttribute在接口中AttributeVisitor
-
visitCodeAttribute
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- 指定者:
visitCodeAttribute在接口中AttributeVisitor
-
visitCodeAttribute0
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)
-
isTraced
public boolean isTraced(int startOffset, int endOffset)Returns whether a block of instructions is ever used.
-
isTraced
public boolean isTraced(int instructionOffset)
Returns whether the instruction at the given offset has ever been executed during the partial evaluation.
-
isInstruction
public boolean isInstruction(int instructionOffset)
Returns whether there is an instruction at the given offset.
-
isTarget
public boolean isTarget(int instructionOffset)
Returns whether the instruction at the given offset is the target of any kind.
-
isBranchOrigin
public boolean isBranchOrigin(int instructionOffset)
Returns whether the instruction at the given offset is the origin of a branch instruction.
-
isBranchTarget
public boolean isBranchTarget(int instructionOffset)
Returns whether the instruction at the given offset is the target of a branch instruction.
-
isBranchOrExceptionTarget
public boolean isBranchOrExceptionTarget(int instructionOffset)
Returns whether the instruction at the given offset is the target of a branch instruction or an exception.
-
isExceptionHandler
public boolean isExceptionHandler(int instructionOffset)
Returns whether the instruction at the given offset is the start of an exception handler.
-
isSubroutineStart
public boolean isSubroutineStart(int instructionOffset)
Returns whether the instruction at the given offset is the start of a subroutine.
-
isSubroutineInvocation
public boolean isSubroutineInvocation(int instructionOffset)
Returns whether the instruction at the given offset is a subroutine invocation.
-
isSubroutine
public boolean isSubroutine(int instructionOffset)
Returns whether the instruction at the given offset is part of a subroutine.
-
isSubroutineReturning
public boolean isSubroutineReturning(int instructionOffset)
Returns whether the subroutine at the given offset is ever returning by means of a regular 'ret' instruction.
-
subroutineEnd
public int subroutineEnd(int instructionOffset)
Returns the offset after the subroutine that starts at the given offset.
-
isCreation
public boolean isCreation(int offset)
Returns whether the instruction at the given offset creates a new, uninitialized instance.
-
isInitializer
public boolean isInitializer(int offset)
Returns whether the instruction at the given offset is the special invocation of an instance initializer.
-
getVariablesBefore
public TracedVariables getVariablesBefore(int instructionOffset)
Returns the variables before execution of the instruction at the given offset.
-
getVariablesAfter
public TracedVariables getVariablesAfter(int instructionOffset)
Returns the variables after execution of the instruction at the given offset.
-
getStackBefore
public TracedStack getStackBefore(int instructionOffset)
Returns the stack before execution of the instruction at the given offset.
-
getStackAfter
public TracedStack getStackAfter(int instructionOffset)
Returns the stack after execution of the instruction at the given offset.
-
branchOrigins
public InstructionOffsetValue branchOrigins(int instructionOffset)
Returns the instruction offsets that branch to the given instruction offset.
-
branchTargets
public InstructionOffsetValue branchTargets(int instructionOffset)
Returns the instruction offsets to which the given instruction offset branches.
-
tracedInstructionFilter
public InstructionVisitor tracedInstructionFilter(InstructionVisitor instructionVisitor)
Returns a filtering version of the given instruction visitor that only visits traced instructions.
-
tracedInstructionFilter
public InstructionVisitor tracedInstructionFilter(boolean traced, InstructionVisitor instructionVisitor)
Returns a filtering version of the given instruction visitor that only visits traced or untraced instructions.
-
visitExceptionInfo
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- 指定者:
visitExceptionInfo在接口中ExceptionInfoVisitor
-
stopAnalysisAfterNEvaluations
public PartialEvaluator stopAnalysisAfterNEvaluations(int stopAnalysisAfterNEvaluations)
It the analysis visits an instruction this many times (this can happen e.g. for big switches), the analysis of this method is forcibly stopped and a ExcessiveComplexityException is thrown.
-
-