Class BaseCallGraph

    • Constructor Detail

      • BaseCallGraph

        public BaseCallGraph()
    • Method Detail

      • resolveNonInstance

        public void resolveNonInstance​(UnresolvedCall call,
                                       java.util.Set<Type>[] types,
                                       java.util.Collection<CFG> targets,
                                       java.util.Collection<NativeCFG> natives,
                                       SymbolAliasing aliasing)
                                throws CallResolutionException
        Resolves the given call as regular (non-instance) call.
        Parameters:
        call - the call to resolve
        types - the runtime types of the parameters of the call
        targets - the list of targets that, after the execution of this method, will contain the CFGs targeted by the call
        natives - the list of targets that, after the execution of this method, will contain the NativeCFGs targeted by the call
        aliasing - the symbol aliasing information
        Throws:
        CallResolutionException - if something goes wrong while resolving the call
      • resolveInstance

        public void resolveInstance​(UnresolvedCall call,
                                    java.util.Set<Type>[] types,
                                    java.util.Collection<CFG> targets,
                                    java.util.Collection<NativeCFG> natives,
                                    SymbolAliasing aliasing)
                             throws CallResolutionException
        Resolves the given call as an instance call.
        Parameters:
        call - the call to resolve
        types - the runtime types of the parameters of the call
        targets - the list of targets that, after the execution of this method, will contain the CFGs targeted by the call
        natives - the list of targets that, after the execution of this method, will contain the NativeCFGs targeted by the call
        aliasing - the symbol aliasing information
        Throws:
        CallResolutionException - if something goes wrong while resolving the call
      • checkMember

        public void checkMember​(UnresolvedCall call,
                                java.util.Set<Type>[] types,
                                java.util.Collection<CFG> targets,
                                java.util.Collection<NativeCFG> natives,
                                SymbolAliasing aliasing,
                                CodeMember cm,
                                boolean instance)
        Checks if the given code member cm is a candidate target for the given call, and proceeds to add it to the set of targets if it is. Aliasing information is used here to match code members that have been aliased and that can be targeted by calls that refer to other names. Note that AbstractCodeMembers are always discarded.
        Parameters:
        call - the call to match
        types - the runtime types of the parameters of the call
        targets - the list of targets that, after the execution of this method, will contain the CFGs targeted by the call
        natives - the list of targets that, after the execution of this method, will contain the NativeCFGs targeted by the call
        aliasing - the symbol aliasing information
        cm - the code member to match
        instance - whether or not the only instance or non-instance members should be matched
      • matchCodeMemberName

        public boolean matchCodeMemberName​(UnresolvedCall call,
                                           java.lang.String qualifier,
                                           java.lang.String name)
        Matches the name (qualifier + target name) of the given call against the given code member.
        Parameters:
        call - the call to match
        qualifier - the qualifier (name of the defining unit) of the code member
        name - the name of the code member
        Returns:
        true if the qualifier and name are compatible with the ones of the call's target
      • getPossibleTypesOfReceiver

        public abstract java.util.Collection<Type> getPossibleTypesOfReceiver​(Expression receiver,
                                                                              java.util.Set<Type> types)
                                                                       throws CallResolutionException
        Returns all the possible types of the given expression that should be considered as possible receivers of the call. How we choose this set varies from the call graph algorithm we decide to adopt (e.g., CHA, RTA, 0-CFA, ...)
        Parameters:
        receiver - an expression
        types - the runtime types of the receiver
        Returns:
        the possible types to use as receivers
        Throws:
        CallResolutionException - if the types cannot be computed
      • getCallees

        public java.util.Collection<CodeMember> getCallees​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the CodeMembers that are called by the given one. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallees in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of called code members
      • getCallers

        public java.util.Collection<CodeMember> getCallers​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the CodeMembers that call the given one. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallers in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of callers code members
      • getCallSites

        public java.util.Collection<Call> getCallSites​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the Calls that targets the given CodeMember. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallSites in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of calls that target the code member