类 MethodOptimizationInfo
- java.lang.Object
-
- proguard.optimize.info.MethodOptimizationInfo
-
- 直接已知子类:
ProgramMethodOptimizationInfo
public class MethodOptimizationInfo extends java.lang.ObjectThis class stores some optimization information that can be attached to a method.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected booleanhasNoEscapingParametersprotected booleanhasNoExternalReturnValuesprotected booleanhasNoExternalSideEffectsprotected booleanhasNoSideEffectsprotected proguard.evaluation.value.ValuereturnValue
-
构造器概要
构造器 构造器 说明 MethodOptimizationInfo()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 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.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.static MethodOptimizationInfogetMethodOptimizationInfo(proguard.classfile.Method method)Returns the MethodOptimizationInfo instance from the specified chain of linked methods.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.proguard.evaluation.value.ValuegetParameterValue(int parameterIndex)Returns a representation of the specified method parameter, or null if it is unknown.longgetReturnedParameters()Returns a mask of the reference parameters that the method might return.proguard.evaluation.value.ValuegetReturnValue()Returns a representation of the return value of the method, or null if it is unknown.longgetUsedParameters()Returns a mask with the parameters that the method actually uses.booleanhasNoEscapingParameters()Returns whether the method doesn't have escaping parameters.booleanhasNoExternalReturnValues()Returns whether the method returns external values.booleanhasNoExternalSideEffects()Retruns whether the method has no external side effects.booleanhasNoSideEffects()Specifies that the method has no side effects.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.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.booleanmodifiesAnything()Returns whether the method might modify objects that it can reach through static fields or instance fields.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.static voidsetMethodOptimizationInfo(proguard.classfile.Clazz clazz, proguard.classfile.Method method)Creates and sets a MethodOptimizationInfo instance on the specified chain of linked methods.voidsetNoEscapingParameters()Specifies that the method doesn't have escaping parameters.voidsetNoExternalReturnValues()Specifies that the method doesn't return external values.voidsetNoExternalSideEffects()Specifies that the method has no external side effects.voidsetNoSideEffects()Specifies that the method has no side effects.voidsetReturnValue(proguard.evaluation.value.Value returnValue)Specifies the return value of the method.
-
-
-
字段详细资料
-
hasNoSideEffects
protected boolean hasNoSideEffects
-
hasNoExternalSideEffects
protected boolean hasNoExternalSideEffects
-
hasNoEscapingParameters
protected boolean hasNoEscapingParameters
-
hasNoExternalReturnValues
protected boolean hasNoExternalReturnValues
-
returnValue
protected proguard.evaluation.value.Value returnValue
-
-
方法详细资料
-
isKept
public boolean isKept()
Returns whether the method is kept.
-
setNoSideEffects
public void setNoSideEffects()
Specifies that the method has no side effects. Side effects include changing static fields, changing instance fields, changing objects on the heap, calling other methods with side effects, etc.
-
hasNoSideEffects
public boolean hasNoSideEffects()
Specifies that the method has no side effects. Side effects include changing static fields, changing instance fields, changing objects on the heap, calling other methods with side effects, etc.
-
setNoExternalSideEffects
public void setNoExternalSideEffects()
Specifies that the method has no external side effects. External side effects include changing static fields and generally changing objects on the heap, but not changing fields of the instance on which the method is called (or the class, in case of static methods), or any instances that can only be reached through the instance. For example, the append methods of StringBuilder have side effects, but no external side effects.
-
hasNoExternalSideEffects
public boolean hasNoExternalSideEffects()
Retruns whether the method has no external side effects. External side effects include changing static fields and generally changing objects on the heap, but not changing fields of the instance on which the method is called (or the class, in case of static methods), or any instances that can only be reached through the instance. For example, StringBuilder#append has side effects, but no external side effects.
-
setNoEscapingParameters
public void setNoEscapingParameters()
Specifies that the method doesn't have escaping parameters. 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.
-
hasNoEscapingParameters
public boolean hasNoEscapingParameters()
Returns whether the method doesn't have escaping parameters. 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.
-
setNoExternalReturnValues
public void setNoExternalReturnValues()
Specifies that the method doesn't 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.
-
hasNoExternalReturnValues
public boolean hasNoExternalReturnValues()
Returns whether the method returns 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.
-
setReturnValue
public void setReturnValue(proguard.evaluation.value.Value returnValue)
Specifies the return value of the method.
-
getReturnValue
public proguard.evaluation.value.Value getReturnValue()
Returns a representation of the return value of the method, or null if it is unknown.
-
hasSideEffects
public boolean hasSideEffects()
Returns 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.
-
canBeMadePrivate
public boolean canBeMadePrivate()
Returns whether the method can be made private.
-
catchesExceptions
public boolean catchesExceptions()
Returns whether the method body contains any exception handlers.
-
branchesBackward
public boolean branchesBackward()
Returns whether the method body contains any backward branches.
-
invokesSuperMethods
public boolean invokesSuperMethods()
Returns whether the method body invokes any super methods.
-
invokesDynamically
public boolean invokesDynamically()
Returns whether the method body invokes any methods with 'invokedynamic'.
-
accessesPrivateCode
public boolean accessesPrivateCode()
Returns whether the method body accesses any private fields or methods.
-
accessesPackageCode
public boolean accessesPackageCode()
Returns whether the method body accesses any package visible fields or methods.
-
accessesProtectedCode
public boolean accessesProtectedCode()
Returns whether the method body accesses any protected fields or methods.
-
hasSynchronizedBlock
public boolean hasSynchronizedBlock()
Returns whether the method body contains any synchronization code ('monitorenter' and 'monitorexit').
-
assignsFinalField
public boolean assignsFinalField()
Returns whether the method body assigns any values to final fields.
-
returnsWithNonEmptyStack
public boolean returnsWithNonEmptyStack()
Returns whether the method body contains `return` instructions that leave a non-empty stack.
-
getInvocationCount
public int getInvocationCount()
Returns the number of times the method is invoked in the known code base.
-
getParameterSize
public int getParameterSize()
Returns 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.
-
hasUnusedParameters
public boolean hasUnusedParameters()
Returns whether the method has any unused parameters.
-
isParameterUsed
public boolean isParameterUsed(int variableIndex)
Returns 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()
Returns 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.
-
hasParameterEscaped
public boolean hasParameterEscaped(int parameterIndex)
Returns 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()
Returns 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.
-
isParameterEscaping
public boolean isParameterEscaping(int parameterIndex)
Returns 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()
Returns 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.
-
isParameterModified
public boolean isParameterModified(int parameterIndex)
Returns 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()
Returns 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.
-
modifiesAnything
public boolean modifiesAnything()
Returns whether the method might modify objects that it can reach through static fields or instance fields.
-
getParameterValue
public proguard.evaluation.value.Value getParameterValue(int parameterIndex)
Returns 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.
-
returnsParameter
public boolean returnsParameter(int parameterIndex)
Returns 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()
Returns 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.
-
returnsNewInstances
public boolean returnsNewInstances()
Returns whether the method might create and return new instances.
-
returnsExternalValues
public boolean returnsExternalValues()
Returns 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.
-
setMethodOptimizationInfo
public static void setMethodOptimizationInfo(proguard.classfile.Clazz clazz, proguard.classfile.Method method)Creates and sets a MethodOptimizationInfo instance on the specified chain of linked methods.
-
getMethodOptimizationInfo
public static MethodOptimizationInfo getMethodOptimizationInfo(proguard.classfile.Method method)
Returns the MethodOptimizationInfo instance from the specified chain of linked methods.
-
-