ptolemy.copernicus.java
Class InlineTokenTransformer

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

public class InlineTokenTransformer
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A Transformer that is responsible for inlining the values of tokens. Whenever a method is invoked on a token, this transformer attempts to compile-time evaluate that method call. Usually this will involve inserting the constant value of the token, if this transformer can determine what that value is. Information about the values of tokens comes from two places: Analysis of token constructors (using the TokenConstructorAnalysis class) and value information that is annotated into the model by previous transformation steps using a ValueTag.

Since:
Ptolemy II 2.0
Version:
$Id: InlineTokenTransformer.java,v 1.54 2006/10/25 00:17:28 cxh Exp $
Author:
Stephen Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Method Summary
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
 java.lang.String getPhaseName()
           
static Token getTokenValue(soot.Local local, soot.Unit location, soot.toolkits.scalar.LocalDefs localDefs, TokenConstructorAnalysis tokenAnalysis)
          Attempt to determine the constant value of the given local, which is assumed to have a token type.
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
           
static InlineTokenTransformer 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 InlineTokenTransformer 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

getTokenValue

public static Token getTokenValue(soot.Local local,
                                  soot.Unit location,
                                  soot.toolkits.scalar.LocalDefs localDefs,
                                  TokenConstructorAnalysis tokenAnalysis)
Attempt to determine the constant value of the given local, which is assumed to have a token type. Walk backwards through all the possible places that the local may have been defined and try to symbolically evaluate the token. If the value can be determined, then return it, otherwise return null.