ptolemy.copernicus.java
Class TokenToNativeTransformer

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

public class TokenToNativeTransformer
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A transformer that is responsible for unboxing tokens, i.e. replacing the token with the value that is contained by that token. This transformer attempts to do this by replacing each token with the fields contained in the appropriate token class and inlining the methods that are implemented for that token class. This is made more complex by the fact that tokens may themselves be contained by other tokens.

Since:
Ptolemy II 2.0
Version:
$Id: TokenToNativeTransformer.java,v 1.114 2008/01/24 00:34:38 cxh Exp $
Author:
Stephen Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Method Summary
static soot.Value _getNullValueForType(soot.Type type)
           
static java.util.List _getTokenClassFields(soot.SootClass tokenClass)
           
static boolean _handleImmediateAssignment(soot.jimple.JimpleBody body, soot.jimple.AssignStmt stmt, java.util.Map localToFieldToLocal, java.util.Map localToIsNotNullLocal, soot.Value leftValue, soot.Value rightValue, boolean debug)
           
 boolean _inlineTokenMethodsIn(soot.SootMethod method, soot.jimple.JimpleBody body, soot.Unit unit, soot.ValueBox box, soot.toolkits.scalar.SimpleLocalDefs localDefs, soot.toolkits.scalar.SimpleLocalUses localUses, TypeSpecializerAnalysis typeAnalysis, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
 boolean _inlineTypeMethodsIn(soot.SootMethod method, soot.jimple.JimpleBody body, soot.Unit unit, soot.ValueBox box, soot.toolkits.scalar.SimpleLocalDefs localDefs, soot.toolkits.scalar.SimpleLocalUses localUses, TypeSpecializerAnalysis typeAnalysis, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
 void createReplacementTokenFields(soot.SootClass entityClass, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
 java.lang.String getPhaseName()
           
 void inlineTokenAndTypeMethods(soot.SootClass entityClass, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
 void inlineTypeMethods(soot.SootClass entityClass, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
           
 void replaceTokenFields(soot.SootClass entityClass, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
 void updateTokenTypes(java.util.List classList, int depth, java.util.Set unsafeLocalSet, boolean debug)
           
static TokenToNativeTransformer 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 TokenToNativeTransformer 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.


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

updateTokenTypes

public void updateTokenTypes(java.util.List classList,
                             int depth,
                             java.util.Set unsafeLocalSet,
                             boolean debug)

inlineTokenAndTypeMethods

public void inlineTokenAndTypeMethods(soot.SootClass entityClass,
                                      int depth,
                                      java.util.Set unsafeLocalSet,
                                      boolean debug)

_inlineTokenMethodsIn

public boolean _inlineTokenMethodsIn(soot.SootMethod method,
                                     soot.jimple.JimpleBody body,
                                     soot.Unit unit,
                                     soot.ValueBox box,
                                     soot.toolkits.scalar.SimpleLocalDefs localDefs,
                                     soot.toolkits.scalar.SimpleLocalUses localUses,
                                     TypeSpecializerAnalysis typeAnalysis,
                                     int depth,
                                     java.util.Set unsafeLocalSet,
                                     boolean debug)

inlineTypeMethods

public void inlineTypeMethods(soot.SootClass entityClass,
                              int depth,
                              java.util.Set unsafeLocalSet,
                              boolean debug)

_inlineTypeMethodsIn

public boolean _inlineTypeMethodsIn(soot.SootMethod method,
                                    soot.jimple.JimpleBody body,
                                    soot.Unit unit,
                                    soot.ValueBox box,
                                    soot.toolkits.scalar.SimpleLocalDefs localDefs,
                                    soot.toolkits.scalar.SimpleLocalUses localUses,
                                    TypeSpecializerAnalysis typeAnalysis,
                                    int depth,
                                    java.util.Set unsafeLocalSet,
                                    boolean debug)

createReplacementTokenFields

public void createReplacementTokenFields(soot.SootClass entityClass,
                                         int depth,
                                         java.util.Set unsafeLocalSet,
                                         boolean debug)

replaceTokenFields

public void replaceTokenFields(soot.SootClass entityClass,
                               int depth,
                               java.util.Set unsafeLocalSet,
                               boolean debug)

_getNullValueForType

public static soot.Value _getNullValueForType(soot.Type type)

_getTokenClassFields

public static java.util.List _getTokenClassFields(soot.SootClass tokenClass)

_handleImmediateAssignment

public static boolean _handleImmediateAssignment(soot.jimple.JimpleBody body,
                                                 soot.jimple.AssignStmt stmt,
                                                 java.util.Map localToFieldToLocal,
                                                 java.util.Map localToIsNotNullLocal,
                                                 soot.Value leftValue,
                                                 soot.Value rightValue,
                                                 boolean debug)