Class JvmShallowHeapAbstractState<ReferenceT,StateT extends AbstractState<StateT>>
java.lang.Object
proguard.analysis.cpa.jvm.state.heap.tree.JvmShallowHeapAbstractState<ReferenceT,StateT>
- All Implemented Interfaces:
AbstractState<JvmHeapAbstractState<StateT>>,JvmHeapAbstractState<StateT>
public class JvmShallowHeapAbstractState<ReferenceT,StateT extends AbstractState<StateT>>
extends Object
implements JvmHeapAbstractState<StateT>
A shallow heap models objects as atomic abstract states thus having only one level of depth.
Object fields are not modeled. References of wrong types are ignored.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StateTprotected final Class<ReferenceT>final MapAbstractState<ReferenceT,StateT> -
Constructor Summary
ConstructorsConstructorDescriptionJvmShallowHeapAbstractState(MapAbstractState<ReferenceT, StateT> referenceToObject, Class<ReferenceT> referenceClass, StateT defaultValue) Create a shallow heap abstract state returning the specified value for all queries from an existing reference to abstract state map. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of itself.booleanvoidexpand(JvmHeapAbstractState<StateT> otherState) Expands the state with all the entries from another heap state with reference not already known by the state.<T> StateTgetArrayElementOrDefault(T array, StateT index, StateT defaultValue) Returns anarrayelement at the specifiedindexor thedefaultValue, if the element is unset.<T> StateTgetFieldOrDefault(T object, String fqn, StateT defaultValue) Returns a fieldfqnfrom a referenceobject.inthashCode()booleanisLessOrEqual(JvmHeapAbstractState<StateT> abstractState) Compares itself to theabstractState(i.e., compare the states on the partial order provided by the domain of the analysis).join(JvmHeapAbstractState<StateT> abstractState) Computes a join over itself and another abstract stateabstractState(i.e., finds the least upper bound on the semilattice).newArray(String type, List<StateT> dimensions, JvmCfaNode creationCite) Creates a new array of a given class with the given dimension sizes at a specific program point and returns a reference to it.newObject(String className, JvmCfaNode creationCite) Creates a new object of a given class at a specific program point and returns a reference to it.voidDiscards all the references not in .<T> voidsetArrayElement(T array, StateT index, StateT value) Sets thearrayelementvalueat the specifiedindex.<T> voidSets avalueto a fieldfqnof a referencedobject.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface proguard.analysis.cpa.interfaces.AbstractState
getPrecision, isLessMethods inherited from interface proguard.analysis.cpa.jvm.state.heap.JvmHeapAbstractState
newObject
-
Field Details
-
referenceToObject
-
referenceClass
-
defaultValue
-
-
Constructor Details
-
JvmShallowHeapAbstractState
public JvmShallowHeapAbstractState(MapAbstractState<ReferenceT, StateT> referenceToObject, Class<ReferenceT> referenceClass, StateT defaultValue) Create a shallow heap abstract state returning the specified value for all queries from an existing reference to abstract state map.- Parameters:
defaultValue- the value to be returned by memory accessesreferenceClass- the class of the reference used for addressingreferenceToObject- the value to be returned by memory accesses
-
-
Method Details
-
reduce
Discards all the references not in .- Specified by:
reducein interfaceJvmHeapAbstractState<ReferenceT>- Parameters:
referencesToKeep- information on the references to keep or discard, based on the implementation. Unused in the default implementation
-
expand
Expands the state with all the entries from another heap state with reference not already known by the state.- Specified by:
expandin interfaceJvmHeapAbstractState<ReferenceT>- Parameters:
otherState- a heap state from which expanding the heap (e.g. the state calling a method to recover information discarded from it)
-
getFieldOrDefault
Description copied from interface:JvmHeapAbstractStateReturns a fieldfqnfrom a referenceobject. If there is no abstract state representing the field, returns thedefaultValue- Specified by:
getFieldOrDefaultin interfaceJvmHeapAbstractState<ReferenceT>
-
setField
Description copied from interface:JvmHeapAbstractStateSets avalueto a fieldfqnof a referencedobject.- Specified by:
setFieldin interfaceJvmHeapAbstractState<ReferenceT>
-
getArrayElementOrDefault
Description copied from interface:JvmHeapAbstractStateReturns anarrayelement at the specifiedindexor thedefaultValue, if the element is unset.- Specified by:
getArrayElementOrDefaultin interfaceJvmHeapAbstractState<ReferenceT>
-
setArrayElement
Description copied from interface:JvmHeapAbstractStateSets thearrayelementvalueat the specifiedindex.- Specified by:
setArrayElementin interfaceJvmHeapAbstractState<ReferenceT>
-
newObject
Description copied from interface:JvmHeapAbstractStateCreates a new object of a given class at a specific program point and returns a reference to it.- Specified by:
newObjectin interfaceJvmHeapAbstractState<ReferenceT>
-
newArray
Description copied from interface:JvmHeapAbstractStateCreates a new array of a given class with the given dimension sizes at a specific program point and returns a reference to it.- Specified by:
newArrayin interfaceJvmHeapAbstractState<ReferenceT>
-
join
public JvmShallowHeapAbstractState<ReferenceT,StateT> join(JvmHeapAbstractState<StateT> abstractState) Description copied from interface:AbstractStateComputes a join over itself and another abstract stateabstractState(i.e., finds the least upper bound on the semilattice).- Specified by:
joinin interfaceAbstractState<ReferenceT>
-
isLessOrEqual
Description copied from interface:AbstractStateCompares itself to theabstractState(i.e., compare the states on the partial order provided by the domain of the analysis).- Specified by:
isLessOrEqualin interfaceAbstractState<ReferenceT>
-
equals
- Specified by:
equalsin interfaceAbstractState<ReferenceT>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceAbstractState<ReferenceT>- Overrides:
hashCodein classObject
-
copy
Description copied from interface:AbstractStateCreates a copy of itself.- Specified by:
copyin interfaceAbstractState<ReferenceT>- Specified by:
copyin interfaceJvmHeapAbstractState<ReferenceT>
-