chord.program
Class Program

java.lang.Object
  extended by chord.program.Program

public class Program
extends java.lang.Object

Quadcode intermediate representation of a Java program.

Author:
Mayur Naik (mhn@cs.stanford.edu)

Method Summary
 void build()
          Constructs the program's quadcode representation.
static Program g()
          Provides the program's quadcode representation.
 joeq.Class.jq_Reference getClass(java.lang.String name)
          Provides the quadcode representation of the given class, if it is deemed reachable, and null otherwise.
 IndexSet<joeq.Class.jq_Reference> getClasses()
          Provides the quadcode representation of all classes deemed reachable by analysis scope construction.
 ClassHierarchy getClassHierarchy()
          Provides the program's class hierarchy.
 java.util.List<java.lang.String> getDynamicallyLoadedClasses()
          Executes the program and provides a list of all dynamically loaded classes.
 joeq.Class.jq_Method getMainMethod()
          Provides the quadcode representation of the main method of the program, if it exists, and exits otherwise.
 joeq.Class.jq_Method getMethod(MethodSign sign)
          Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.
 joeq.Class.jq_Method getMethod(java.lang.String sign)
          Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.
 joeq.Class.jq_Method getMethod(java.lang.String mName, java.lang.String mDesc, java.lang.String cName)
          Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.
 IndexSet<joeq.Class.jq_Method> getMethods()
          Provides the quadcode representation of all methods deemed reachable by analysis scope construction.
 joeq.Compiler.Quad.Quad getQuad(MethodElem e)
          Provides the first quad corresponding to the given bytecode instruction, if it exists, and null otherwise.
 joeq.Compiler.Quad.Quad getQuad(MethodElem e, java.lang.Class quadOpClass)
          Provides the first quad corresponding to the given bytecode instruction and of the given quad kind, if it exists, and null otherwise.
 joeq.Compiler.Quad.Quad getQuad(MethodElem e, java.lang.Class[] quadOpClasses)
          Provides the first quad corresponding to the given bytecode instruction and of any of the given quad kinds, if it exists, and null otherwise.
 Reflect getReflect()
          Reflection information resolved by analysis scope construction.
 joeq.Class.jq_Method getThreadStartMethod()
          Provides the quadcode representation of the start() method of class java.lang.Thread, if it is deemed reachable, and null otherwise.
 joeq.Class.jq_Type getType(java.lang.String name)
          The quadcode representation of the given type, if it is deemed reachable, and null otherwise.
 IndexSet<joeq.Class.jq_Type> getTypes()
          Provides The quadcode representation of all types deemed reachable.
 void HTMLizeJavaSrcFiles()
          Converts and dumps the program's Java source files specified by property chord.src.path to HTML files in the directory specified by property chord.out.dir.
 joeq.Class.jq_Reference loadClass(java.lang.String s)
          Loads the given class, if it is not already loaded, and provides its quadcode representation.
 void printAllClasses()
          Prints the quadcode representation of all reachable classes.
 void printClass(java.lang.String className)
          Prints the quadcode representation of the given class, if it is deemed reachable, and exits otherwise.
 void printMethod(java.lang.String sign)
          Prints the quadcode representation of the given method, if it is deemed reachable, and exits otherwise.
static java.lang.String typesToStr(java.lang.String typesStr)
          Provides a human-readable string that corresponds to the given bytecode string encoding a list of zero or more types, if it is well-formed, and null otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

g

public static Program g()
Provides the program's quadcode representation.

Returns:
The program's quadcode representation.

getClassHierarchy

public ClassHierarchy getClassHierarchy()
Provides the program's class hierarchy.

Returns:
The program's class hierarchy.

build

public void build()
Constructs the program's quadcode representation. Users need not call this method explicitly as it is called by each method in this class that requires the representation to be built.


loadClass

public joeq.Class.jq_Reference loadClass(java.lang.String s)
                                  throws java.lang.Error
Loads the given class, if it is not already loaded, and provides its quadcode representation.

Parameters:
s - The name of the class to be loaded. It may be provided in any of several formats.

Examples: "[I", "int[]", "java.lang.String[]", "[Ljava/lang/String;".

Returns:
The quadcode representation of the given class.
Throws:
java.lang.Error - If the class loading failed.

getTypes

public IndexSet<joeq.Class.jq_Type> getTypes()
Provides The quadcode representation of all types deemed reachable. A type is deemed reachable if it is referenced in any loaded class.

Returns:
The quadcode representation of all types deemed reachable.

getMethods

public IndexSet<joeq.Class.jq_Method> getMethods()
Provides the quadcode representation of all methods deemed reachable by analysis scope construction.

Returns:
The quadcode representation of all methods deemed reachable by analysis scope construction.

getReflect

public Reflect getReflect()
Reflection information resolved by analysis scope construction.

Returns:
Reflection information resolved by analysis scope construction.

getClasses

public IndexSet<joeq.Class.jq_Reference> getClasses()
Provides the quadcode representation of all classes deemed reachable by analysis scope construction.

Returns:
The quadcode representation of all classes deemed reachable by analysis scope construction.

getClass

public joeq.Class.jq_Reference getClass(java.lang.String name)
Provides the quadcode representation of the given class, if it is deemed reachable, and null otherwise.

Returns:
The quadcode representation of the given class, if it is deemed reachable, and null otherwise.

getMethod

public joeq.Class.jq_Method getMethod(java.lang.String mName,
                                      java.lang.String mDesc,
                                      java.lang.String cName)
Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.

Parameters:
mName - Name of the method.
mDesc - Descriptor of the method.
cName - Name of the class declaring the method.
Returns:
The quadcode representation of the given method, if it is deemed reachable, and null otherwise.

getMethod

public joeq.Class.jq_Method getMethod(MethodSign sign)
Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.

Parameters:
sign - Signature of the method specifying its name, its descriptor, and its declaring class.
Returns:
The quadcode representation of the given method, if it is deemed reachable, and null otherwise.

getMethod

public joeq.Class.jq_Method getMethod(java.lang.String sign)
Provides the quadcode representation of the given method, if it is deemed reachable, and null otherwise.

Parameters:
sign - Signature of the method in format mName:mDesc@cName specifying its name (mName), its descriptor (mDesc), and its declaring class (cName).
Returns:
The quadcode representation of the given method, if it is deemed reachable, and null otherwise.

getMainMethod

public joeq.Class.jq_Method getMainMethod()
Provides the quadcode representation of the main method of the program, if it exists, and exits otherwise.


getThreadStartMethod

public joeq.Class.jq_Method getThreadStartMethod()
Provides the quadcode representation of the start() method of class java.lang.Thread, if it is deemed reachable, and null otherwise.

Returns:
The quadcode representation of the start() method of class java.lang.Thread, if it is deemed reachable, and null otherwise.

getType

public joeq.Class.jq_Type getType(java.lang.String name)
The quadcode representation of the given type, if it is deemed reachable, and null otherwise.

Returns:
The quadcode representation of the given type, if it is deemed reachable, and null otherwise.

getQuad

public joeq.Compiler.Quad.Quad getQuad(MethodElem e)
Provides the first quad corresponding to the given bytecode instruction, if it exists, and null otherwise.

Returns:
The first quad corresponding to the given bytecode instruction, if it exists, and null otherwise.

getQuad

public joeq.Compiler.Quad.Quad getQuad(MethodElem e,
                                       java.lang.Class quadOpClass)
Provides the first quad corresponding to the given bytecode instruction and of the given quad kind, if it exists, and null otherwise.

Returns:
The first quad corresponding to the given bytecode instruction and of the given quad kind, if it exists, and null otherwise.

getQuad

public joeq.Compiler.Quad.Quad getQuad(MethodElem e,
                                       java.lang.Class[] quadOpClasses)
Provides the first quad corresponding to the given bytecode instruction and of any of the given quad kinds, if it exists, and null otherwise.

Returns:
The first quad corresponding to the given bytecode instruction and of any of the given quad kinds, if it exists, and null otherwise.

typesToStr

public static java.lang.String typesToStr(java.lang.String typesStr)
Provides a human-readable string that corresponds to the given bytecode string encoding a list of zero or more types, if it is well-formed, and null otherwise.

Example: Converts "[Ljava/lang/String;I" to "java.lang.String[],int".

Returns:
A human-readable string that corresponds to the given bytecode string encoding a list of zero or more types, if it is well-formed, and null otherwise.

getDynamicallyLoadedClasses

public java.util.List<java.lang.String> getDynamicallyLoadedClasses()
Executes the program and provides a list of all dynamically loaded classes.

Returns:
A list of all dynamically loaded classes.

HTMLizeJavaSrcFiles

public void HTMLizeJavaSrcFiles()
Converts and dumps the program's Java source files specified by property chord.src.path to HTML files in the directory specified by property chord.out.dir.


printMethod

public void printMethod(java.lang.String sign)
Prints the quadcode representation of the given method, if it is deemed reachable, and exits otherwise.


printClass

public void printClass(java.lang.String className)
Prints the quadcode representation of the given class, if it is deemed reachable, and exits otherwise.


printAllClasses

public void printAllClasses()
Prints the quadcode representation of all reachable classes.