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 class
TypeInference.DeclaredTypeOperator
An operator which initializes a type to a declared type.protected static class
TypeInference.PrimitivePropagateOperator
protected class
TypeInference.TypeOperatorFactory
class
TypeInference.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 TypeAbstraction
BOTTOM
A cone type for java.lang.Objectprotected IClassHierarchy
cha
The governing class hierarchyprotected boolean
doPrimitives
should type inference track primitive types?protected IR
ir
The governing SSA formprotected Language
language
-
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 protected
TypeInference(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.TypeAbstraction
getConstantPrimitiveType(int valueNumber)
TypeAbstraction
getConstantType(int valueNumber)
IR
getIR()
TypeAbstraction
getType(int valueNumber)
Return the type computed for a particular value numberprotected void
initialize()
protected void
initializeVariables()
Initialize all lattice vars in the system.protected void
initializeWorkList()
Initialize the work list for iteration.jboolean
isUndefined(int valueNumber)
static TypeInference
make(IR ir, boolean doPrimitives)
protected TypeVariable[]
makeStmtRHS(int size)
boolean
solve()
boolean
solve(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:AbstractFixedPointSolver
Solve the set of dataflow graph.PRECONDITION: graph is set up
- Specified by:
solve
in interfaceIFixedPointSolver<TypeVariable>
- Overrides:
solve
in 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:AbstractFixedPointSolver
Initialize all lattice vars in the system.- Specified by:
initializeVariables
in classAbstractFixedPointSolver<TypeVariable>
-
initializeWorkList
protected void initializeWorkList()
Description copied from class:AbstractFixedPointSolver
Initialize the work list for iteration.j- Specified by:
initializeWorkList
in 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:
makeStmtRHS
in classAbstractFixedPointSolver<TypeVariable>
-
-