Class TypeInference
- java.lang.Object
-
- com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver<T>
-
- com.ibm.wala.fixedpoint.impl.DefaultFixedPointSolver<T>
-
- com.ibm.wala.dataflow.ssa.SSAInference<TypeVariable>
-
- com.ibm.wala.analysis.typeInference.TypeInference
-
- All Implemented Interfaces:
FixedPointConstants,IFixedPointSolver<TypeVariable>,VerboseAction
- Direct Known Subclasses:
AstTypeInference
public class TypeInference extends SSAInference<TypeVariable> implements FixedPointConstants
This class performs intraprocedural type propagation on an SSA IR.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTypeInference.DeclaredTypeOperatorAn operator which initializes a type to a declared type.protected static classTypeInference.PrimitivePropagateOperatorprotected classTypeInference.TypeOperatorFactoryclassTypeInference.TypeVarFactory-
Nested classes/interfaces inherited from class com.ibm.wala.dataflow.ssa.SSAInference
SSAInference.OperatorFactory<T extends IVariable>, SSAInference.VariableFactory
-
Nested classes/interfaces inherited from class com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver
AbstractFixedPointSolver.Statement
-
-
Field Summary
Fields Modifier and Type Field Description protected TypeAbstractionBOTTOMA cone type for java.lang.Objectprotected IClassHierarchychaThe governing class hierarchyprotected booleandoPrimitivesshould type inference track primitive types?protected IRirThe governing SSA formprotected Languagelanguage-
Fields inherited from class com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver
DEFAULT_PERIODIC_MAINTENANCE_INTERVAL, DEFAULT_VERBOSE_INTERVAL, verbose, workList
-
Fields inherited from interface com.ibm.wala.fixpoint.FixedPointConstants
CHANGED, CHANGED_AND_FIXED, CHANGED_MASK, FIXED_MASK, NOT_CHANGED, NOT_CHANGED_AND_FIXED, SIDE_EFFECT_MASK
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypeInference(IR ir, boolean doPrimitives)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeAbstraction[]extractAllResults()Extract all results of the type inference analysis.TypeAbstractiongetConstantPrimitiveType(int valueNumber)TypeAbstractiongetConstantType(int valueNumber)IRgetIR()TypeAbstractiongetType(int valueNumber)Return the type computed for a particular value numberprotected voidinitialize()protected voidinitializeVariables()Initialize all lattice vars in the system.protected voidinitializeWorkList()Initialize the work list for iteration.jbooleanisUndefined(int valueNumber)static TypeInferencemake(IR ir, boolean doPrimitives)protected TypeVariable[]makeStmtRHS(int size)booleansolve()booleansolve(MonitorUtil.IProgressMonitor monitor)Solve the set of dataflow graph.-
Methods inherited from class com.ibm.wala.dataflow.ssa.SSAInference
getVariable, init, toString
-
Methods inherited from class com.ibm.wala.fixedpoint.impl.DefaultFixedPointSolver
getFixedPointSystem
-
Methods inherited from class com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver
addAllStatementsToWorkList, addToWorkList, changedVariable, emptyWorkList, getMaxEvalBetweenTopo, getMinSizeForTopSort, getNumberOfEvaluations, getPeriodicMaintainInterval, getStatements, getTopologicalGrowthFactor, getVerboseInterval, incNumberOfEvaluations, initForFirstSolve, isChanged, isFixed, isSideEffect, lineBreak, newStatement, newStatement, newStatement, newStatement, newStatement, orderStatements, performVerboseAction, periodicMaintenance, removeStatement, setMaxEvalBetweenTopo, setMinEquationsForTopSort, setTopologicalGrowthFactor
-
-
-
-
Field Detail
-
ir
protected final IR ir
The governing SSA form
-
cha
protected final IClassHierarchy cha
The governing class hierarchy
-
language
protected final Language language
-
BOTTOM
protected final TypeAbstraction BOTTOM
A cone type for java.lang.Object
-
doPrimitives
protected final boolean doPrimitives
should type inference track primitive types?
-
-
Constructor Detail
-
TypeInference
protected TypeInference(IR ir, boolean doPrimitives)
-
-
Method Detail
-
make
public static TypeInference make(IR ir, boolean doPrimitives)
-
solve
public boolean solve()
-
solve
public boolean solve(MonitorUtil.IProgressMonitor monitor)
Description copied from class:AbstractFixedPointSolverSolve the set of dataflow graph.PRECONDITION: graph is set up
- Specified by:
solvein interfaceIFixedPointSolver<TypeVariable>- Overrides:
solvein classAbstractFixedPointSolver<TypeVariable>- Returns:
- true iff the evaluation of some equation caused a change in the value of some variable.
-
initialize
protected void initialize()
-
initializeVariables
protected void initializeVariables()
Description copied from class:AbstractFixedPointSolverInitialize all lattice vars in the system.- Specified by:
initializeVariablesin classAbstractFixedPointSolver<TypeVariable>
-
initializeWorkList
protected void initializeWorkList()
Description copied from class:AbstractFixedPointSolverInitialize the work list for iteration.j- Specified by:
initializeWorkListin classAbstractFixedPointSolver<TypeVariable>
-
getIR
public IR getIR()
-
getType
public TypeAbstraction getType(int valueNumber)
Return the type computed for a particular value number
-
getConstantType
public TypeAbstraction getConstantType(int valueNumber)
-
getConstantPrimitiveType
public TypeAbstraction getConstantPrimitiveType(int valueNumber)
-
isUndefined
public boolean isUndefined(int valueNumber)
-
extractAllResults
public TypeAbstraction[] extractAllResults()
Extract all results of the type inference analysis.- Returns:
- an array, where the i'th variable holds the type abstraction of the i'th value number.
-
makeStmtRHS
protected TypeVariable[] makeStmtRHS(int size)
- Specified by:
makeStmtRHSin classAbstractFixedPointSolver<TypeVariable>
-
-