joeq.Compiler.Analysis.IPA
Class PAResults

java.lang.Object
  extended by joeq.Compiler.Analysis.IPA.PAResults
All Implemented Interfaces:
PointerAnalysisResults

public class PAResults
extends Object
implements PointerAnalysisResults

Records results for pointer analysis. The results can be saved and reloaded. This class also provides methods to query the results.

Version:
$Id: PAResults.java 2470 2006-07-17 05:20:48Z joewhaley $
Author:
John Whaley

Nested Class Summary
static class PAResults.HeapLocation
           
 class PAResults.HeapLocationSet
           
 
Field Summary
static int DEFAULT_NUM_TO_PRINT
           
static double p0
          Generic z-statistic stuff.
 
Constructor Summary
PAResults(PA pa)
           
 
Method Summary
 net.sf.javabdd.BDD calculateCommonSupertype(net.sf.javabdd.BDD types)
          Given a set of types (T2), calculate the tightest common superclass (T2).
 net.sf.javabdd.BDD calculateDefUse(net.sf.javabdd.BDD r_v1)
          Given a set of definitions (V1xV1c), calculate the set of uses (V1xV1c) that reach that set of definitions.
 net.sf.javabdd.BDD calculateHeapConnectivity(net.sf.javabdd.BDD h1)
          Given a heap object (H1xH1c), calculate the set of heap objects (H1xH1c) that are reachable by following a chain of access paths.
 net.sf.javabdd.BDD calculateUseDef(net.sf.javabdd.BDD r_v1)
          Given a set of uses (V1xV1c), calculate the set of definitions (V1xV1c) that reach that set of uses.
 void compareCallingContexts(jq_Method m)
           
 void computeGini(jwutil.graphs.PathNumbering pn)
          Compute coefficient of concentration of SCC-sizes for given path numbering.
 int countPointsTo(net.sf.javabdd.BDD v)
           
 int countThreadLocalObjects()
           
 int countTransitiveReachingDefs(net.sf.javabdd.BDD vPrelation)
           
 void defUseGraph(net.sf.javabdd.BDD vPrelation, boolean direction, DataOutput out)
          Output def-use or use-def graph in dot format.
 net.sf.javabdd.BDD findIndistinguishablyTypedObjects()
           
 Set getAliases(jq_Method method, SSALocation loc)
          Returns a set of location/contextset pairs of locations that may be aliased with the given location, along with the set of contexts under which each alias can occur.
 CallGraph getCallGraph()
           
 Set getCallTargets(ProgramLocation.QuadProgramLocation invoke)
          Compute the set of results based on the BDD results.
 Set getCallTargets2(ProgramLocation invoke)
           
 net.sf.javabdd.BDD getEncapsulatedHeapObjects()
           
 jq_Field getField(int v)
           
 int getFieldIndex(jq_Field m)
           
 net.sf.javabdd.BDD getHashcodeTakenVars()
           
 int getHeapIndex(MethodSummary.Node n)
           
 MethodSummary.Node getHeapNode(int v)
           
 ProgramLocation getInvoke(int v)
           
 int getInvokeIndex(ProgramLocation n)
           
 jq_Method getMethod(int v)
           
 int getMethodIndex(jq_Method m)
           
 jq_Method getName(int v)
           
 int getNameIndex(jq_Method m)
           
 PA getPAResults()
           
 net.sf.javabdd.BDD getReachableVars(net.sf.javabdd.BDD method_plus_context0)
          Starting from a method with a context (MxV1c), calculate the set of transitively-reachable variables (V1xV1c).
 net.sf.javabdd.BDD getThreadLocalObjects()
          Return the set of thread-local objects (H1xH1c).
 net.sf.javabdd.BDD getTransitiveModSet(net.sf.javabdd.BDD method_plus_context0)
          Given a starting method and a context (MxV1c), calculate the transitive mod set (H1xH1cxF).
 net.sf.javabdd.BDD getTransitiveRefSet(net.sf.javabdd.BDD method_plus_context0)
          Given a starting method and a context (MxV1c), calculate the transitive ref set (H1xH1cxF).
 jq_Reference getType(int v)
           
 int getTypeIndex(jq_Type m)
           
 int getVariableIndex(MethodSummary.Node n)
           
 MethodSummary.Node getVariableNode(int v)
           
 boolean hasAliases(jq_Method method, SSALocation loc)
          Returns whether the given location may have aliases in any context.
 boolean hasAliases(jq_Method method, SSALocation loc, ContextSet contextSet)
          Returns whether the given location may have aliases in the given set of contexts.
static void initialize(String addToClasspath)
           
 void initializeExtraDomains()
           
 void interactive()
           
 boolean isAliased(SSALocation a, SSALocation b)
           
 void loadCallGraph(String fn)
          Load call graph from the given file name.
static PAResults loadResults(String[] args, String addToClasspath)
           
static PAResults loadResults(String bddfactory, String prefix, String fileName)
           
static void main(String[] args)
           
 Set mod(jq_Method m, BasicBlock bb, Quad quad)
           
 Set mod(ProgramLocation.QuadProgramLocation invoke, BasicBlock bb)
          Returns the set of potentially-modified locations of the given call (and transitively any calls the target may make).
 jq_Class parseClassName(String className)
           
 void printAvailableBDDs(List results)
           
 void printDefUseChain(net.sf.javabdd.BDD vPrelation)
           
 void printHelp(List results)
           
 void printStats()
          STATISTICS
 void printTrace(PrintStream out, jwutil.graphs.SCCPathNumbering.Path trace)
          Print a Path as if it were a stacktrace.
 void printUseDefChain(net.sf.javabdd.BDD vPrelation)
          Prints out the chain of use-defs, starting from the given uses (V1xV1c).
 Set ref(ProgramLocation.QuadProgramLocation invoke, BasicBlock bb)
          Returns the set of potentially-referenced locations of the given call (and transitively any calls the target may make).
 net.sf.javabdd.TypedBDDFactory.TypedBDD showArguments(net.sf.javabdd.TypedBDDFactory.TypedBDD isites)
           
 void showSource(net.sf.javabdd.TypedBDDFactory.TypedBDD b, int before, int after)
          Given a typedbdd that contains variables, callsites, or heap objects, display the source code for each item.
 void storeBDD(String name, net.sf.javabdd.TypedBDDFactory.TypedBDD bdd1)
           
 String toString(net.sf.javabdd.TypedBDDFactory.TypedBDD b, int numToPrint)
           
 net.sf.javabdd.TypedBDDFactory.TypedBDD typesThatOverrideEquals()
          Compute all types that override equals()
static double zcompute(double e1, double c1)
           
static double zcompute(double e1, double c1, double p_0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUM_TO_PRINT

public static final int DEFAULT_NUM_TO_PRINT
See Also:
Constant Field Values

p0

public static double p0
Generic z-statistic stuff. Default p0. Set with set Compiler.Analysis.PAResults.p0 0.5

Constructor Detail

PAResults

public PAResults(PA pa)
Method Detail

getPAResults

public PA getPAResults()
Specified by:
getPAResults in interface PointerAnalysisResults

main

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

initialize

public static void initialize(String addToClasspath)

loadResults

public static PAResults loadResults(String[] args,
                                    String addToClasspath)
                             throws IOException
Throws:
IOException

loadResults

public static PAResults loadResults(String bddfactory,
                                    String prefix,
                                    String fileName)
                             throws IOException
Throws:
IOException

loadCallGraph

public void loadCallGraph(String fn)
                   throws IOException
Load call graph from the given file name.

Throws:
IOException

storeBDD

public void storeBDD(String name,
                     net.sf.javabdd.TypedBDDFactory.TypedBDD bdd1)

interactive

public void interactive()

printHelp

public void printHelp(List results)

printAvailableBDDs

public void printAvailableBDDs(List results)

printTrace

public void printTrace(PrintStream out,
                       jwutil.graphs.SCCPathNumbering.Path trace)
Print a Path as if it were a stacktrace.


parseClassName

public jq_Class parseClassName(String className)

getVariableNode

public MethodSummary.Node getVariableNode(int v)

getVariableIndex

public int getVariableIndex(MethodSummary.Node n)

getInvoke

public ProgramLocation getInvoke(int v)

getInvokeIndex

public int getInvokeIndex(ProgramLocation n)

getHeapNode

public MethodSummary.Node getHeapNode(int v)

getHeapIndex

public int getHeapIndex(MethodSummary.Node n)

getField

public jq_Field getField(int v)

getFieldIndex

public int getFieldIndex(jq_Field m)

getType

public jq_Reference getType(int v)

getTypeIndex

public int getTypeIndex(jq_Type m)

getName

public jq_Method getName(int v)

getNameIndex

public int getNameIndex(jq_Method m)

getMethod

public jq_Method getMethod(int v)

getMethodIndex

public int getMethodIndex(jq_Method m)

toString

public String toString(net.sf.javabdd.TypedBDDFactory.TypedBDD b,
                       int numToPrint)

calculateHeapConnectivity

public net.sf.javabdd.BDD calculateHeapConnectivity(net.sf.javabdd.BDD h1)
Given a heap object (H1xH1c), calculate the set of heap objects (H1xH1c) that are reachable by following a chain of access paths.


calculateCommonSupertype

public net.sf.javabdd.BDD calculateCommonSupertype(net.sf.javabdd.BDD types)
Given a set of types (T2), calculate the tightest common superclass (T2).


calculateUseDef

public net.sf.javabdd.BDD calculateUseDef(net.sf.javabdd.BDD r_v1)
Given a set of uses (V1xV1c), calculate the set of definitions (V1xV1c) that reach that set of uses. Only does one step at a time; you'll have to iterate to get the transitive closure.


calculateDefUse

public net.sf.javabdd.BDD calculateDefUse(net.sf.javabdd.BDD r_v1)
Given a set of definitions (V1xV1c), calculate the set of uses (V1xV1c) that reach that set of definitions. Only does one step at a time; you'll have to iterate to get the transitive closure.


defUseGraph

public void defUseGraph(net.sf.javabdd.BDD vPrelation,
                        boolean direction,
                        DataOutput out)
                 throws IOException
Output def-use or use-def graph in dot format.

Throws:
IOException

printUseDefChain

public void printUseDefChain(net.sf.javabdd.BDD vPrelation)
Prints out the chain of use-defs, starting from the given uses (V1xV1c).


printDefUseChain

public void printDefUseChain(net.sf.javabdd.BDD vPrelation)

getReachableVars

public net.sf.javabdd.BDD getReachableVars(net.sf.javabdd.BDD method_plus_context0)
Starting from a method with a context (MxV1c), calculate the set of transitively-reachable variables (V1xV1c).


getTransitiveModSet

public net.sf.javabdd.BDD getTransitiveModSet(net.sf.javabdd.BDD method_plus_context0)
Given a starting method and a context (MxV1c), calculate the transitive mod set (H1xH1cxF).


getTransitiveRefSet

public net.sf.javabdd.BDD getTransitiveRefSet(net.sf.javabdd.BDD method_plus_context0)
Given a starting method and a context (MxV1c), calculate the transitive ref set (H1xH1cxF).


getThreadLocalObjects

public net.sf.javabdd.BDD getThreadLocalObjects()
Return the set of thread-local objects (H1xH1c).


initializeExtraDomains

public void initializeExtraDomains()

getHashcodeTakenVars

public net.sf.javabdd.BDD getHashcodeTakenVars()

getEncapsulatedHeapObjects

public net.sf.javabdd.BDD getEncapsulatedHeapObjects()

typesThatOverrideEquals

public net.sf.javabdd.TypedBDDFactory.TypedBDD typesThatOverrideEquals()
Compute all types that override equals()


findIndistinguishablyTypedObjects

public net.sf.javabdd.BDD findIndistinguishablyTypedObjects()

showArguments

public net.sf.javabdd.TypedBDDFactory.TypedBDD showArguments(net.sf.javabdd.TypedBDDFactory.TypedBDD isites)

printStats

public void printStats()
                throws IOException
STATISTICS

Throws:
IOException

countPointsTo

public int countPointsTo(net.sf.javabdd.BDD v)

countTransitiveReachingDefs

public int countTransitiveReachingDefs(net.sf.javabdd.BDD vPrelation)

countThreadLocalObjects

public int countThreadLocalObjects()

getCallTargets

public Set getCallTargets(ProgramLocation.QuadProgramLocation invoke)
Compute the set of results based on the BDD results.

Specified by:
getCallTargets in interface PointerAnalysisResults

getCallTargets2

public Set getCallTargets2(ProgramLocation invoke)

mod

public Set mod(ProgramLocation.QuadProgramLocation invoke,
               BasicBlock bb)
Description copied from interface: PointerAnalysisResults
Returns the set of potentially-modified locations of the given call (and transitively any calls the target may make). Each location is represented by an SSALocation. a.f = b; everything that 'a.f' can point to loc must be in the basic block

Specified by:
mod in interface PointerAnalysisResults

ref

public Set ref(ProgramLocation.QuadProgramLocation invoke,
               BasicBlock bb)
Description copied from interface: PointerAnalysisResults
Returns the set of potentially-referenced locations of the given call (and transitively any calls the target may make). Each location is represented by an SSALocation. a = b.f; everything that 'b.f' can point to loc must be in the basic block

Specified by:
ref in interface PointerAnalysisResults

mod

public Set mod(jq_Method m,
               BasicBlock bb,
               Quad quad)

isAliased

public boolean isAliased(SSALocation a,
                         SSALocation b)

getAliases

public Set getAliases(jq_Method method,
                      SSALocation loc)
Description copied from interface: PointerAnalysisResults
Returns a set of location/contextset pairs of locations that may be aliased with the given location, along with the set of contexts under which each alias can occur.

Specified by:
getAliases in interface PointerAnalysisResults

hasAliases

public boolean hasAliases(jq_Method method,
                          SSALocation loc,
                          ContextSet contextSet)
Description copied from interface: PointerAnalysisResults
Returns whether the given location may have aliases in the given set of contexts.

Specified by:
hasAliases in interface PointerAnalysisResults

hasAliases

public boolean hasAliases(jq_Method method,
                          SSALocation loc)
Description copied from interface: PointerAnalysisResults
Returns whether the given location may have aliases in any context.

Specified by:
hasAliases in interface PointerAnalysisResults

showSource

public void showSource(net.sf.javabdd.TypedBDDFactory.TypedBDD b,
                       int before,
                       int after)
Given a typedbdd that contains variables, callsites, or heap objects, display the source code for each item. Works for ProgramLocations (callsites), but only for those variable and heap nodes that have implemented getLocation() methods.

See Also:
SourceLister

computeGini

public void computeGini(jwutil.graphs.PathNumbering pn)
Compute coefficient of concentration of SCC-sizes for given path numbering. 0 means there is no SCC of size greater than 1. 1 mean all nodes are in one SCC.


compareCallingContexts

public void compareCallingContexts(jq_Method m)

zcompute

public static double zcompute(double e1,
                              double c1,
                              double p_0)

zcompute

public static double zcompute(double e1,
                              double c1)

getCallGraph

public CallGraph getCallGraph()
Specified by:
getCallGraph in interface PointerAnalysisResults


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