类 ProgramMethodOptimizationInfo
- java.lang.Object
-
- proguard.optimize.info.MethodOptimizationInfo
-
- proguard.optimize.info.ProgramMethodOptimizationInfo
-
public class ProgramMethodOptimizationInfo extends MethodOptimizationInfo
This class stores some optimization information that can be attached to a method that can be analyzed in detail.
-
-
字段概要
-
从类继承的字段 proguard.optimize.info.MethodOptimizationInfo
hasNoEscapingParameters, hasNoExternalReturnValues, hasNoExternalSideEffects, hasNoSideEffects, returnValue
-
-
构造器概要
构造器 构造器 说明 ProgramMethodOptimizationInfo(proguard.classfile.Clazz clazz, proguard.classfile.Method method)Creates a new MethodOptimizationInfo for the given method.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanaccessesPackageCode()Returns whether the method body accesses any package visible fields or methods.booleanaccessesPrivateCode()Returns whether the method body accesses any private fields or methods.booleanaccessesProtectedCode()Returns whether the method body accesses any protected fields or methods.booleanassignsFinalField()Returns whether the method body assigns any values to final fields.booleanbranchesBackward()Returns whether the method body contains any backward branches.booleancanBeMadePrivate()Returns whether the method can be made private.booleancatchesExceptions()Returns whether the method body contains any exception handlers.voidgeneralizeParameterValue(int parameterIndex, proguard.evaluation.value.Value parameter)Specifies a possible representation of the specified method parameter.voidgeneralizeReturnValue(proguard.evaluation.value.Value returnValue)Specifies a representation of the value that the method returns, or null if it is unknown.longgetEscapedParameters()Returns a mask with the reference parameters have already escaped to the heap when entering the method.longgetEscapingParameters()Returns a mask with the parameters that escape from the method.intgetInvocationCount()Returns the number of times the method is invoked in the known code base.longgetModifiedParameters()Returns a mask of the reference parameters whose contents are modified in the method.intgetParameterSize()Returns the size that the parameters of the method take up on the stack.intgetParameterSize(int parameterIndex)Returns the stack size of the parameter at the given index.proguard.evaluation.value.ValuegetParameterValue(int parameterIndex)Returns a representation of the specified method parameter, or null if it is unknown.static ProgramMethodOptimizationInfogetProgramMethodOptimizationInfo(proguard.classfile.Method method)Returns the ProgramMethodOptimizationInfo instance from the specified chain of linked methods.longgetReturnedParameters()Returns a mask of the reference parameters that the method might return.longgetUsedParameters()Returns a mask with the parameters that the method actually uses.booleanhasParameterEscaped(int parameterIndex)Returns whether the specified reference parameter has already escaped to the heap when entering the method.booleanhasSideEffects()Returns whether the method has side effects.booleanhasSynchronizedBlock()Returns whether the method body contains any synchronization code ('monitorenter' and 'monitorexit').booleanhasUnusedParameters()Returns whether the method has any unused parameters.voidincrementInvocationCount()Increments the counter for number of times the method is invoked in the known code base.voidinsertParameter(int parameterIndex, int stackSize)Notifies this object that a parameter is inserted at the given index with the given stack size.booleaninvokesDynamically()Returns whether the method body invokes any methods with 'invokedynamic'.booleaninvokesSuperMethods()Returns whether the method body invokes any super methods.booleanisKept()Returns whether the method is kept.booleanisParameterEscaping(int parameterIndex)Returns whether the specified parameter escapes from the method.booleanisParameterModified(int parameterIndex)Returns whether the contents of the specified reference parameter are modified in the method.booleanisParameterUsed(int variableIndex)Returns whether the method actually uses the specified parameter.voidmerge(MethodOptimizationInfo other)Merges in the given information of a method that is inlined.booleanmodifiesAnything()Returns whether the method might modify objects that it can reach through static fields or instance fields.voidremoveParameter(int parameterIndex)Notifies this object that the specified parameter is removed.booleanreturnsExternalValues()Returns whether the method might return external values.booleanreturnsNewInstances()Returns whether the method might create and return new instances.booleanreturnsParameter(int parameterIndex)Returns whether the method might return the specified reference parameter as its result.booleanreturnsWithNonEmptyStack()Returns whether the method body contains `return` instructions that leave a non-empty stack.voidsetAccessesPackageCode()Specifies that the method body accesses package visible fields or methods.voidsetAccessesPrivateCode()Specifies that the method body accesses private fields or methods.voidsetAccessesProtectedCode()Specifies that the method body accesses protected fields or methods.voidsetAssignsFinalField()Specifies that the method body assigns values to final fields.voidsetBranchesBackward()Specifies that the method body contains backward branches.voidsetCanNotBeMadePrivate()Specifies that the method can't be made private.voidsetCatchesExceptions()Specifies that the method body contains exception handlers.voidsetHasSynchronizedBlock()Specifies that the method body contains synchronization code ('monitorenter' and 'monitorexit').voidsetInvokesDynamically()Specifies that the method body invokes methods with 'invokedynamic'.voidsetInvokesSuperMethods()Specifies that the method body invokes super methods.voidsetModifiesAnything()Specifies that the method might modify objects that it can reach through static fields or instance fields.voidsetParameterEscaped(int parameterIndex)Specifies that the specified reference parameter has already escaped to the heap when entering the method.voidsetParameterEscaping(int parameterIndex)Specifies that the specified parameter escapes from the method.voidsetParameterModified(int parameterIndex)Specifies that the contents of the specified reference parameter are modified in the method.voidsetParameterReturned(int parameterIndex)Specifies that the method might return the specified reference parameter as its result.voidsetParameterSize(int parameterSize)Specifies the size that the parameters of the method take up on the stack.voidsetParameterUsed(int variableIndex)Specifies that the method actually uses the specified parameter.static voidsetProgramMethodOptimizationInfo(proguard.classfile.Clazz clazz, proguard.classfile.Method method)Creates and sets a ProgramMethodOptimizationInfo instance on the specified chain of linked methods.voidsetReturnsExternalValues()Specifies that the method might return external values.voidsetReturnsNewInstances()Specifies that the method might create and return new instances.voidsetReturnsWithNonEmptyStack()Specifies that the method body contains `return` instructions that leave a non-empty stack.voidsetSideEffects()Specifies that the method has side effects.voidupdateEscapedParameters(long escapedParameters)Specifies a mask with the reference parameters have already escaped to the heap when entering the method.voidupdateEscapingParameters(long escapingParameters)Specifies a mask with the parameters that escape from the method.voidupdateModifiedParameters(long modifiedParameters)Specifies a mask of the reference parameters whose contents are modified in the method.voidupdateReturnedParameters(long returnedParameters)Specifies a mask of the reference parameters that the method might return.voidupdateUsedParameters(long usedParameters)Specifies a mask with the parameters that the method actually uses.-
从类继承的方法 proguard.optimize.info.MethodOptimizationInfo
getMethodOptimizationInfo, getReturnValue, hasNoEscapingParameters, hasNoExternalReturnValues, hasNoExternalSideEffects, hasNoSideEffects, setMethodOptimizationInfo, setNoEscapingParameters, setNoExternalReturnValues, setNoExternalSideEffects, setNoSideEffects, setReturnValue
-
-
-
-
方法详细资料
-
isKept
public boolean isKept()
从类复制的说明:MethodOptimizationInfoReturns whether the method is kept.- 覆盖:
isKept在类中MethodOptimizationInfo
-
setSideEffects
public void setSideEffects()
Specifies that the method has side effects. Side effects include changing static fields, changing instance fields, changing objects on the heap, calling other methods with side effects, etc. The methodMethodOptimizationInfo.setNoSideEffects()gets precedence.
-
hasSideEffects
public boolean hasSideEffects()
从类复制的说明:MethodOptimizationInfoReturns whether the method has side effects. Side effects include changing static fields, changing instance fields, changing objects on the heap, calling other methods with side effects, etc.- 覆盖:
hasSideEffects在类中MethodOptimizationInfo
-
setCanNotBeMadePrivate
public void setCanNotBeMadePrivate()
Specifies that the method can't be made private.
-
canBeMadePrivate
public boolean canBeMadePrivate()
从类复制的说明:MethodOptimizationInfoReturns whether the method can be made private.
-
setCatchesExceptions
public void setCatchesExceptions()
Specifies that the method body contains exception handlers.
-
catchesExceptions
public boolean catchesExceptions()
从类复制的说明:MethodOptimizationInfoReturns whether the method body contains any exception handlers.
-
setBranchesBackward
public void setBranchesBackward()
Specifies that the method body contains backward branches.
-
branchesBackward
public boolean branchesBackward()
从类复制的说明:MethodOptimizationInfoReturns whether the method body contains any backward branches.
-
setInvokesSuperMethods
public void setInvokesSuperMethods()
Specifies that the method body invokes super methods.
-
invokesSuperMethods
public boolean invokesSuperMethods()
从类复制的说明:MethodOptimizationInfoReturns whether the method body invokes any super methods.
-
setInvokesDynamically
public void setInvokesDynamically()
Specifies that the method body invokes methods with 'invokedynamic'.
-
invokesDynamically
public boolean invokesDynamically()
从类复制的说明:MethodOptimizationInfoReturns whether the method body invokes any methods with 'invokedynamic'.
-
setAccessesPrivateCode
public void setAccessesPrivateCode()
Specifies that the method body accesses private fields or methods.
-
accessesPrivateCode
public boolean accessesPrivateCode()
从类复制的说明:MethodOptimizationInfoReturns whether the method body accesses any private fields or methods.
-
setAccessesPackageCode
public void setAccessesPackageCode()
Specifies that the method body accesses package visible fields or methods.
-
accessesPackageCode
public boolean accessesPackageCode()
从类复制的说明:MethodOptimizationInfoReturns whether the method body accesses any package visible fields or methods.
-
setAccessesProtectedCode
public void setAccessesProtectedCode()
Specifies that the method body accesses protected fields or methods.
-
accessesProtectedCode
public boolean accessesProtectedCode()
从类复制的说明:MethodOptimizationInfoReturns whether the method body accesses any protected fields or methods.
-
setHasSynchronizedBlock
public void setHasSynchronizedBlock()
Specifies that the method body contains synchronization code ('monitorenter' and 'monitorexit').
-
hasSynchronizedBlock
public boolean hasSynchronizedBlock()
从类复制的说明:MethodOptimizationInfoReturns whether the method body contains any synchronization code ('monitorenter' and 'monitorexit').
-
setAssignsFinalField
public void setAssignsFinalField()
Specifies that the method body assigns values to final fields.
-
assignsFinalField
public boolean assignsFinalField()
从类复制的说明:MethodOptimizationInfoReturns whether the method body assigns any values to final fields.
-
setReturnsWithNonEmptyStack
public void setReturnsWithNonEmptyStack()
Specifies that the method body contains `return` instructions that leave a non-empty stack.
-
returnsWithNonEmptyStack
public boolean returnsWithNonEmptyStack()
从类复制的说明:MethodOptimizationInfoReturns whether the method body contains `return` instructions that leave a non-empty stack.
-
incrementInvocationCount
public void incrementInvocationCount()
Increments the counter for number of times the method is invoked in the known code base.
-
getInvocationCount
public int getInvocationCount()
从类复制的说明:MethodOptimizationInfoReturns the number of times the method is invoked in the known code base.
-
setParameterSize
public void setParameterSize(int parameterSize)
Specifies the size that the parameters of the method take up on the stack. The size takes into account long and double parameters taking up two entries.
-
getParameterSize
public int getParameterSize()
从类复制的说明:MethodOptimizationInfoReturns the size that the parameters of the method take up on the stack. The size takes into account long and double parameters taking up two entries.
-
getParameterSize
public int getParameterSize(int parameterIndex)
Returns the stack size of the parameter at the given index.
-
setParameterUsed
public void setParameterUsed(int variableIndex)
Specifies that the method actually uses the specified parameter. The variable index takes into account long and double parameters taking up two entries.
-
updateUsedParameters
public void updateUsedParameters(long usedParameters)
Specifies a mask with the parameters that the method actually uses. The indices are variable indices of the variables. They take into account long and double parameters taking up two entries.
-
hasUnusedParameters
public boolean hasUnusedParameters()
从类复制的说明:MethodOptimizationInfoReturns whether the method has any unused parameters.
-
isParameterUsed
public boolean isParameterUsed(int variableIndex)
从类复制的说明:MethodOptimizationInfoReturns whether the method actually uses the specified parameter. The variable index takes into account long and double parameters taking up two entries.
-
getUsedParameters
public long getUsedParameters()
从类复制的说明:MethodOptimizationInfoReturns a mask with the parameters that the method actually uses. The indices are variable indices of the variables. They take into account long and double parameters taking up two entries.
-
insertParameter
public void insertParameter(int parameterIndex, int stackSize)Notifies this object that a parameter is inserted at the given index with the given stack size.- 参数:
parameterIndex- the parameter index, not taking into account the entry size, but taking into account the 'this' parameter, if any.stackSize- the stack size that is occupied by the inserted parameter.
-
removeParameter
public void removeParameter(int parameterIndex)
Notifies this object that the specified parameter is removed.- 参数:
parameterIndex- the parameter index, not taking into account the entry size, but taking into account the 'this' parameter, if any.
-
setParameterEscaped
public void setParameterEscaped(int parameterIndex)
Specifies that the specified reference parameter has already escaped to the heap when entering the method. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
updateEscapedParameters
public void updateEscapedParameters(long escapedParameters)
Specifies a mask with the reference parameters have already escaped to the heap when entering the method. The parameter indices are based on the method descriptor, with each with each parameter having the same size.
-
hasParameterEscaped
public boolean hasParameterEscaped(int parameterIndex)
从类复制的说明:MethodOptimizationInfoReturns whether the specified reference parameter has already escaped to the heap when entering the method. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
getEscapedParameters
public long getEscapedParameters()
从类复制的说明:MethodOptimizationInfoReturns a mask with the reference parameters have already escaped to the heap when entering the method. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
setParameterEscaping
public void setParameterEscaping(int parameterIndex)
Specifies that the specified parameter escapes from the method. An escaping parameter is a reference parameter that the method has made reachable on the heap after the method has exited. For example, System#setProperty and Set#add let their parameters escape, because they become reachable. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
updateEscapingParameters
public void updateEscapingParameters(long escapingParameters)
Specifies a mask with the parameters that escape from the method. Escaping parameters are reference parameters that the method has made reachable on the heap after the method has exited. For example, System#setProperty and Set#add let their parameters escape, because they become reachable. The parameter indices are based on the method descriptor, with each with each parameter having the same size.
-
isParameterEscaping
public boolean isParameterEscaping(int parameterIndex)
从类复制的说明:MethodOptimizationInfoReturns whether the specified parameter escapes from the method. An escaping parameter is a reference parameter that the method has made reachable on the heap after the method has exited. For example, System#setProperty and Set#add let their parameters escape, because they become reachable. The parameter index is based on the method descriptor, with each with each parameter having the same size.
-
getEscapingParameters
public long getEscapingParameters()
从类复制的说明:MethodOptimizationInfoReturns a mask with the parameters that escape from the method. Escaping parameters are reference parameters that the method has made reachable on the heap after the method has exited. For example, System#setProperty and Set#add let their parameters escape, because they become reachable. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
setParameterModified
public void setParameterModified(int parameterIndex)
Specifies that the contents of the specified reference parameter are modified in the method. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size. The methodsMethodOptimizationInfo.setNoSideEffects()andMethodOptimizationInfo.setNoExternalSideEffects()get precedence.
-
updateModifiedParameters
public void updateModifiedParameters(long modifiedParameters)
Specifies a mask of the reference parameters whose contents are modified in the method. The parameter indices are based on the method descriptor, with each with each parameter having the same size. The methodsMethodOptimizationInfo.setNoSideEffects()andMethodOptimizationInfo.setNoExternalSideEffects()get precedence.
-
isParameterModified
public boolean isParameterModified(int parameterIndex)
从类复制的说明:MethodOptimizationInfoReturns whether the contents of the specified reference parameter are modified in the method. The parameter index is based on the method descriptor, with each with each parameter having the same size.
-
getModifiedParameters
public long getModifiedParameters()
从类复制的说明:MethodOptimizationInfoReturns a mask of the reference parameters whose contents are modified in the method. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
setModifiesAnything
public void setModifiesAnything()
Specifies that the method might modify objects that it can reach through static fields or instance fields. The methodMethodOptimizationInfo.setNoExternalSideEffects()gets precedence.
-
modifiesAnything
public boolean modifiesAnything()
从类复制的说明:MethodOptimizationInfoReturns whether the method might modify objects that it can reach through static fields or instance fields.
-
generalizeParameterValue
public void generalizeParameterValue(int parameterIndex, proguard.evaluation.value.Value parameter)Specifies a possible representation of the specified method parameter. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
getParameterValue
public proguard.evaluation.value.Value getParameterValue(int parameterIndex)
从类复制的说明:MethodOptimizationInfoReturns a representation of the specified method parameter, or null if it is unknown. The parameter index is based on the method descriptor, with each with each parameter having the same size.
-
setParameterReturned
public void setParameterReturned(int parameterIndex)
Specifies that the method might return the specified reference parameter as its result. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
updateReturnedParameters
public void updateReturnedParameters(long returnedParameters)
Specifies a mask of the reference parameters that the method might return. The parameter indices are based on the method descriptor, with each with each parameter having the same size.
-
returnsParameter
public boolean returnsParameter(int parameterIndex)
从类复制的说明:MethodOptimizationInfoReturns whether the method might return the specified reference parameter as its result. The parameter index is based on the method descriptor, with each with each parameter having the same size.
-
getReturnedParameters
public long getReturnedParameters()
从类复制的说明:MethodOptimizationInfoReturns a mask of the reference parameters that the method might return. The parameter index is based on the method descriptor, including 'this', with each parameter having the same size.
-
setReturnsNewInstances
public void setReturnsNewInstances()
Specifies that the method might create and return new instances.
-
returnsNewInstances
public boolean returnsNewInstances()
从类复制的说明:MethodOptimizationInfoReturns whether the method might create and return new instances.
-
setReturnsExternalValues
public void setReturnsExternalValues()
Specifies that the method might return external values. External return values are reference values that originate from the heap, but not parameters or new instances. For example, Map#get has external return values, but StringBuilder#toString has no external return values. The methodMethodOptimizationInfo.setNoExternalReturnValues()gets precedence.
-
returnsExternalValues
public boolean returnsExternalValues()
从类复制的说明:MethodOptimizationInfoReturns whether the method might return external values. External return values are reference values that originate from the heap, but not parameters or new instances. For example, Map#get has external return values, but StringBuilder#toString has no external return values.
-
generalizeReturnValue
public void generalizeReturnValue(proguard.evaluation.value.Value returnValue)
Specifies a representation of the value that the method returns, or null if it is unknown.
-
merge
public void merge(MethodOptimizationInfo other)
Merges in the given information of a method that is inlined.
-
setProgramMethodOptimizationInfo
public static void setProgramMethodOptimizationInfo(proguard.classfile.Clazz clazz, proguard.classfile.Method method)Creates and sets a ProgramMethodOptimizationInfo instance on the specified chain of linked methods.
-
getProgramMethodOptimizationInfo
public static ProgramMethodOptimizationInfo getProgramMethodOptimizationInfo(proguard.classfile.Method method)
Returns the ProgramMethodOptimizationInfo instance from the specified chain of linked methods.
-
-