edu.uci.eecs.doc.cascade
Class Cascade

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.Cascade

public class Cascade
extends Object

This is the main class for the Cascade tool. It contains an entry point (main) for command-line execution, as well as helper methods for constructing control flow data structures.

Author:
Trevor Harmon

Constructor Summary
Cascade(List<String> classPath)
          Creates a new Cascade object.
Cascade(String classPath)
          Creates a new Cascade object.
 
Method Summary
 List<String> getClassPath()
          Returns the class path that was specified when the Cascade object was created.
 Graph getControlFlowGraph(Method method)
          Constructs a control flow graph representing the given Java method.
 Graph getControlFlowGraph(Tree tree)
          Constructs a control flow graph representing a Java method.
 Graph getControlFlowGraph(Tree tree, boolean includeCacheMissBlocks)
          Constructs a control flow graph representing a Java method.
 Set<Graph> getControlFlowGraphs(Tree tree)
          Returns a set of control flow graphs for the given tree, all methods that it invokes, all methods that they invoke, and so on.
 Tree getControlFlowTree(Method method)
          Constructs a control flow tree representing the given Java method.
 Set<Tree> getControlFlowTrees(Method method)
          Returns a set of control flow trees for the given method, all methods that it invokes, all methods that they invoke, and so on.
static void main(String[] args)
          An entry point for invoking Cascade from the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cascade

public Cascade(List<String> classPath)
Creates a new Cascade object.

Parameters:
classPath - a list of directories that will be searched when loading classes during control flow construction

Cascade

public Cascade(String classPath)
Creates a new Cascade object.

Parameters:
classPath - a list of directories, separated by the system's path separator character, that will be searched when loading classes during control flow construction
Method Detail

main

public static void main(String[] args)
An entry point for invoking Cascade from the command line. See the Cascade user manual for a description of command line arguments.

Parameters:
args - a list of command line arguments

getClassPath

public List<String> getClassPath()
Returns the class path that was specified when the Cascade object was created.

Returns:
the list of directories that will be searched when loading classes during control flow construction

getControlFlowGraph

public Graph getControlFlowGraph(Method method)
                          throws IOException,
                                 NoSuchMethodException,
                                 ClassNotFoundException
Constructs a control flow graph representing the given Java method.

Parameters:
method - a handle to the Java method
Returns:
a control flow graph of the method
Throws:
IOException - if the method cannot be loaded
NoSuchMethodException - if the method cannot be found
ClassNotFoundException - if the method calls another method and its class cannot be found
See Also:
getControlFlowGraph(Tree)

getControlFlowGraph

public Graph getControlFlowGraph(Tree tree)
                          throws NoSuchMethodException,
                                 ClassNotFoundException,
                                 IOException
Constructs a control flow graph representing a Java method. If a control flow tree has already been constructed, this method should be used instead of getControlFlowGraph(Method) for performance reasons. (Otherwise, the method will be reloaded and its control flow tree will be reconstructed.)

Parameters:
tree - the control flow tree of the method
Returns:
a control flow graph of the method
Throws:
NoSuchMethodException - if the method calls another method and it cannot be found
ClassNotFoundException - if the method calls another method and its class cannot be found
IOException - if the method calls another method and it cannot be loaded
See Also:
getControlFlowGraph(Method)

getControlFlowGraph

public Graph getControlFlowGraph(Tree tree,
                                 boolean includeCacheMissBlocks)
                          throws NoSuchMethodException,
                                 ClassNotFoundException,
                                 IOException
Constructs a control flow graph representing a Java method. If a control flow tree has already been constructed, this method should be used instead of getControlFlowGraph(Method) for performance reasons. (Otherwise, the method will be reloaded and its control flow tree will be reconstructed.)

Parameters:
tree - the control flow tree of the method
includeCacheMissBlocks - if true, every method invocation is preceded by an InvokeMiss block and every return instruction by a ReturnMiss block; if false, no such blocks appear in the graph
Returns:
a control flow graph of the method
Throws:
NoSuchMethodException - if the method calls another method and it cannot be found
ClassNotFoundException - if the method calls another method and its class cannot be found
IOException - if the method calls another method and it cannot be loaded
See Also:
getControlFlowGraph(Method)

getControlFlowGraphs

public Set<Graph> getControlFlowGraphs(Tree tree)
                                throws IOException,
                                       NoSuchMethodException,
                                       ClassNotFoundException
Returns a set of control flow graphs for the given tree, all methods that it invokes, all methods that they invoke, and so on. The set contains no duplicates. For example, consider the following (very contrived) code:
 void methodA()
 {
     methodB();
 }

 void methodB()
 {
     methodC();
 }

 void methodC()
 {
     methodA();
     methodC();
 }
 
If methodA is given as the parameter, this method will return a set of three control flow graphs: one for methodA, one for methodB, and one for methodC.

Parameters:
tree - a control flow tree
Returns:
a set of control flow graphs
Throws:
IOException - if a method cannot be loaded
NoSuchMethodException - if a method cannot be found
ClassNotFoundException - if the method calls another method and its class cannot be found

getControlFlowTree

public Tree getControlFlowTree(Method method)
                        throws IOException,
                               NoSuchMethodException,
                               ClassNotFoundException
Constructs a control flow tree representing the given Java method.

Parameters:
method - a handle to a Java method
Returns:
a control flow tree of the method
Throws:
IOException - if the method cannot be loaded
NoSuchMethodException - if the method cannot be found
ClassNotFoundException - if the method's class cannot be found

getControlFlowTrees

public Set<Tree> getControlFlowTrees(Method method)
                              throws IOException,
                                     NoSuchMethodException,
                                     ClassNotFoundException
Returns a set of control flow trees for the given method, all methods that it invokes, all methods that they invoke, and so on. The set contains no duplicates. For example, consider the following code:
 void methodA()
 {
     methodB();
 }

 void methodB()
 {
     methodC();
 }

 void methodC()
 {
 }
 
If methodA is given as the parameter, this method will return a set of three control flow trees: one for methodA, one for methodB, and one for methodC.

Parameters:
method - a handle to a Java method
Returns:
a set of control flow trees
Throws:
IOException - if a method cannot be loaded
NoSuchMethodException - if a method cannot be found
ClassNotFoundException - if the method's class cannot be found