Class FieldAccess

  • Direct Known Subclasses:
    Load, Store

    public abstract class FieldAccess
    extends SingleInstruction
    Base class for Load and Store PatternElements. Handles some of the grunt work of representing fields and extracting field values from the stack frame.
    See Also:
    Load, Store
    • Field Detail

      • fieldVarName

        private final java.lang.String fieldVarName
      • valueVarName

        private final java.lang.String valueVarName
    • Constructor Detail

      • FieldAccess

        public FieldAccess​(java.lang.String fieldVarName,
                           java.lang.String valueVarName)
        Constructor.
        Parameters:
        fieldVarName - name of the variable to bind to the field
        valueVarName - name of the variable to bind to the value store in or loaded from the field
    • Method Detail

      • checkConsistent

        protected MatchResult checkConsistent​(Variable field,
                                              Variable value,
                                              BindingSet bindingSet)
        Check that the Variables determined for the field and the value loaded/stored are consistent with previous variable definitions.
        Parameters:
        field - Variable representing the field
        value - Variable representing the value loaded/stored
        bindingSet - previous definitions
        Returns:
        a MatchResult containing an updated BindingSet if successful, or null if unsuccessful
      • isLongOrDouble

        protected static boolean isLongOrDouble​(org.apache.bcel.generic.FieldInstruction fieldIns,
                                                org.apache.bcel.generic.ConstantPoolGen cpg)
        Return whether the given FieldInstruction accesses a long or double field.
        Parameters:
        fieldIns - the FieldInstruction
        cpg - the ConstantPoolGen for the method
      • snarfFieldValue

        protected static Variable snarfFieldValue​(org.apache.bcel.generic.FieldInstruction fieldIns,
                                                  org.apache.bcel.generic.ConstantPoolGen cpg,
                                                  ValueNumberFrame frame)
                                           throws DataflowAnalysisException
        Get a Variable representing the stack value which will either be stored into or loaded from a field.
        Parameters:
        fieldIns - the FieldInstruction accessing the field
        cpg - the ConstantPoolGen for the method
        frame - the ValueNumberFrame containing the value to be stored or the value loaded
        Throws:
        DataflowAnalysisException