com.ibm.wala.ipa.modref
Class DelegatingExtendedHeapModel

java.lang.Object
  extended by com.ibm.wala.ipa.modref.DelegatingExtendedHeapModel
All Implemented Interfaces:
HeapModel, InstanceKeyFactory, PointerKeyFactory, ExtendedHeapModel

public class DelegatingExtendedHeapModel
extends java.lang.Object
implements ExtendedHeapModel

An implementation of ExtendedHeapModel based on a normal HeapModel


Constructor Summary
DelegatingExtendedHeapModel(HeapModel h)
           
 
Method Summary
 ClassHierarchy getClassHierarchy()
           
 FilteredPointerKey getFilteredPointerKeyForLocal(CGNode node, int valueNumber, FilteredPointerKey.TypeFilter filter)
           
 InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation)
           
 InstanceKey getInstanceKeyForClassObject(TypeReference type)
           
 InstanceKey getInstanceKeyForConstant(java.lang.Object S)
           
 InstanceKey getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim)
           
 InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter instr, TypeReference type)
           
 PointerKey getPointerKeyForArrayContents(InstanceKey I)
          TODO: expand this API to differentiate between different array indices
 PointerKey getPointerKeyForArrayLength(InstanceKey I)
           
 PointerKey getPointerKeyForExceptionalReturnValue(CGNode node)
           
 PointerKey getPointerKeyForInstanceField(InstanceKey I, IField field)
           
 PointerKey getPointerKeyForLocal(CGNode node, int valueNumber)
           
 PointerKey getPointerKeyForReturnValue(CGNode node)
           
 PointerKey getPointerKeyForStaticField(IField f)
           
 java.lang.String getStringConstantForInstanceKey(InstanceKey I)
           
 java.util.Iterator iteratePointerKeys()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingExtendedHeapModel

public DelegatingExtendedHeapModel(HeapModel h)
Method Detail

getClassHierarchy

public ClassHierarchy getClassHierarchy()
Specified by:
getClassHierarchy in interface HeapModel
Returns:
the governing class hierarchy for this heap model

getFilteredPointerKeyForLocal

public FilteredPointerKey getFilteredPointerKeyForLocal(CGNode node,
                                                        int valueNumber,
                                                        FilteredPointerKey.TypeFilter filter)
Specified by:
getFilteredPointerKeyForLocal in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representative for the class of pointers that includes the local variable identified by the value number parameter.

getInstanceKeyForAllocation

public InstanceKey getInstanceKeyForAllocation(CGNode node,
                                               NewSiteReference allocation)
Specified by:
getInstanceKeyForAllocation in interface InstanceKeyFactory
Returns:
the instance key that represents a particular allocation

getInstanceKeyForClassObject

public InstanceKey getInstanceKeyForClassObject(TypeReference type)
Specified by:
getInstanceKeyForClassObject in interface InstanceKeyFactory
Returns:
the instance key that represents the class object of type _type_.

getInstanceKeyForConstant

public InstanceKey getInstanceKeyForConstant(java.lang.Object S)
Specified by:
getInstanceKeyForConstant in interface InstanceKeyFactory
Returns:
the instance key that represents a constant with value S

getInstanceKeyForMultiNewArray

public InstanceKey getInstanceKeyForMultiNewArray(CGNode node,
                                                  NewSiteReference allocation,
                                                  int dim)
Specified by:
getInstanceKeyForMultiNewArray in interface InstanceKeyFactory
Returns:
the instance key that represents the array allocated as the dimth dimension at a particular allocation

getInstanceKeyForPEI

public InstanceKey getInstanceKeyForPEI(CGNode node,
                                        ProgramCounter instr,
                                        TypeReference type)
Specified by:
getInstanceKeyForPEI in interface InstanceKeyFactory
Returns:
the instance key that represents the exception of type _type_ thrown by a particular PEI.

getPointerKeyForArrayContents

public PointerKey getPointerKeyForArrayContents(InstanceKey I)
Description copied from interface: PointerKeyFactory
TODO: expand this API to differentiate between different array indices

Specified by:
getPointerKeyForArrayContents in interface PointerKeyFactory
Parameters:
I - an InstanceKey representing an abstract array
Returns:
the PointerKey that acts as a representation for the class of pointers that includes the given array contents.

getPointerKeyForExceptionalReturnValue

public PointerKey getPointerKeyForExceptionalReturnValue(CGNode node)
Specified by:
getPointerKeyForExceptionalReturnValue in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representative for the class of pointers that includes the exceptional return value

getPointerKeyForInstanceField

public PointerKey getPointerKeyForInstanceField(InstanceKey I,
                                                IField field)
Specified by:
getPointerKeyForInstanceField in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representation for the class of pointers that includes the given instance field.

getPointerKeyForLocal

public PointerKey getPointerKeyForLocal(CGNode node,
                                        int valueNumber)
Specified by:
getPointerKeyForLocal in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representative for the class of pointers that includes the local variable identified by the value number parameter.

getPointerKeyForReturnValue

public PointerKey getPointerKeyForReturnValue(CGNode node)
Specified by:
getPointerKeyForReturnValue in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representative for the class of pointers that includes the return value for a node

getPointerKeyForStaticField

public PointerKey getPointerKeyForStaticField(IField f)
Specified by:
getPointerKeyForStaticField in interface PointerKeyFactory
Returns:
the PointerKey that acts as a representative for the class of pointers that includes the contents of the static field

getStringConstantForInstanceKey

public java.lang.String getStringConstantForInstanceKey(InstanceKey I)
Specified by:
getStringConstantForInstanceKey in interface InstanceKeyFactory
Returns:
if I was allocated by this for a specific string constant, return that constant (return null otherwise).

iteratePointerKeys

public java.util.Iterator iteratePointerKeys()
Specified by:
iteratePointerKeys in interface HeapModel
Returns:
an Iterator of all PointerKeys that are modelled.

getPointerKeyForArrayLength

public PointerKey getPointerKeyForArrayLength(InstanceKey I)
Specified by:
getPointerKeyForArrayLength in interface ExtendedHeapModel
Parameters:
I - an InstanceKey representing an abstract array
Returns:
the PointerKey that acts as a representation for the arraylength field of this abstract array