SandMark version 3.0


sandmark.watermark.ct.trace.callforest
Class Forest

java.lang.Object
  |
  +--sandmark.watermark.ct.trace.callforest.Forest

public class Forest
extends java.lang.Object


Field Summary
(package private)  TracePoint[] annotationPoints
           
(package private)  ClassHierarchy classHierarchy
           
(package private)  java.util.Vector forest
           
(package private)  java.util.Properties props
           
(package private)  Stats statistics
           
 
Constructor Summary
Forest(TracePoint[] annotationPoints, ClassHierarchy classHierarchy, Stats stats, java.util.Properties props)
          Construct a forest of call graphs from a set of annotation points.
 
Method Summary
(package private)  void construct()
          Build the information flow graph.
 Graph getCallGraph(int i)
          Return the i:th graph in the forest.
 MethodID[] getFlowPath(StackFrame from, MethodID to)
          Given two stack frames, returns an array of method ids which require an additional parameter to pass information from the first to the second.
 java.util.Vector getForest()
          Return a vector of call graphs.
 int size()
          Return the number of graphs in the forest.
 java.lang.String[] toDot()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

annotationPoints

TracePoint[] annotationPoints

classHierarchy

ClassHierarchy classHierarchy

statistics

Stats statistics

props

java.util.Properties props

forest

java.util.Vector forest
Constructor Detail

Forest

public Forest(TracePoint[] annotationPoints,
              ClassHierarchy classHierarchy,
              Stats stats,
              java.util.Properties props)
Construct a forest of call graphs from a set of annotation points. Each call graph is rooted in a 'unique entry point.' A unique entry point is an application call frame generated by Java runtime system. For example, there will be one call graph rooted in the call frame for "main". There may be other call graphs rooted in "action"-methods, for example methods invoked by the run-time system in response to a button click by the user. Consider the following program:
   1:      P() {
   2:          sm$mark();
   3:      }
   4:      
   5:      Q() {
   6:         sm$mark();
   7:         P();
   8:      }
   9:      
  10:      main() {
  11:         Q();
  12:         Q();
  13:      }
 

We get the call graph below. "Q:2/6" means "call frame #2 for method Q, line number 6".


                  mark:5                   mark:9
                   ^                          ^
                   |                          |
                   |                          |
                   V                          V
         mark:3   P:4/7            mark:7   P:8/7
          ^        ^                 ^        ^
          |        |                 |        |
          |        |                 |        |
          V        V                 V        V
        Q:2/6---->Q:2               Q:6/6---->Q:6
        ^                            ^
        |                            |
        |                            |
        V                            V
      main:1/11 ----------------> main:1/12
        ^
        |
       root
 
The nodes of the graphs are stack frames. The root of each call graph is the frame of whatever run() or main() method started the thread. The leaves are stack frames of sm$mark() method calls. The edge Q:2/6---->Q:2 above indicates that there is a way to pass information from mark:3 to mark:5, but not the other way. Each interior node is labeled by the stack frame (a sandmark.util.StackFrame object) it corresponds to. Each leaf represents a sm$mark() call and is labeled with the sm$mark(...) value given at that location.

Parameters:
annotationPoints - the set of locations found during tracing.
classHierarchy - the class hierarchy
stats - static statistics about the program
props - properties
Method Detail

construct

void construct()
Build the information flow graph.


getFlowPath

public MethodID[] getFlowPath(StackFrame from,
                              MethodID to)
Given two stack frames, returns an array of method ids which require an additional parameter to pass information from the first to the second.

Parameters:
from - the source stack frame
to - the sink method

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toDot

public java.lang.String[] toDot()

getForest

public java.util.Vector getForest()
Return a vector of call graphs. Each node in the graph has a sandmark.util.StackFrame as its data.


size

public int size()
Return the number of graphs in the forest.


getCallGraph

public Graph getCallGraph(int i)
Return the i:th graph in the forest.


SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003