Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class MethodSummary  view MethodSummary download MethodSummary.java

java.lang.Object
  extended byCompil3r.Quad.MethodSummary

public class MethodSummary
extends java.lang.Object

Version:
$Id: MethodSummary.java,v 1.64 2003/08/12 12:06:33 joewhaley Exp $

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
           
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.Edge
           
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 class MethodSummary.MethodSummaryBuilder
           
static class MethodSummary.Node
           
static class MethodSummary.NodeSet
           
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.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.
 
Field Summary
(package private)  java.util.Set calls
          The method calls that this method makes.
(package private)  java.util.Map callToRVN
          Map from a method call that this method makes, and its ReturnValueNode.
(package private)  java.util.Map callToTEN
          Map from a method call that this method makes, and its ThrownExceptionNode.
static java.util.HashMap clone_cache
           
static boolean DETERMINISTIC
           
(package private)  MethodSummary.GlobalNode global
          The global node.
static boolean IGNORE_INSTANCE_FIELDS
           
static boolean IGNORE_STATIC_FIELDS
           
(package private)  Compil3r.Quad.AndersenInterface.AndersenMethod method
          The method that this is a summary for.
(package private)  java.util.Map nodes
          All nodes in the summary graph.
static java.io.PrintStream out
           
(package private)  MethodSummary.ParamNode[] params
          The parameter nodes.
(package private)  java.util.Map passedParamToNodes
           
(package private)  java.util.Set returned
          The returned nodes.
static java.util.HashMap summary_cache
           
(package private)  java.util.Set thrown
          The thrown nodes.
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(Compil3r.Quad.AndersenInterface.AndersenMethod method, MethodSummary.ParamNode[] param_nodes, MethodSummary.GlobalNode my_global, java.util.Set methodCalls, java.util.HashMap callToRVN, java.util.HashMap callToTEN, java.util.Set returned, java.util.Set thrown, java.util.Set passedAsParameters)
           
private MethodSummary(Compil3r.Quad.AndersenInterface.AndersenMethod method, MethodSummary.ParamNode[] params, java.util.Set methodCalls, java.util.HashMap callToRVN, java.util.HashMap callToTEN, java.util.Map passedParamToNodes, java.util.Set returned, java.util.Set thrown, java.util.Map nodes)
           
(package private) MethodSummary(MethodSummary.ParamNode[] param_nodes)
           
 
Method Summary
private  void addAsUseful(java.util.HashSet visited, java.util.HashSet path, MethodSummary.Node n)
          Utility function to add the given node to the node set as useful, and transitively for other nodes.
private  boolean addIfUseful(java.util.HashSet visited, java.util.HashSet path, MethodSummary.Node n)
          Utility function to add the given node to the node set if it is useful, and transitively for other nodes.
static boolean addToMultiMap(java.util.HashMap mm, java.lang.Object from, java.lang.Object to)
          Utility function to add to a multi map.
static boolean addToMultiMap(java.util.HashMap mm, java.lang.Object from, java.util.Set to)
          Utility function to add to a multi map.
static void clearSummaryCache()
           
 MethodSummary copy()
          Return a deep copy of this analysis summary.
(package private)  void dotGraph(java.io.DataOutput out)
           
(package private) static java.util.Set get_mapping(java.util.HashMap callee_to_caller, MethodSummary.Node callee_n)
          Utility function to get the mapping for a callee node.
 java.util.Set getCalls()
           
 MethodSummary.GlobalNode getGlobal()
           
(package private)  ProgramLocation getLocationOf(MethodSummary.ConcreteTypeNode n)
           
(package private)  java.util.Collection getLocationOf(MethodSummary.FieldNode n)
           
 Compil3r.Quad.AndersenInterface.AndersenMethod getMethod()
           
 java.util.Set getNodesThatCall(MethodSummary.PassedParameter pp)
           
 void getNodesThatCall(MethodSummary.PassedParameter pp, java.util.Set result)
          Add all nodes that are passed as the given passed parameter to the given result set.
 int getNumOfParams()
           
 MethodSummary.ParamNode getParamNode(int i)
           
 java.util.Set getReturned()
           
 MethodSummary.ReturnValueNode getRVN(ProgramLocation mc)
           
static MethodSummary getSummary(ControlFlowGraph cfg)
           
static MethodSummary getSummary(ControlFlowGraph cfg, MethodSummary.CallSite cs)
           
 MethodSummary.ThrownExceptionNode getTEN(ProgramLocation mc)
           
 java.util.Set getThrown()
           
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
static void instantiate(MethodSummary caller, ProgramLocation mc, MethodSummary callee, boolean removeCall)
          Instantiate a copy of the callee summary into the caller.
 void mergeGlobal()
           
(package private) static boolean multiset_contains(java.util.Map m, java.lang.Object o)
           
 java.util.Iterator nodeIterator()
          Returns an iteration of all nodes in this summary.
static ProgramLocation readLocation(java.util.StringTokenizer st)
           
static Clazz.jq_Member readMember(java.util.StringTokenizer st)
           
static MethodSummary.Node readNode(java.util.StringTokenizer st)
           
static Quad readQuad(java.util.StringTokenizer st, java.lang.Class op)
           
static Clazz.jq_Reference readType(java.util.StringTokenizer st)
           
 java.lang.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(java.util.Set roots)
          Unify similar access paths from the given roots.
(package private)  void verify()
           
(package private)  void verifyNoReferences(MethodSummary.Node n)
           
static void writeLocation(java.io.DataOutput out, ProgramLocation l)
           
static void writeMember(java.io.DataOutput out, Clazz.jq_Member m)
           
static void writeQuad(java.io.DataOutput out, Clazz.jq_Method m, Quad q)
           
static void writeType(java.io.DataOutput out, Clazz.jq_Reference type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

out

public static java.io.PrintStream out

TRACE_INTRA

public static boolean TRACE_INTRA

TRACE_INTER

public static boolean TRACE_INTER

TRACE_INST

public static boolean TRACE_INST

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

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

summary_cache

public static java.util.HashMap summary_cache

clone_cache

public static java.util.HashMap clone_cache

method

final Compil3r.Quad.AndersenInterface.AndersenMethod method
The method that this is a summary for.


params

final MethodSummary.ParamNode[] params
The parameter nodes.


nodes

final java.util.Map nodes
All nodes in the summary graph.


returned

final java.util.Set returned
The returned nodes.


thrown

final java.util.Set thrown
The thrown nodes.


global

MethodSummary.GlobalNode global
The global node.


calls

final java.util.Set calls
The method calls that this method makes.


callToRVN

final java.util.Map callToRVN
Map from a method call that this method makes, and its ReturnValueNode.


callToTEN

final java.util.Map callToTEN
Map from a method call that this method makes, and its ThrownExceptionNode.


USE_PARAMETER_MAP

public static final boolean USE_PARAMETER_MAP
See Also:
Constant Field Values

passedParamToNodes

final java.util.Map passedParamToNodes

UNIFY_ACCESS_PATHS

public static final boolean UNIFY_ACCESS_PATHS
See Also:
Constant Field Values
Constructor Detail

MethodSummary

MethodSummary(MethodSummary.ParamNode[] param_nodes)

MethodSummary

public MethodSummary(Compil3r.Quad.AndersenInterface.AndersenMethod method,
                     MethodSummary.ParamNode[] param_nodes,
                     MethodSummary.GlobalNode my_global,
                     java.util.Set methodCalls,
                     java.util.HashMap callToRVN,
                     java.util.HashMap callToTEN,
                     java.util.Set returned,
                     java.util.Set thrown,
                     java.util.Set passedAsParameters)

MethodSummary

private MethodSummary(Compil3r.Quad.AndersenInterface.AndersenMethod method,
                      MethodSummary.ParamNode[] params,
                      java.util.Set methodCalls,
                      java.util.HashMap callToRVN,
                      java.util.HashMap callToTEN,
                      java.util.Map passedParamToNodes,
                      java.util.Set returned,
                      java.util.Set thrown,
                      java.util.Map nodes)
Method Detail

getSummary

public static MethodSummary getSummary(ControlFlowGraph cfg)

clearSummaryCache

public static void clearSummaryCache()

getSummary

public static MethodSummary getSummary(ControlFlowGraph cfg,
                                       MethodSummary.CallSite cs)

readNode

public static MethodSummary.Node readNode(java.util.StringTokenizer st)
                                   throws java.io.IOException

writeType

public static void writeType(java.io.DataOutput out,
                             Clazz.jq_Reference type)
                      throws java.io.IOException

readType

public static Clazz.jq_Reference readType(java.util.StringTokenizer st)

writeMember

public static void writeMember(java.io.DataOutput out,
                               Clazz.jq_Member m)
                        throws java.io.IOException

readMember

public static Clazz.jq_Member readMember(java.util.StringTokenizer st)

writeQuad

public static void writeQuad(java.io.DataOutput out,
                             Clazz.jq_Method m,
                             Quad q)
                      throws java.io.IOException

readQuad

public static Quad readQuad(java.util.StringTokenizer st,
                            java.lang.Class op)

writeLocation

public static void writeLocation(java.io.DataOutput out,
                                 ProgramLocation l)
                          throws java.io.IOException

readLocation

public static ProgramLocation readLocation(java.util.StringTokenizer st)
                                    throws java.io.IOException

getGlobal

public MethodSummary.GlobalNode getGlobal()

getParamNode

public MethodSummary.ParamNode getParamNode(int i)

getNumOfParams

public int getNumOfParams()

getCalls

public java.util.Set getCalls()

getNodesThatCall

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


getNodesThatCall

public java.util.Set getNodesThatCall(MethodSummary.PassedParameter pp)

mergeGlobal

public void mergeGlobal()

addToMultiMap

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


addToMultiMap

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


get_mapping

static java.util.Set get_mapping(java.util.HashMap callee_to_caller,
                                 MethodSummary.Node callee_n)
Utility function to get the mapping for a callee node.


copy

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


unifyAccessPaths

public void unifyAccessPaths(java.util.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 Compil3r.Quad.AndersenInterface.AndersenMethod getMethod()

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


toString

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


addIfUseful

private boolean addIfUseful(java.util.HashSet visited,
                            java.util.HashSet path,
                            MethodSummary.Node n)
Utility function to add the given node to the node set if it is useful, and transitively for other nodes.


addAsUseful

private void addAsUseful(java.util.HashSet visited,
                         java.util.HashSet path,
                         MethodSummary.Node n)
Utility function to add the given node to the node set as useful, and transitively for other nodes.


nodeIterator

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


getReturned

public java.util.Set getReturned()

getThrown

public java.util.Set getThrown()

getRVN

public MethodSummary.ReturnValueNode getRVN(ProgramLocation mc)

getTEN

public MethodSummary.ThrownExceptionNode getTEN(ProgramLocation mc)

verify

void verify()

multiset_contains

static boolean multiset_contains(java.util.Map m,
                                 java.lang.Object o)

verifyNoReferences

void verifyNoReferences(MethodSummary.Node n)

getLocationOf

ProgramLocation getLocationOf(MethodSummary.ConcreteTypeNode n)

getLocationOf

java.util.Collection getLocationOf(MethodSummary.FieldNode n)

dotGraph

void dotGraph(java.io.DataOutput out)
        throws java.io.IOException