Package ptolemy.copernicus.kernel
Class CastAndInstanceofEliminator
- java.lang.Object
-
- soot.Transformer
-
- soot.BodyTransformer
-
- ptolemy.copernicus.kernel.CastAndInstanceofEliminator
-
public class CastAndInstanceofEliminator extends soot.BodyTransformerA transformer that remove unnecessary casts and instanceof checks. Note that this relies on properly inferred Java types to operate properly. If you create code that has types which are too specific (relative to the inferred types) then this transformer will likely create code that is no longer verifiable.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Stephen Neuendorffer
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voideliminateCastsAndInstanceOf(soot.Body body, java.lang.String phaseName, java.util.Set unsafeLocalSet, boolean debug)java.lang.StringgetDeclaredOptions()protected voidinternalTransform(soot.Body b, java.lang.String phaseName, java.util.Map options)static voidreplaceCast(soot.ValueBox box, soot.Hierarchy hierarchy, soot.Type checkType, soot.Value op, soot.Type opType, boolean debug)Remove the case in the given box, if possible.static voidreplaceInstanceofCheck(soot.ValueBox box, soot.Hierarchy hierarchy, soot.Type checkType, soot.Type opType, boolean debug)Statically evaluate the instance of Check in the given box, if possible.static CastAndInstanceofEliminatorv()
-
-
-
Method Detail
-
v
public static CastAndInstanceofEliminator v()
-
getDeclaredOptions
public java.lang.String getDeclaredOptions()
-
internalTransform
protected void internalTransform(soot.Body b, java.lang.String phaseName, java.util.Map options)- Specified by:
internalTransformin classsoot.BodyTransformer
-
eliminateCastsAndInstanceOf
public static void eliminateCastsAndInstanceOf(soot.Body body, java.lang.String phaseName, java.util.Set unsafeLocalSet, boolean debug)
-
replaceInstanceofCheck
public static void replaceInstanceofCheck(soot.ValueBox box, soot.Hierarchy hierarchy, soot.Type checkType, soot.Type opType, boolean debug)Statically evaluate the instance of Check in the given box, if possible. If opType is always an instance of checkType, based on the given hierarchy, then replace with a true constant. If opType is never an instance of checkType, then replace with a false constant.
-
replaceCast
public static void replaceCast(soot.ValueBox box, soot.Hierarchy hierarchy, soot.Type checkType, soot.Value op, soot.Type opType, boolean debug)Remove the case in the given box, if possible. If opType is always an instance of checkType, based on the given hierarchy, then replace with an assignment.
-
-