com.ibm.wala.analysis.typeInference
Class TypeInference

java.lang.Object
  extended by com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver<T>
      extended by com.ibm.wala.fixedpoint.impl.DefaultFixedPointSolver<T>
          extended by com.ibm.wala.dataflow.ssa.SSAInference<TypeVariable>
              extended by 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
protected  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
 
Field Summary
protected  TypeAbstraction BOTTOM
          A cone type for java.lang.Object
protected  IClassHierarchy cha
          The governing class hierarchy
protected  boolean doPrimitives
          should type inference track primitive types?
protected  IR ir
          The governing SSA form
 
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
protected TypeInference(IR ir, boolean doPrimitives)
           
 
Method Summary
 TypeAbstraction getConstantPrimitiveType(int valueNumber)
           
 TypeAbstraction getConstantType(int valueNumber)
           
 IR getIR()
           
 TypeAbstraction getType(int valueNumber)
          Return the type computed for a particular value number
protected  void initialize()
           
protected  void initializeVariables()
          Initialize all lattice vars in the system.
protected  void initializeWorkList()
          Initialize the work list for iteration.j
 boolean isUndefined(int valueNumber)
           
static TypeInference make(IR ir, boolean doPrimitives)
           
 boolean solve()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ir

protected final IR ir
The governing SSA form


cha

protected final IClassHierarchy cha
The governing class hierarchy


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()
Description copied from class: AbstractFixedPointSolver
Solve the set of dataflow graph.

PRECONDITION: graph is set up

Specified by:
solve in interface IFixedPointSolver<TypeVariable>
Overrides:
solve in class AbstractFixedPointSolver<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 class AbstractFixedPointSolver<TypeVariable>

initializeWorkList

protected void initializeWorkList()
Description copied from class: AbstractFixedPointSolver
Initialize the work list for iteration.j

Specified by:
initializeWorkList in class AbstractFixedPointSolver<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)