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 createInstanceKeys 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 intALLOCATIONSAn ALLOCATIONS - based policy distinguishes instances by allocation site.static intCONSTANT_SPECIFICShould we use constant-specific keys?static TypeReferenceJavaLangAbstractStringBuilderstatic TypeReferenceJavaLangStringBufferstatic TypeReferenceJavaLangStringBuilderstatic intNONEThe NONE policy is not allocation-site basedstatic intSMUSH_MANYThis variant counts the N, number of allocation sites of a particular type T in each method.static intSMUSH_PRIMITIVE_HOLDERSA policy variant where if a type T has only primitive instance fields, then instances of type T are NOT disambiguated by allocation site.static intSMUSH_STRINGSA policy variant where String and StringBuffers are NOT disambiguated according to allocation site.static intSMUSH_THROWABLESA policy variant whereThrowableinstances are NOT disambiguated according to allocation site.protected Map<CGNode,Set<IClass>>smushMapa 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 booleandisambiguateConstants()ClassBasedInstanceKeysgetClassBasedInstanceKeys()protected IClassHierarchygetClassHierarchy()InstanceKeygetInstanceKeyForAllocation(CGNode node, NewSiteReference allocation)<T> InstanceKeygetInstanceKeyForConstant(TypeReference type, T S)InstanceKeygetInstanceKeyForMetadataObject(Object obj, TypeReference objType)InstanceKeygetInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim)InstanceKeygetInstanceKeyForPEI(CGNode node, ProgramCounter pei, TypeReference type)booleanisInteresting(IClass C)A class is "interesting" iff we distinguish instances of the classstatic booleanisStackTraceElement(IClass c)static booleanisStringish(IClass C)static booleanisThrowable(IClass c)booleansmushThrowables()
-
-
-
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 whereThrowableinstances 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:
getInstanceKeyForAllocationin interfaceInstanceKeyFactory- Returns:
- the instance key that represents a particular allocation
-
getInstanceKeyForMultiNewArray
public InstanceKey getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim)
- Specified by:
getInstanceKeyForMultiNewArrayin 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:
getInstanceKeyForConstantin 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:
getInstanceKeyForPEIin 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:
getInstanceKeyForMetadataObjectin interfaceInstanceKeyFactoryobjType- 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()
-
-