Class ZeroXInstanceKeys
- java.lang.Object
-
- com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys
-
- All Implemented Interfaces:
InstanceKeyFactory
public class ZeroXInstanceKeys extends Object implements InstanceKeyFactory
Flexible class to createInstanceKey
s depending on various policies ranging from class-based (i.e. 0-CFA) to allocation-site-based (0-1-CFA variants).
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALLOCATIONS
An ALLOCATIONS - based policy distinguishes instances by allocation site.static int
CONSTANT_SPECIFIC
Should we use constant-specific keys?static TypeReference
JavaLangAbstractStringBuilder
static TypeReference
JavaLangStringBuffer
static TypeReference
JavaLangStringBuilder
static int
NONE
The NONE policy is not allocation-site basedstatic int
SMUSH_MANY
This variant counts the N, number of allocation sites of a particular type T in each method.static int
SMUSH_PRIMITIVE_HOLDERS
A policy variant where if a type T has only primitive instance fields, then instances of type T are NOT disambiguated by allocation site.static int
SMUSH_STRINGS
A policy variant where String and StringBuffers are NOT disambiguated according to allocation site.static int
SMUSH_THROWABLES
A policy variant whereThrowable
instances are NOT disambiguated according to allocation site.protected Map<CGNode,Set<IClass>>
smushMap
a Map from CGNode->Setthat should be smushed.
-
Constructor Summary
Constructors Constructor Description ZeroXInstanceKeys(AnalysisOptions options, IClassHierarchy cha, RTAContextInterpreter contextInterpreter, int policy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
disambiguateConstants()
ClassBasedInstanceKeys
getClassBasedInstanceKeys()
protected IClassHierarchy
getClassHierarchy()
InstanceKey
getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation)
<T> InstanceKey
getInstanceKeyForConstant(TypeReference type, T S)
InstanceKey
getInstanceKeyForMetadataObject(Object obj, TypeReference objType)
InstanceKey
getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim)
InstanceKey
getInstanceKeyForPEI(CGNode node, ProgramCounter pei, TypeReference type)
boolean
isInteresting(IClass C)
A class is "interesting" iff we distinguish instances of the classstatic boolean
isStackTraceElement(IClass c)
static boolean
isStringish(IClass C)
static boolean
isThrowable(IClass c)
boolean
smushThrowables()
-
-
-
Field Detail
-
JavaLangStringBuffer
public static final TypeReference JavaLangStringBuffer
-
JavaLangStringBuilder
public static final TypeReference JavaLangStringBuilder
-
JavaLangAbstractStringBuilder
public static final TypeReference JavaLangAbstractStringBuilder
-
NONE
public static final int NONE
The NONE policy is not allocation-site based- See Also:
- Constant Field Values
-
ALLOCATIONS
public static final int ALLOCATIONS
An ALLOCATIONS - based policy distinguishes instances by allocation site. Otherwise, the policy distinguishes instances by type.- See Also:
- Constant Field Values
-
SMUSH_STRINGS
public static final int SMUSH_STRINGS
A policy variant where String and StringBuffers are NOT disambiguated according to allocation site.- See Also:
- Constant Field Values
-
SMUSH_THROWABLES
public static final int SMUSH_THROWABLES
A policy variant whereThrowable
instances are NOT disambiguated according to allocation site.- See Also:
- Constant Field Values
-
SMUSH_PRIMITIVE_HOLDERS
public static final int SMUSH_PRIMITIVE_HOLDERS
A policy variant where if a type T has only primitive instance fields, then instances of type T are NOT disambiguated by allocation site.- See Also:
- Constant Field Values
-
SMUSH_MANY
public static final int SMUSH_MANY
This variant counts the N, number of allocation sites of a particular type T in each method. If N > SMUSH_LIMIT, then these N allocation sites are NOT distinguished ... instead there is a single abstract allocation site forProbably the best choice in many cases. - See Also:
- Constant Field Values
-
CONSTANT_SPECIFIC
public static final int CONSTANT_SPECIFIC
Should we use constant-specific keys?- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZeroXInstanceKeys
public ZeroXInstanceKeys(AnalysisOptions options, IClassHierarchy cha, RTAContextInterpreter contextInterpreter, int policy)
-
-
Method Detail
-
smushThrowables
public boolean smushThrowables()
-
disambiguateConstants
public boolean disambiguateConstants()
-
getInstanceKeyForAllocation
public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation)
- Specified by:
getInstanceKeyForAllocation
in interfaceInstanceKeyFactory
- Returns:
- the instance key that represents a particular allocation
-
getInstanceKeyForMultiNewArray
public InstanceKey getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim)
- Specified by:
getInstanceKeyForMultiNewArray
in interfaceInstanceKeyFactory
- Returns:
- the instance key that represents the array allocated as the dim_th dimension at a particular allocation
-
getInstanceKeyForConstant
public <T> InstanceKey getInstanceKeyForConstant(TypeReference type, T S)
- Specified by:
getInstanceKeyForConstant
in interfaceInstanceKeyFactory
- Returns:
- the instance key that represents a constant with value S, when considered as a particular type
-
getInstanceKeyForPEI
public InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter pei, TypeReference type)
- Specified by:
getInstanceKeyForPEI
in interfaceInstanceKeyFactory
- Returns:
- the instance key that represents the exception of type _type_ thrown by a particular PEI.
-
getInstanceKeyForMetadataObject
public InstanceKey getInstanceKeyForMetadataObject(Object obj, TypeReference objType)
- Specified by:
getInstanceKeyForMetadataObject
in interfaceInstanceKeyFactory
objType
- TODO- Returns:
- the instance key that represents the metadata object obj
-
isInteresting
public boolean isInteresting(IClass C)
A class is "interesting" iff we distinguish instances of the class
-
isStringish
public static boolean isStringish(IClass C)
-
isThrowable
public static boolean isThrowable(IClass c)
-
isStackTraceElement
public static boolean isStackTraceElement(IClass c)
-
getClassHierarchy
protected IClassHierarchy getClassHierarchy()
-
getClassBasedInstanceKeys
public ClassBasedInstanceKeys getClassBasedInstanceKeys()
-
-