Class ContainerContextSelector

  • All Implemented Interfaces:
    ContextSelector

    public class ContainerContextSelector
    extends Object
    implements ContextSelector
    This context selector returns a context customized for the InstanceKey of the receiver if Additionally, we add one level of call string context to a few well-known static factory methods from the standard libraries.
    • Field Detail

      • SyntheticSystem

        public static final TypeReference SyntheticSystem
      • JavaUtilHashtable

        public static final TypeReference JavaUtilHashtable
      • arraycopyAtom

        public static final Atom arraycopyAtom
    • Constructor Detail

      • ContainerContextSelector

        public ContainerContextSelector​(IClassHierarchy cha,
                                        ZeroXInstanceKeys delegate)
        Parameters:
        cha - governing class hierarchy
        delegate - object which determines which classes are "interesting"
    • Method Detail

      • getCalleeTarget

        public Context getCalleeTarget​(CGNode caller,
                                       CallSiteReference site,
                                       IMethod callee,
                                       InstanceKey[] keys)
        Description copied from interface: ContextSelector
        Given a calling node and a call site, returns the Context in which the callee should be evaluated.
        Specified by:
        getCalleeTarget in interface ContextSelector
        Parameters:
        caller - the node containing the call site
        site - description of the call site
        keys - the abstract objects (InstanceKeys) of parameters of interest to the selector
        Returns:
        the Context in which the callee should be evaluated, or null if no information is available.
      • isWellKnownStaticFactory

        public static boolean isWellKnownStaticFactory​(MethodReference m)
        Does m represent a static factory method we know about from the standard libraries, that we usually wish to model with one level of call-string context?
      • isArrayCopyingMethod

        public static boolean isArrayCopyingMethod​(MethodReference m)
        Does m represent a library method that copies arrays?
      • findRecursiveMatchingContext

        public static Context findRecursiveMatchingContext​(IMethod M,
                                                           Context C,
                                                           InstanceKey receiver)
        This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C a) includes the method M. or b) includes the method in which the receiver was allocated
        Returns:
        the matching context if found, null otherwise
      • findNodeRecursiveMatchingContext

        public static CGNode findNodeRecursiveMatchingContext​(IMethod m,
                                                              Context c)
        This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N. Else return findRecursiveMatchingContext(M, N.context) Else return null
      • findRecursiveMatchingContext

        public static Context findRecursiveMatchingContext​(IMethod M,
                                                           Context C)
        This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N.context. Else return findRecursiveMatchingContext(M, N.context) Else return null
      • isContainer

        protected boolean isContainer​(IClass C)
        Returns:
        true iff C is a container class
      • getRelevantParameters

        public IntSet getRelevantParameters​(CGNode caller,
                                            CallSiteReference site)
        Description copied from interface: ContextSelector
        Given a calling node and a call site, return the set of parameters based on which this selector may choose to specialize contexts.
        Specified by:
        getRelevantParameters in interface ContextSelector
        Parameters:
        caller - the calling node
        site - the specific call site
        Returns:
        the set of parameters of interest