com.ibm.wala.j2ee
Class CommandInterpreter

java.lang.Object
  extended by com.ibm.wala.j2ee.CommandInterpreter
All Implemented Interfaces:
RTAContextInterpreter, SSAContextInterpreter, CFGProvider

public class CommandInterpreter
extends java.lang.Object
implements SSAContextInterpreter

Logic to interpret dynacache commands in context


Nested Class Summary
protected  class CommandInterpreter.SpecializedExecuteMethod
           
 
Constructor Summary
CommandInterpreter(ClassHierarchy cha, WarningSet warnings)
           
 
Method Summary
 java.util.Set<java.lang.Object> getCaughtExceptions(CGNode node, WarningSet warnings)
           
 ControlFlowGraph getCFG(CGNode N, WarningSet warnings)
           
 DefUse getDU(CGNode node, WarningSet warnings)
           
 java.util.Iterator<SSAInstruction> getInvokeStatements(CGNode node)
          Evaluate a new-instance method in a given Context
 IR getIR(CGNode node, WarningSet warnings)
           
 int getNumberOfStatements(CGNode node, WarningSet warnings)
           
 boolean hasObjectArrayLoad(CGNode node, WarningSet warnings)
           
 boolean hasObjectArrayStore(CGNode node, WarningSet warnings)
           
 java.util.Iterator<CallSiteReference> iterateCallSites(CGNode node, WarningSet warnings)
           
 java.util.Iterator<IClass> iterateCastTypes(CGNode node, WarningSet warnings)
           
 java.util.Iterator<IField> iterateFieldsRead(CGNode node, WarningSet warnings)
           
 java.util.Iterator<IField> iterateFieldsWritten(CGNode node, WarningSet warnings)
           
 java.util.Iterator<NewSiteReference> iterateNewSites(CGNode node, WarningSet warnings)
           
 boolean recordFactoryType(CGNode node, IClass klass)
          record that the "factory" method of a node should be interpreted to allocate a particular klass.
 void setWarnings(WarningSet newWarnings)
          Bind this object to a new object to track warnings
 boolean understands(CGNode node)
          Does this object understand the given method? The caller had better check this before inquiring on other properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandInterpreter

public CommandInterpreter(ClassHierarchy cha,
                          WarningSet warnings)
Parameters:
cha - governing class hierarchy
warnings - object to track analysis warnings
Method Detail

getIR

public IR getIR(CGNode node,
                WarningSet warnings)
Specified by:
getIR in interface SSAContextInterpreter
Returns:
the IR that models the method context, or null if it's an unmodelled native method

getNumberOfStatements

public int getNumberOfStatements(CGNode node,
                                 WarningSet warnings)
Specified by:
getNumberOfStatements in interface SSAContextInterpreter
Returns:
the number of the statements in the IR, or -1 if it's an unmodelled native method.

understands

public boolean understands(CGNode node)
Description copied from interface: RTAContextInterpreter
Does this object understand the given method? The caller had better check this before inquiring on other properties.

Specified by:
understands in interface RTAContextInterpreter

iterateNewSites

public java.util.Iterator<NewSiteReference> iterateNewSites(CGNode node,
                                                            WarningSet warnings)
Specified by:
iterateNewSites in interface RTAContextInterpreter
Returns:
an Iterator of the types that may be allocated by a given method in a given context.

getInvokeStatements

public java.util.Iterator<SSAInstruction> getInvokeStatements(CGNode node)
Evaluate a new-instance method in a given Context


iterateCallSites

public java.util.Iterator<CallSiteReference> iterateCallSites(CGNode node,
                                                              WarningSet warnings)
Specified by:
iterateCallSites in interface RTAContextInterpreter
Returns:
an Iterator of the call statements that may execute in a given method for a given context

iterateFieldsRead

public java.util.Iterator<IField> iterateFieldsRead(CGNode node,
                                                    WarningSet warnings)
Specified by:
iterateFieldsRead in interface RTAContextInterpreter
Returns:
iterator of FieldReference

iterateFieldsWritten

public java.util.Iterator<IField> iterateFieldsWritten(CGNode node,
                                                       WarningSet warnings)
Specified by:
iterateFieldsWritten in interface RTAContextInterpreter
Returns:
iterator of FieldReference

getCaughtExceptions

public java.util.Set<java.lang.Object> getCaughtExceptions(CGNode node,
                                                           WarningSet warnings)

hasObjectArrayLoad

public boolean hasObjectArrayLoad(CGNode node,
                                  WarningSet warnings)

hasObjectArrayStore

public boolean hasObjectArrayStore(CGNode node,
                                   WarningSet warnings)

iterateCastTypes

public java.util.Iterator<IClass> iterateCastTypes(CGNode node,
                                                   WarningSet warnings)

recordFactoryType

public boolean recordFactoryType(CGNode node,
                                 IClass klass)
Description copied from interface: RTAContextInterpreter
record that the "factory" method of a node should be interpreted to allocate a particular klass. TODO: this is a little ugly, is there a better place to move this?

Specified by:
recordFactoryType in interface RTAContextInterpreter
Returns:
true iff a NEW type was recorded, false if the type was previously recorded.

setWarnings

public void setWarnings(WarningSet newWarnings)
Description copied from interface: RTAContextInterpreter
Bind this object to a new object to track warnings

Specified by:
setWarnings in interface RTAContextInterpreter

getCFG

public ControlFlowGraph getCFG(CGNode N,
                               WarningSet warnings)
Specified by:
getCFG in interface CFGProvider
Parameters:
N - a call graph node
Returns:
a CFG that represents the node, or null if it's an unmodelled native method

getDU

public DefUse getDU(CGNode node,
                    WarningSet warnings)
Specified by:
getDU in interface SSAContextInterpreter