Class ValueNumberFrameModelingVisitor

    • Field Detail

      • methodGen

        private final org.apache.bcel.generic.MethodGen methodGen
      • constantValueMap

        private final java.util.HashMap<java.lang.Object,​ValueNumber> constantValueMap
      • stringConstantMap

        private final java.util.HashMap<ValueNumber,​java.lang.String> stringConstantMap
      • handle

        private org.apache.bcel.generic.InstructionHandle handle
      • EMPTY_INPUT_VALUE_LIST

        private static final ValueNumber[] EMPTY_INPUT_VALUE_LIST
    • Constructor Detail

      • ValueNumberFrameModelingVisitor

        public ValueNumberFrameModelingVisitor​(org.apache.bcel.generic.MethodGen methodGen,
                                               ValueNumberFactory factory,
                                               ValueNumberCache cache,
                                               LoadedFieldSet loadedFieldSet,
                                               RepositoryLookupFailureCallback lookupFailureCallback)
        Constructor.
        Parameters:
        methodGen - the method being analyzed
        factory - factory for ValueNumbers for the method
        cache - cache of input/output transformations for each instruction
        loadedFieldSet - fields loaded/stored by each instruction and entire method
        lookupFailureCallback - callback to use to report class lookup failures
    • Method Detail

      • setHandle

        public void setHandle​(org.apache.bcel.generic.InstructionHandle handle)
        Set the instruction handle of the instruction currently being visited. This must be called before the instruction accepts this visitor!
      • doRedundantLoadElimination

        private boolean doRedundantLoadElimination()
        Determine whether redundant load elimination should be performed for the heap location referenced by the current instruction.
        Returns:
        true if we should do redundant load elimination for the current instruction, false if not
      • doForwardSubstitution

        private boolean doForwardSubstitution()
        Determine whether forward substitution should be performed for the heap location referenced by the current instruction.
        Returns:
        true if we should do forward substitution for the current instruction, false if not
      • checkConsumedAndProducedValues

        private void checkConsumedAndProducedValues​(org.apache.bcel.generic.Instruction ins,
                                                    ValueNumber[] consumedValueList,
                                                    ValueNumber[] producedValueList)
      • modelNormalInstruction

        public void modelNormalInstruction​(org.apache.bcel.generic.Instruction ins,
                                           int numWordsConsumed,
                                           int numWordsProduced)
        This is the default instruction modeling method.
        Overrides:
        modelNormalInstruction in class AbstractFrameModelingVisitor<ValueNumber,​ValueNumberFrame>
        Parameters:
        ins - the Instruction to model
        numWordsConsumed - number of stack words consumed
        numWordsProduced - number of stack words produced
      • killLoadsOfObjectsPassed

        private void killLoadsOfObjectsPassed​(org.apache.bcel.generic.INVOKEDYNAMIC ins)
      • killLoadsOfObjectsPassed

        private void killLoadsOfObjectsPassed​(org.apache.bcel.generic.InvokeInstruction ins)
      • visitInvokeOnException

        public void visitInvokeOnException​(org.apache.bcel.generic.Instruction obj)
      • popInputValues

        private ValueNumber[] popInputValues​(int numWordsConsumed)
        Pop the input values for the given instruction from the current frame.
      • pushOutputValues

        private void pushOutputValues​(ValueNumber[] outputValueList)
        Push given output values onto the current frame.
      • getOutputValues

        private ValueNumber[] getOutputValues​(ValueNumber[] inputValueList,
                                              int numWordsProduced)
        Get output values for current instruction from the ValueNumberCache.
      • getOutputValues

        private ValueNumber[] getOutputValues​(ValueNumber[] inputValueList,
                                              int numWordsProduced,
                                              int flags)
      • allocateValueNumberArray

        private static ValueNumber[] allocateValueNumberArray​(int size)
        Creates a new empty array (if needed) with given size.
        Parameters:
        size - array size
        Returns:
        if size is zero, returns EMPTY_INPUT_VALUE_LIST
      • vlts

        private static java.lang.String vlts​(ValueNumber[] vl)
      • loadInstanceField

        private void loadInstanceField​(XField instanceField,
                                       org.apache.bcel.generic.Instruction obj)
        Load an instance field.
        Parameters:
        instanceField - the field
        obj - the Instruction loading the field
      • loadStaticField

        private void loadStaticField​(XField staticField,
                                     org.apache.bcel.generic.Instruction obj)
        Load a static field.
        Parameters:
        staticField - the field
        obj - the Instruction loading the field
      • storeInstanceField

        private void storeInstanceField​(XField instanceField,
                                        org.apache.bcel.generic.Instruction obj,
                                        boolean pushStoredValue)
        Store an instance field.
        Parameters:
        instanceField - the field
        obj - the instruction which stores the field
        pushStoredValue - push the stored value onto the stack (because we are modeling an inner-class field access method)
      • storeStaticField

        private void storeStaticField​(XField staticField,
                                      org.apache.bcel.generic.Instruction obj,
                                      boolean pushStoredValue)
        Store a static field.
        Parameters:
        staticField - the static field
        obj - the instruction which stores the field
        pushStoredValue - push the stored value onto the stack (because we are modeling an inner-class field access method)