类 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.
    • 构造器详细资料

      • ProgramMethodOptimizationInfo

        public ProgramMethodOptimizationInfo​(proguard.classfile.Clazz clazz,
                                             proguard.classfile.Method method)
        Creates a new MethodOptimizationInfo for the given method.
    • 方法详细资料

      • 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 method MethodOptimizationInfo.setNoSideEffects() gets precedence.
      • hasSideEffects

        public boolean hasSideEffects()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        hasSideEffects 在类中 MethodOptimizationInfo
      • setCanNotBeMadePrivate

        public void setCanNotBeMadePrivate()
        Specifies that the method can't be made private.
      • setCatchesExceptions

        public void setCatchesExceptions()
        Specifies that the method body contains exception handlers.
      • setBranchesBackward

        public void setBranchesBackward()
        Specifies that the method body contains backward branches.
      • setInvokesSuperMethods

        public void setInvokesSuperMethods()
        Specifies that the method body invokes super methods.
      • setInvokesDynamically

        public void setInvokesDynamically()
        Specifies that the method body invokes methods with 'invokedynamic'.
      • setAccessesPrivateCode

        public void setAccessesPrivateCode()
        Specifies that the method body accesses private fields or methods.
      • setAccessesPackageCode

        public void setAccessesPackageCode()
        Specifies that the method body accesses package visible fields or methods.
      • setAccessesProtectedCode

        public void setAccessesProtectedCode()
        Specifies that the method body accesses protected fields or methods.
      • setHasSynchronizedBlock

        public void setHasSynchronizedBlock()
        Specifies that the method body contains synchronization code ('monitorenter' and 'monitorexit').
      • setAssignsFinalField

        public void setAssignsFinalField()
        Specifies that the method body assigns values to final fields.
      • setReturnsWithNonEmptyStack

        public void setReturnsWithNonEmptyStack()
        Specifies that 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.
      • 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()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getParameterSize 在类中 MethodOptimizationInfo
      • 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.
      • isParameterUsed

        public boolean isParameterUsed​(int variableIndex)
        从类复制的说明: MethodOptimizationInfo
        Returns whether the method actually uses the specified parameter. The variable index takes into account long and double parameters taking up two entries.
        覆盖:
        isParameterUsed 在类中 MethodOptimizationInfo
      • getUsedParameters

        public long getUsedParameters()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getUsedParameters 在类中 MethodOptimizationInfo
      • 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)
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        hasParameterEscaped 在类中 MethodOptimizationInfo
      • getEscapedParameters

        public long getEscapedParameters()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getEscapedParameters 在类中 MethodOptimizationInfo
      • 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)
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        isParameterEscaping 在类中 MethodOptimizationInfo
      • getEscapingParameters

        public long getEscapingParameters()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getEscapingParameters 在类中 MethodOptimizationInfo
      • isParameterModified

        public boolean isParameterModified​(int parameterIndex)
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        isParameterModified 在类中 MethodOptimizationInfo
      • getModifiedParameters

        public long getModifiedParameters()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getModifiedParameters 在类中 MethodOptimizationInfo
      • 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)
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getParameterValue 在类中 MethodOptimizationInfo
      • 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)
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        returnsParameter 在类中 MethodOptimizationInfo
      • getReturnedParameters

        public long getReturnedParameters()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        getReturnedParameters 在类中 MethodOptimizationInfo
      • setReturnsNewInstances

        public void setReturnsNewInstances()
        Specifies that 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 method MethodOptimizationInfo.setNoExternalReturnValues() gets precedence.
      • returnsExternalValues

        public boolean returnsExternalValues()
        从类复制的说明: MethodOptimizationInfo
        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.
        覆盖:
        returnsExternalValues 在类中 MethodOptimizationInfo
      • 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.