joeq.Compiler.Analysis.FlowInsensitive
Class MethodSummary

java.lang.Object
  extended by joeq.Compiler.Analysis.FlowInsensitive.MethodSummary

public class MethodSummary
extends Object

MethodSummary

Version:
$Id: MethodSummary.java 2465 2006-06-07 23:03:17Z joewhaley $
Author:
John Whaley

Nested Class Summary
static class MethodSummary.AccessPath
          Encodes an access path.
static class MethodSummary.BuildMethodSummary
          Visitor class to build an intramethod summary.
static class MethodSummary.CallSite
          Represents a particular call site in a method.
static class MethodSummary.CheckCastNode
          A CheckCastNode refers to the result of a CheckCast instruction
static class MethodSummary.ConcreteObjectNode
          A ConcreteObjectNode refers to an object that we discovered through reflection.
static class MethodSummary.ConcreteTypeNode
          A ConcreteTypeNode refers to an object with a concrete type.
static class MethodSummary.FakeParamNode
           
static class MethodSummary.FieldNode
          A FieldNode represents the result of a 'load' instruction.
static class MethodSummary.GlobalNode
          A GlobalNode stores references to the static variables.
static interface MethodSummary.HeapObject
           
static class MethodSummary.InsideEdgeNavigator
          Represents a field edge between two nodes.
static class MethodSummary.MethodSummaryBuilder
          Helper class to output method summary in dot graph format.
static class MethodSummary.Node
           
static class MethodSummary.NodeSet
           
static class MethodSummary.OperandToNodeMap
           
static class MethodSummary.OutsideNode
          An outside node is some node that can be mapped to other nodes.
static class MethodSummary.ParamNode
          A ParamNode represents an incoming parameter.
static class MethodSummary.PassedParameter
          Represents a particular parameter passed to a particular method call.
static class MethodSummary.PlaceholderNode
          A PlaceholderNode is used to signify an object that is out-of-scope.
static class MethodSummary.ReturnedNode
          A ReturnedNode represents a return value or thrown exception from a method call.
static class MethodSummary.ReturnValueNode
          A ReturnValueNode represents the return value of a method call.
static class MethodSummary.State
          Records the state of the intramethod analysis at some point in the method.
static class MethodSummary.ThrownExceptionNode
          A ThrownExceptionNode represents the thrown exception of a method call.
static class MethodSummary.UnknownTypeNode
          A UnknownTypeNode refers to an object with an unknown type.
static interface MethodSummary.Variable
           
 
Field Summary
static boolean CACHE_BUILDER
           
static HashMap clone_cache
          Cache of cloned method summaries.
static boolean DETERMINISTIC
           
static boolean DUMP_DOTGRAPH
           
static String fakeCloneName
          fake a method summary that simulates the effect of the inherited default clone().
static boolean IGNORE_INSTANCE_FIELDS
           
static boolean IGNORE_STATIC_FIELDS
           
static PrintStream out
           
static boolean SPLIT_THREADS
           
static boolean SSA
           
static Set ssaEntered
           
static Map stringNodes2Values
           
static HashMap summary_cache
          Holds the cache of method summary graphs.
static boolean TRACE_DOT
           
static boolean TRACE_INST
           
static boolean TRACE_INTER
           
static boolean TRACE_INTRA
           
static boolean UNIFY_ACCESS_PATHS
           
static boolean USE_IDENTITY_HASHCODE
           
static boolean USE_PARAMETER_MAP
           
static boolean VERIFY_ASSERTIONS
           
 
Constructor Summary
MethodSummary(MethodSummary.BuildMethodSummary builder, jq_Method method, MethodSummary.ParamNode[] param_nodes, MethodSummary.GlobalNode my_global, Set methodCalls, Map callToRVN, Map callToTEN, Map castMap, Set castPredecessors, Set returned, Set thrown, Set passedAsParameters, Map sync_ops)
           
MethodSummary(MethodSummary.ParamNode[] param_nodes)
           
 
Method Summary
static boolean addToMultiMap(HashMap mm, Object from, Object to)
          Utility function to add to a multi map.
static boolean addToMultiMap(HashMap mm, Object from, Set to)
          Utility function to add to a multi map.
static void clearSummaryCache()
          Clear the method summary graph.
 MethodSummary copy()
          Return a deep copy of this analysis summary.
 void dotGraph(BufferedWriter out)
          Dumps this method summary as a dot graph.
static MethodSummary fakeCloneMethodSummary(jq_FakeInstanceMethod method)
           
static MethodSummary fakeMethodSummary(jq_Method method)
           
 Set getCalls()
          Get the set of method calls made by this method.
 Map getCastMap()
          Get the map of casts.
 MethodSummary.GlobalNode getGlobal()
          Get the global node for this method.
 jq_Method getMethod()
           
 Set getNodesThatCall(MethodSummary.PassedParameter pp)
          Return the set of nodes that are passed as the given parameter.
 void getNodesThatCall(MethodSummary.PassedParameter pp, Set result)
          Add all nodes that are passed as the given passed parameter to the given result set.
 Set getNodesThatCall(ProgramLocation mc, int k)
           
 int getNumOfParams()
          Get the number of parameters passed into this method.
 MethodSummary.ParamNode getParamNode(int i)
          Get the ith parameter node.
 Collection getRegisterAtLocation(BasicBlock bb, Quad q, RegisterFactory.Register r)
           
 Set getReturned()
          Get the set of returned nodes.
 MethodSummary.ReturnValueNode getRVN(ProgramLocation mc)
          Get the return value node corresponding to the given method call.
static MethodSummary getSummary(ControlFlowGraph cfg)
          Get the method summary for the given CFG.
static MethodSummary getSummary(ControlFlowGraph cfg, MethodSummary.CallSite cs)
          Get the (context-sensitive) method summary for the given control flow graph when called from the given call site.
static MethodSummary getSummary(jq_Method m)
          Get the method summary for the given method.
 Collection getSyncedVars()
           
 MethodSummary.ThrownExceptionNode getTEN(ProgramLocation mc)
          Get the thrown exception node corresponding to the given method call.
 Set getThrown()
          Get the set of thrown nodes.
 int hashCode()
           
static void instantiate(MethodSummary caller, ProgramLocation mc, MethodSummary callee, boolean removeCall)
          Instantiate a copy of the callee summary into the caller.
static boolean isNullConstant(MethodSummary.Node node)
           
static void main(String[] args)
           
 void mergeGlobal()
          Merge the global node for this method summary with the main global node.
 Iterator nodeIterator()
          Returns an iteration of all nodes in this summary.
 String toString()
          Return a string representation of this summary.
 void unifyAccessPathEdges(MethodSummary.Node n)
          Unify similar access path edges from the given node.
 void unifyAccessPaths(Set roots)
          Unify similar access paths from the given roots.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

out

public static PrintStream out

TRACE_INTRA

public static boolean TRACE_INTRA

TRACE_INTER

public static boolean TRACE_INTER

TRACE_INST

public static boolean TRACE_INST

TRACE_DOT

public static boolean TRACE_DOT

IGNORE_INSTANCE_FIELDS

public static final boolean IGNORE_INSTANCE_FIELDS
See Also:
Constant Field Values

IGNORE_STATIC_FIELDS

public static final boolean IGNORE_STATIC_FIELDS
See Also:
Constant Field Values

VERIFY_ASSERTIONS

public static final boolean VERIFY_ASSERTIONS
See Also:
Constant Field Values

SSA

public static boolean SSA

USE_IDENTITY_HASHCODE

public static final boolean USE_IDENTITY_HASHCODE
See Also:
Constant Field Values

DETERMINISTIC

public static final boolean DETERMINISTIC
See Also:
Constant Field Values

SPLIT_THREADS

public static final boolean SPLIT_THREADS
See Also:
Constant Field Values

ssaEntered

public static Set ssaEntered

stringNodes2Values

public static Map stringNodes2Values

summary_cache

public static HashMap summary_cache
Holds the cache of method summary graphs.


clone_cache

public static HashMap clone_cache
Cache of cloned method summaries.


USE_PARAMETER_MAP

public static final boolean USE_PARAMETER_MAP
See Also:
Constant Field Values

CACHE_BUILDER

public static boolean CACHE_BUILDER

UNIFY_ACCESS_PATHS

public static final boolean UNIFY_ACCESS_PATHS
See Also:
Constant Field Values

DUMP_DOTGRAPH

public static final boolean DUMP_DOTGRAPH

fakeCloneName

public static String fakeCloneName
fake a method summary that simulates the effect of the inherited default clone().

Constructor Detail

MethodSummary

public MethodSummary(MethodSummary.ParamNode[] param_nodes)

MethodSummary

public MethodSummary(MethodSummary.BuildMethodSummary builder,
                     jq_Method method,
                     MethodSummary.ParamNode[] param_nodes,
                     MethodSummary.GlobalNode my_global,
                     Set methodCalls,
                     Map callToRVN,
                     Map callToTEN,
                     Map castMap,
                     Set castPredecessors,
                     Set returned,
                     Set thrown,
                     Set passedAsParameters,
                     Map sync_ops)
Method Detail

getSummary

public static MethodSummary getSummary(ControlFlowGraph cfg)
Get the method summary for the given CFG. Builds and caches it if it doesn't already exist.

Parameters:
cfg -
Returns:
summary for the given CFG

getSummary

public static MethodSummary getSummary(jq_Method m)
Get the method summary for the given method. If we know how to fake a method summary, do so.

Returns:
null if method has no bytecode and we do not know how to fake it

clearSummaryCache

public static void clearSummaryCache()
Clear the method summary graph.


getSummary

public static MethodSummary getSummary(ControlFlowGraph cfg,
                                       MethodSummary.CallSite cs)
Get the (context-sensitive) method summary for the given control flow graph when called from the given call site. If clone_cache is null, falls back to the context-insensitive version.

Parameters:
cfg -
cs -
Returns:
summary for the given CFG and context

getGlobal

public MethodSummary.GlobalNode getGlobal()
Get the global node for this method.


getParamNode

public MethodSummary.ParamNode getParamNode(int i)
Get the ith parameter node.


getNumOfParams

public int getNumOfParams()
Get the number of parameters passed into this method.


getCalls

public Set getCalls()
Get the set of method calls made by this method.


getNodesThatCall

public void getNodesThatCall(MethodSummary.PassedParameter pp,
                             Set result)
Add all nodes that are passed as the given passed parameter to the given result set.


getNodesThatCall

public Set getNodesThatCall(ProgramLocation mc,
                            int k)

getNodesThatCall

public Set getNodesThatCall(MethodSummary.PassedParameter pp)
Return the set of nodes that are passed as the given parameter.


mergeGlobal

public void mergeGlobal()
Merge the global node for this method summary with the main global node.


addToMultiMap

public static boolean addToMultiMap(HashMap mm,
                                    Object from,
                                    Object to)
Utility function to add to a multi map.


addToMultiMap

public static boolean addToMultiMap(HashMap mm,
                                    Object from,
                                    Set to)
Utility function to add to a multi map.


copy

public MethodSummary copy()
Return a deep copy of this analysis summary. Nodes, edges, everything is copied.


unifyAccessPaths

public void unifyAccessPaths(Set roots)
Unify similar access paths from the given roots. The given set is consumed.


unifyAccessPathEdges

public void unifyAccessPathEdges(MethodSummary.Node n)
Unify similar access path edges from the given node.


instantiate

public static void instantiate(MethodSummary caller,
                               ProgramLocation mc,
                               MethodSummary callee,
                               boolean removeCall)
Instantiate a copy of the callee summary into the caller.


getMethod

public jq_Method getMethod()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Return a string representation of this summary.

Overrides:
toString in class Object

nodeIterator

public Iterator nodeIterator()
Returns an iteration of all nodes in this summary.


getReturned

public Set getReturned()
Get the set of returned nodes.


getThrown

public Set getThrown()
Get the set of thrown nodes.


getCastMap

public Map getCastMap()
Get the map of casts.


getRVN

public MethodSummary.ReturnValueNode getRVN(ProgramLocation mc)
Get the return value node corresponding to the given method call.


getTEN

public MethodSummary.ThrownExceptionNode getTEN(ProgramLocation mc)
Get the thrown exception node corresponding to the given method call.


getSyncedVars

public Collection getSyncedVars()

dotGraph

public void dotGraph(BufferedWriter out)
              throws IOException
Dumps this method summary as a dot graph.

Throws:
IOException

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException

getRegisterAtLocation

public Collection getRegisterAtLocation(BasicBlock bb,
                                        Quad q,
                                        RegisterFactory.Register r)

fakeMethodSummary

public static MethodSummary fakeMethodSummary(jq_Method method)

fakeCloneMethodSummary

public static MethodSummary fakeCloneMethodSummary(jq_FakeInstanceMethod method)

isNullConstant

public static boolean isNullConstant(MethodSummary.Node node)


Copyright © 2001-2008 John Whaley. All Rights Reserved.