ptolemy.copernicus.java
Class TypeSpecializer

java.lang.Object
  extended bysoot.Transformer
      extended bysoot.SceneTransformer
          extended byptolemy.copernicus.java.TypeSpecializer
All Implemented Interfaces:
soot.HasPhaseOptions

public class TypeSpecializer
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A transformer that modifies each class using the token types from ports. In particular, this class creates constraints in the same fashion as the Ptolemy II type system and solves those constraints. The resulting solution should correspond to valid Java types which are more specific (in the Ptolemy II sense) than the original Java types. The code is then transformed to use these more specific types.

This transformer is necessary because there are some token types that we want to make more specific, but that don't directly depend on the the types of a port. This transformation enables the token unboxing performed by the TokenToNativeTransformer

Since:
Ptolemy II 4.0
Version:
$Id: TypeSpecializer.java,v 1.38 2004/04/13 05:12:20 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()
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
           
static java.util.Map specializeTypes(boolean debug, soot.SootClass theClass, java.util.Set unsafeLocals, TypeSpecializerAnalysis typeAnalysis)
          Specialize all token types that appear in the given class, based on the given analysis.
static TypeSpecializer v(CompositeActor model)
          Return an instance of this transformer that will operate on the given model.
 
Methods inherited from class soot.SceneTransformer
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 TypeSpecializer 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)

specializeTypes

public static java.util.Map specializeTypes(boolean debug,
                                            soot.SootClass theClass,
                                            java.util.Set unsafeLocals,
                                            TypeSpecializerAnalysis typeAnalysis)
Specialize all token types that appear in the given class, based on the given analysis. Return a map from locals and fields in the class to their new specific Ptolemy type. Exclude locals in the given set from the typing algorithm.