soot.dava.toolkits.base.AST.structuredAnalysis
Class StructuredAnalysis

java.lang.Object
  extended by soot.dava.toolkits.base.AST.structuredAnalysis.StructuredAnalysis
Direct Known Subclasses:
CP, MustMayInitialize, ReachingCopies, ReachingDefs, UnreachableCodeFinder

public abstract class StructuredAnalysis
extends Object


Field Summary
static boolean DEBUG
           
static boolean DEBUG_IF
           
static boolean DEBUG_STATEMENTS
           
static boolean DEBUG_TRY
           
static boolean DEBUG_WHILE
           
 int MERGETYPE
           
 
Constructor Summary
StructuredAnalysis()
           
 
Method Summary
abstract  Object cloneFlowSet(Object flowSet)
          Make a clone of the flowset The implementor should know when they want a shallow or deep clone
 void debug(String debug)
           
 void debug(String methodName, String debug)
           
abstract  DavaFlowSet emptyFlowSet()
           
 Object getAfterSet(Object afterThis)
           
 Object getBeforeSet(Object beforeThis)
           
 String getLabel(ASTNode node)
          returns label on the ASTNode null if the ASTNode cannot hold a label or if the label is null
 Object handleBreak(String label, Object output, ASTNode node)
          Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non null
 Object handleContinue(String label, Object output, ASTNode node)
          Need to handleContinue stmts There can be explicit continues (in which case label is non null) There can always be implicit continues ASTNode is non null
 boolean isDifferent(Object oldObj, Object newObj)
           
 Object merge(Object obj1, Object obj2)
           
 Object mergeExplicitAndImplicit(String label, DavaFlowSet output, List explicitSet, List implicitSet)
           
abstract  Object newInitialFlow()
           
 void print(Object toPrint)
           
 Object process(Object body, Object input)
           
 Object processAbruptStatements(Stmt s, DavaFlowSet input)
          Whenever a statement has to be processed the first step is to invoke this method.
 Object processASTDoWhileNode(ASTDoWhileNode node, Object input)
           
 Object processASTForLoopNode(ASTForLoopNode node, Object input)
           
 Object processASTIfElseNode(ASTIfElseNode node, Object input)
           
 Object processASTIfNode(ASTIfNode node, Object input)
           
 Object processASTLabeledBlockNode(ASTLabeledBlockNode node, Object input)
           
 Object processASTMethodNode(ASTMethodNode node, Object input)
           
 Object processASTNode(ASTNode node, Object input)
           
 Object processASTStatementSequenceNode(ASTStatementSequenceNode node, Object input)
           
 Object processASTSwitchNode(ASTSwitchNode node, Object input)
           
 Object processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node, Object input)
           
 Object processASTTryNode(ASTTryNode node, Object input)
           
 Object processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node, Object input)
           
 Object processASTWhileNode(ASTWhileNode node, Object input)
           
 Object processCondition(ASTCondition cond, Object input)
          This implementation breaks down the aggregated condition to the terminal conditions which all have type ASTUnaryBinaryCondition.
 Object processSingleSubBodyNode(ASTNode node, Object input)
          This method is called from the specialized ASTNodes.
abstract  Object processStatement(Stmt s, Object input)
          Specific stmts within AST Constructs are processed through this method.
abstract  Object processSwitchKey(Value key, Object input)
          Deal with the key in the switch construct
abstract  Object processSynchronizedLocal(Local local, Object input)
          To deal with the local used for synch blocks
abstract  Object processUnaryBinaryCondition(ASTUnaryBinaryCondition cond, Object input)
          To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separatly.
abstract  void setMergeType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

DEBUG_IF

public static boolean DEBUG_IF

DEBUG_WHILE

public static boolean DEBUG_WHILE

DEBUG_STATEMENTS

public static boolean DEBUG_STATEMENTS

DEBUG_TRY

public static boolean DEBUG_TRY

MERGETYPE

public int MERGETYPE
Constructor Detail

StructuredAnalysis

public StructuredAnalysis()
Method Detail

setMergeType

public abstract void setMergeType()

newInitialFlow

public abstract Object newInitialFlow()

emptyFlowSet

public abstract DavaFlowSet emptyFlowSet()

cloneFlowSet

public abstract Object cloneFlowSet(Object flowSet)
Make a clone of the flowset The implementor should know when they want a shallow or deep clone


processStatement

public abstract Object processStatement(Stmt s,
                                        Object input)
Specific stmts within AST Constructs are processed through this method. It will be invoked everytime a stmt is encountered


processUnaryBinaryCondition

public abstract Object processUnaryBinaryCondition(ASTUnaryBinaryCondition cond,
                                                   Object input)
To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separatly. To be able to deal with entire aggregated conditions the user should wite their own implementation of the method processCondition


processSynchronizedLocal

public abstract Object processSynchronizedLocal(Local local,
                                                Object input)
To deal with the local used for synch blocks


processSwitchKey

public abstract Object processSwitchKey(Value key,
                                        Object input)
Deal with the key in the switch construct


print

public void print(Object toPrint)

processCondition

public Object processCondition(ASTCondition cond,
                               Object input)
This implementation breaks down the aggregated condition to the terminal conditions which all have type ASTUnaryBinaryCondition. Once these are obtained the abstract method processUnaryBinaryCondition is invoked. For aggregated conditions the merging is done in a depth first order of the condition tree.


process

public Object process(Object body,
                      Object input)

processASTNode

public Object processASTNode(ASTNode node,
                             Object input)

processSingleSubBodyNode

public final Object processSingleSubBodyNode(ASTNode node,
                                             Object input)
This method is called from the specialized ASTNodes. The purpose was to deal with different ASTNodes with similar structure in one go. The method will deal with retrieve the body of the ASTNode which are known to have only one subBody


getLabel

public String getLabel(ASTNode node)
returns label on the ASTNode null if the ASTNode cannot hold a label or if the label is null


processAbruptStatements

public Object processAbruptStatements(Stmt s,
                                      DavaFlowSet input)
Whenever a statement has to be processed the first step is to invoke this method. This is to remove the tedious work of adding code to deal with abrupt control flow from the programmer of the analysis. The method invokes the processStatement method for all other statements A programmer can decide to override this method if they want to do something specific


processASTMethodNode

public Object processASTMethodNode(ASTMethodNode node,
                                   Object input)

processASTStatementSequenceNode

public Object processASTStatementSequenceNode(ASTStatementSequenceNode node,
                                              Object input)

processASTLabeledBlockNode

public Object processASTLabeledBlockNode(ASTLabeledBlockNode node,
                                         Object input)

processASTSynchronizedBlockNode

public Object processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node,
                                              Object input)

processASTIfNode

public Object processASTIfNode(ASTIfNode node,
                               Object input)

processASTIfElseNode

public Object processASTIfElseNode(ASTIfElseNode node,
                                   Object input)

processASTWhileNode

public Object processASTWhileNode(ASTWhileNode node,
                                  Object input)

processASTDoWhileNode

public Object processASTDoWhileNode(ASTDoWhileNode node,
                                    Object input)

processASTUnconditionalLoopNode

public Object processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node,
                                              Object input)

processASTForLoopNode

public Object processASTForLoopNode(ASTForLoopNode node,
                                    Object input)

processASTSwitchNode

public Object processASTSwitchNode(ASTSwitchNode node,
                                   Object input)

processASTTryNode

public Object processASTTryNode(ASTTryNode node,
                                Object input)

merge

public Object merge(Object obj1,
                    Object obj2)

mergeExplicitAndImplicit

public Object mergeExplicitAndImplicit(String label,
                                       DavaFlowSet output,
                                       List explicitSet,
                                       List implicitSet)

handleBreak

public Object handleBreak(String label,
                          Object output,
                          ASTNode node)
Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non null


handleContinue

public Object handleContinue(String label,
                             Object output,
                             ASTNode node)
Need to handleContinue stmts There can be explicit continues (in which case label is non null) There can always be implicit continues ASTNode is non null


isDifferent

public boolean isDifferent(Object oldObj,
                           Object newObj)

getBeforeSet

public Object getBeforeSet(Object beforeThis)

getAfterSet

public Object getAfterSet(Object afterThis)

debug

public void debug(String methodName,
                  String debug)

debug

public void debug(String debug)