Package ptolemy.copernicus.kernel
Class CastAndInstanceofEliminator
- java.lang.Object
-
- soot.Transformer
-
- soot.BodyTransformer
-
- ptolemy.copernicus.kernel.CastAndInstanceofEliminator
-
public class CastAndInstanceofEliminator extends soot.BodyTransformer
A 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 void
eliminateCastsAndInstanceOf(soot.Body body, java.lang.String phaseName, java.util.Set unsafeLocalSet, boolean debug)
java.lang.String
getDeclaredOptions()
protected void
internalTransform(soot.Body b, java.lang.String phaseName, java.util.Map options)
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.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.static CastAndInstanceofEliminator
v()
-
-
-
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:
internalTransform
in 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.
-
-