ptolemy.copernicus.java
Class NamedObjEqualityEliminator

java.lang.Object
  extended by soot.Transformer
      extended by soot.SceneTransformer
          extended by ptolemy.copernicus.java.NamedObjEqualityEliminator
All Implemented Interfaces:
soot.HasPhaseOptions

public class NamedObjEqualityEliminator
extends soot.SceneTransformer
implements soot.HasPhaseOptions

Replace method calls on parameter objects.

Since:
Ptolemy II 2.0
Version:
$Id: NamedObjEqualityEliminator.java,v 1.40 2007/12/07 06:28:44 cxh Exp $
Author:
Stephen Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Method Summary
static boolean eliminateNamedObjComparisons(soot.SootMethod method, boolean debug)
          Remove comparisons between equal objects in the given method.
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
static NamedObj getNamedObjValue(soot.SootMethod method, soot.Local local, soot.Unit location, soot.toolkits.scalar.LocalDefs localDefs, soot.toolkits.scalar.LocalUses localUses)
          Attempt to determine the constant value of the given local, which is assumed to have a named object type.
 java.lang.String getPhaseName()
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
           
static NamedObjEqualityEliminator v(CompositeActor model)
          Return an instance of this transformer that will operate on the given model.
 
Methods inherited from class soot.SceneTransformer
transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

v

public static NamedObjEqualityEliminator v(CompositeActor model)
Return an instance of this transformer that will operate on the given model. The model is assumed to already have been properly initialized so that resolved types and other static properties of the model can be inspected.

Parameters:
model - The model upon which to operate.

getPhaseName

public java.lang.String getPhaseName()
Specified by:
getPhaseName in interface soot.HasPhaseOptions

getDefaultOptions

public java.lang.String getDefaultOptions()
Specified by:
getDefaultOptions in interface soot.HasPhaseOptions

getDeclaredOptions

public java.lang.String getDeclaredOptions()
Specified by:
getDeclaredOptions in interface soot.HasPhaseOptions

internalTransform

protected void internalTransform(java.lang.String phaseName,
                                 java.util.Map options)
Specified by:
internalTransform in class soot.SceneTransformer

eliminateNamedObjComparisons

public static boolean eliminateNamedObjComparisons(soot.SootMethod method,
                                                   boolean debug)
Remove comparisons between equal objects in the given method.

Parameters:
method - The method upon which to operate.
debug - True if debug messages should be printed.
Returns:
True if something was done to the method.

getNamedObjValue

public static NamedObj getNamedObjValue(soot.SootMethod method,
                                        soot.Local local,
                                        soot.Unit location,
                                        soot.toolkits.scalar.LocalDefs localDefs,
                                        soot.toolkits.scalar.LocalUses localUses)
Attempt to determine the constant value of the given local, which is assumed to have a named object type. Walk backwards through all the possible places that the local may have been defined and try to symbolically evaluate the value of the variable. If the value can be determined, then return it, otherwise throw an exception

Parameters:
method - The method upon which to operate.
local - The given local, assumted to be of type NamedObj.
location - The location
localDefs - The local definitions.
localUses - The local uses.
Returns:
If the constant value can be returned, then return it, otherwise throw an exception.