public class JvmShallowHeapAbstractState<ReferenceT,StateT extends LatticeAbstractState<StateT>> extends java.lang.Object implements JvmHeapAbstractState<StateT>
Modifier and Type | Field and Description |
---|---|
protected StateT |
defaultValue |
protected java.lang.Class<ReferenceT> |
referenceClass |
MapAbstractState<ReferenceT,StateT> |
referenceToObject |
Constructor and Description |
---|
JvmShallowHeapAbstractState(MapAbstractState<ReferenceT,StateT> referenceToObject,
java.lang.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.
|
Modifier and Type | Method and Description |
---|---|
JvmShallowHeapAbstractState<ReferenceT,StateT> |
copy()
Creates a copy of itself.
|
boolean |
equals(java.lang.Object o) |
void |
expand(JvmHeapAbstractState<StateT> otherState)
Expands the state with all the entries from another heap state with reference not already known
by the state.
|
<T> StateT |
getArrayElementOrDefault(T array,
StateT index,
StateT defaultValue)
Returns an
array element at the specified index or the defaultValue , if
the element is unset. |
<T> StateT |
getFieldOrDefault(T object,
java.lang.String fqn,
StateT defaultValue)
Returns a field
fqn from a reference object . |
int |
hashCode() |
boolean |
isLessOrEqual(JvmHeapAbstractState<StateT> abstractState)
Compares itself to the
abstractState . |
JvmShallowHeapAbstractState<ReferenceT,StateT> |
join(JvmHeapAbstractState<StateT> abstractState)
Computes a join over itself and the
abstractState . |
StateT |
newArray(java.lang.String type,
java.util.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.
|
StateT |
newObject(java.lang.String className,
JvmCfaNode creationCite)
Creates a new object of a given class at a specific program point and returns a reference to
it.
|
void |
reduce(java.util.Set<java.lang.Object> referencesToKeep)
Discards all the references not in .
|
<T> void |
setArrayElement(T array,
StateT index,
StateT value)
Sets the
array element value at the specified index . |
<T> void |
setField(T object,
java.lang.String fqn,
StateT value)
Sets a
value to a field fqn of a referenced object . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
newObject
isLess
getPrecision, getStateByName
public final MapAbstractState<ReferenceT,StateT extends LatticeAbstractState<StateT>> referenceToObject
protected final java.lang.Class<ReferenceT> referenceClass
protected final StateT extends LatticeAbstractState<StateT> defaultValue
public JvmShallowHeapAbstractState(MapAbstractState<ReferenceT,StateT> referenceToObject, java.lang.Class<ReferenceT> referenceClass, StateT defaultValue)
defaultValue
- the value to be returned by memory accessesreferenceClass
- the class of the reference used for addressingreferenceToObject
- the value to be returned by memory accessespublic void reduce(java.util.Set<java.lang.Object> referencesToKeep)
reduce
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
referencesToKeep
- information on the references to keep or discard, based on the
implementation. Unused in the default implementationpublic void expand(JvmHeapAbstractState<StateT> otherState)
expand
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
otherState
- a heap state from which expanding the heap (e.g. the state calling a method
to recover information discarded from it)public <T> StateT getFieldOrDefault(T object, java.lang.String fqn, StateT defaultValue)
JvmHeapAbstractState
fqn
from a reference object
. If there is no abstract state
representing the field, returns the defaultValue
getFieldOrDefault
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public <T> void setField(T object, java.lang.String fqn, StateT value)
JvmHeapAbstractState
value
to a field fqn
of a referenced object
.setField
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public <T> StateT getArrayElementOrDefault(T array, StateT index, StateT defaultValue)
JvmHeapAbstractState
array
element at the specified index
or the defaultValue
, if
the element is unset.getArrayElementOrDefault
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public <T> void setArrayElement(T array, StateT index, StateT value)
JvmHeapAbstractState
array
element value
at the specified index
.setArrayElement
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public StateT newObject(java.lang.String className, JvmCfaNode creationCite)
JvmHeapAbstractState
newObject
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public StateT newArray(java.lang.String type, java.util.List<StateT> dimensions, JvmCfaNode creationCite)
JvmHeapAbstractState
newArray
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>
public JvmShallowHeapAbstractState<ReferenceT,StateT> join(JvmHeapAbstractState<StateT> abstractState)
LatticeAbstractState
abstractState
.join
in interface LatticeAbstractState<JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>>
public boolean isLessOrEqual(JvmHeapAbstractState<StateT> abstractState)
LatticeAbstractState
abstractState
.isLessOrEqual
in interface LatticeAbstractState<JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>>
public boolean equals(java.lang.Object o)
equals
in interface AbstractState
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface AbstractState
hashCode
in class java.lang.Object
public JvmShallowHeapAbstractState<ReferenceT,StateT> copy()
AbstractState
copy
in interface AbstractState
copy
in interface JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>>