类 MethodOptimizationInfo

  • 直接已知子类:
    ProgramMethodOptimizationInfo

    public class MethodOptimizationInfo
    extends java.lang.Object
    This class stores some optimization information that can be attached to a method.
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      boolean accessesPackageCode()
      Returns whether the method body accesses any package visible fields or methods.
      boolean accessesPrivateCode()
      Returns whether the method body accesses any private fields or methods.
      boolean accessesProtectedCode()
      Returns whether the method body accesses any protected fields or methods.
      boolean assignsFinalField()
      Returns whether the method body assigns any values to final fields.
      boolean branchesBackward()
      Returns whether the method body contains any backward branches.
      boolean canBeMadePrivate()
      Returns whether the method can be made private.
      boolean catchesExceptions()
      Returns whether the method body contains any exception handlers.
      long getEscapedParameters()
      Returns a mask with the reference parameters have already escaped to the heap when entering the method.
      long getEscapingParameters()
      Returns a mask with the parameters that escape from the method.
      int getInvocationCount()
      Returns the number of times the method is invoked in the known code base.
      static MethodOptimizationInfo getMethodOptimizationInfo​(proguard.classfile.Method method)
      Returns the MethodOptimizationInfo instance from the specified chain of linked methods.
      long getModifiedParameters()
      Returns a mask of the reference parameters whose contents are modified in the method.
      int getParameterSize()
      Returns the size that the parameters of the method take up on the stack.
      proguard.evaluation.value.Value getParameterValue​(int parameterIndex)
      Returns a representation of the specified method parameter, or null if it is unknown.
      long getReturnedParameters()
      Returns a mask of the reference parameters that the method might return.
      proguard.evaluation.value.Value getReturnValue()
      Returns a representation of the return value of the method, or null if it is unknown.
      long getUsedParameters()
      Returns a mask with the parameters that the method actually uses.
      boolean hasNoEscapingParameters()
      Returns whether the method doesn't have escaping parameters.
      boolean hasNoExternalReturnValues()
      Returns whether the method returns external values.
      boolean hasNoExternalSideEffects()
      Retruns whether the method has no external side effects.
      boolean hasNoSideEffects()
      Specifies that the method has no side effects.
      boolean hasParameterEscaped​(int parameterIndex)
      Returns whether the specified reference parameter has already escaped to the heap when entering the method.
      boolean hasSideEffects()
      Returns whether the method has side effects.
      boolean hasSynchronizedBlock()
      Returns whether the method body contains any synchronization code ('monitorenter' and 'monitorexit').
      boolean hasUnusedParameters()
      Returns whether the method has any unused parameters.
      boolean invokesDynamically()
      Returns whether the method body invokes any methods with 'invokedynamic'.
      boolean invokesSuperMethods()
      Returns whether the method body invokes any super methods.
      boolean isKept()
      Returns whether the method is kept.
      boolean isParameterEscaping​(int parameterIndex)
      Returns whether the specified parameter escapes from the method.
      boolean isParameterModified​(int parameterIndex)
      Returns whether the contents of the specified reference parameter are modified in the method.
      boolean isParameterUsed​(int variableIndex)
      Returns whether the method actually uses the specified parameter.
      boolean modifiesAnything()
      Returns whether the method might modify objects that it can reach through static fields or instance fields.
      boolean returnsExternalValues()
      Returns whether the method might return external values.
      boolean returnsNewInstances()
      Returns whether the method might create and return new instances.
      boolean returnsParameter​(int parameterIndex)
      Returns whether the method might return the specified reference parameter as its result.
      boolean returnsWithNonEmptyStack()
      Returns whether the method body contains `return` instructions that leave a non-empty stack.
      static void setMethodOptimizationInfo​(proguard.classfile.Clazz clazz, proguard.classfile.Method method)
      Creates and sets a MethodOptimizationInfo instance on the specified chain of linked methods.
      void setNoEscapingParameters()
      Specifies that the method doesn't have escaping parameters.
      void setNoExternalReturnValues()
      Specifies that the method doesn't return external values.
      void setNoExternalSideEffects()
      Specifies that the method has no external side effects.
      void setNoSideEffects()
      Specifies that the method has no side effects.
      void setReturnValue​(proguard.evaluation.value.Value returnValue)
      Specifies the return value of the method.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • hasNoSideEffects

        protected boolean hasNoSideEffects
      • hasNoExternalSideEffects

        protected boolean hasNoExternalSideEffects
      • hasNoEscapingParameters

        protected boolean hasNoEscapingParameters
      • hasNoExternalReturnValues

        protected boolean hasNoExternalReturnValues
      • returnValue

        protected proguard.evaluation.value.Value returnValue
    • 构造器详细资料

      • MethodOptimizationInfo

        public MethodOptimizationInfo()
    • 方法详细资料

      • 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.