public class JvmAbstractState<StateT extends LatticeAbstractState<StateT>> extends java.lang.Object implements LatticeAbstractState<JvmAbstractState<StateT>>, ProgramLocationDependent<JvmCfaNode,JvmCfaEdge,MethodSignature>
JvmAbstractState
consists of the method frame JvmFrameAbstractState
and the
heap JvmHeapAbstractState
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_FIELD |
protected JvmFrameAbstractState<StateT> |
frame |
protected JvmHeapAbstractState<StateT> |
heap |
protected JvmCfaNode |
programLocation |
protected MapAbstractState<java.lang.String,StateT> |
staticFields |
protected static JvmCfaNode |
topLocation |
Constructor and Description |
---|
JvmAbstractState(JvmCfaNode programLocation,
JvmFrameAbstractState<StateT> frame,
JvmHeapAbstractState<StateT> heap,
MapAbstractState<java.lang.String,StateT> staticFields)
Create a JVM abstract state.
|
Modifier and Type | Method and Description |
---|---|
void |
clearOperandStack()
Empties the operand stack.
|
JvmAbstractState<StateT> |
copy()
Creates a copy of itself.
|
boolean |
equals(java.lang.Object obj) |
<T> StateT |
getArrayElementOrDefault(T array,
StateT index,
StateT abstractDefault)
Returns an abstract state for the
array element at the given index or the
abstractDefault if there is no information available. |
<T> StateT |
getFieldOrDefault(T object,
StateT defaultValue)
Returns an abstract state representing the default field of the
object or defaultState if there is no entry. |
<T> StateT |
getFieldOrDefault(T object,
java.lang.String descriptor,
StateT defaultValue)
Returns an abstract state representing the field
descriptor of the object or
defaultState if there is no entry. |
JvmFrameAbstractState<StateT> |
getFrame()
Returns the frame abstract state.
|
JvmHeapAbstractState<StateT> |
getHeap()
Returns the heap abstract state.
|
JvmCfaNode |
getProgramLocation()
Returns the program location.
|
MapAbstractState<java.lang.String,StateT> |
getStaticFields()
Returns the static field table abstract state.
|
StateT |
getStaticOrDefault(java.lang.String fqn,
StateT defaultState)
Returns an abstract state representing the static field
fqn or defaultState if
there is no entry. |
StateT |
getVariableOrDefault(int index,
StateT defaultState)
Returns an abstract state at the
index th position of the variable array or defaultState if there is no entry. |
int |
hashCode() |
boolean |
isLessOrEqual(JvmAbstractState<StateT> abstractState)
Compares itself to the
abstractState . |
JvmAbstractState<StateT> |
join(JvmAbstractState<StateT> abstractState)
Computes a join over itself and the
abstractState . |
StateT |
newArray(java.lang.String type,
java.util.List<StateT> dimensions)
Returns an abstract state for a new array for the given
type and dimentions . |
StateT |
newObject(Clazz clazz)
Returns an abstract state for a new object of the given
Clazz . |
StateT |
newObject(java.lang.String className)
Returns an abstract state for a new object of the given
className . |
StateT |
peek()
Returns the top element of the operand stack.
|
StateT |
peek(int index)
Returns the
index th element from the top of the operand stack. |
StateT |
peekOrDefault(int index,
StateT defaultState)
Returns the
index th element from the top of the operand stack or returns defaultState if the stack does not have enough elements. |
StateT |
peekOrDefault(StateT defaultState)
Returns the top element of the operand stack or returns
defaultState if the stack is
empty. |
StateT |
pop()
Removes the top element of the operand stack end returns it.
|
StateT |
popOrDefault(StateT defaultState)
Removes the top element of the operand stack end returns it.
|
StateT |
push(StateT state)
Inserts
state to the top of the operand stack and returns it. |
java.util.List<StateT> |
pushAll(java.util.List<StateT> states)
Consequentially inserts elements of
states to the top of the operand stack and returns
states . |
<T> void |
setArrayElement(T array,
StateT index,
StateT value)
Sets the
array element at the given index to the value . |
<T> void |
setField(T object,
StateT value)
Sets the default field of the
object to value . |
<T> void |
setField(T object,
java.lang.String descriptor,
StateT value)
Sets the field
descriptor of the object to value . |
void |
setProgramLocation(JvmCfaNode programLocation)
Sets the program location.
|
void |
setStatic(java.lang.String fqn,
StateT value,
StateT defaultState)
Sets the static field
fqn to value , unless the value is defaultState . |
StateT |
setVariable(int index,
StateT state,
StateT defaultState)
Sets the
index th position of the variable array to state and returns state . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isLess
getPrecision, getStateByName
public static final java.lang.String DEFAULT_FIELD
protected final JvmFrameAbstractState<StateT extends LatticeAbstractState<StateT>> frame
protected final JvmHeapAbstractState<StateT extends LatticeAbstractState<StateT>> heap
protected final MapAbstractState<java.lang.String,StateT extends LatticeAbstractState<StateT>> staticFields
protected JvmCfaNode programLocation
protected static final JvmCfaNode topLocation
public JvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<StateT> frame, JvmHeapAbstractState<StateT> heap, MapAbstractState<java.lang.String,StateT> staticFields)
programLocation
- a CFA nodeframe
- a frame abstract stateheap
- a heap abstract statestaticFields
- a static field tablepublic JvmAbstractState<StateT> join(JvmAbstractState<StateT> abstractState)
LatticeAbstractState
abstractState
.join
in interface LatticeAbstractState<JvmAbstractState<StateT extends LatticeAbstractState<StateT>>>
public boolean isLessOrEqual(JvmAbstractState<StateT> abstractState)
LatticeAbstractState
abstractState
.isLessOrEqual
in interface LatticeAbstractState<JvmAbstractState<StateT extends LatticeAbstractState<StateT>>>
public JvmCfaNode getProgramLocation()
ProgramLocationDependent
getProgramLocation
in interface ProgramLocationDependent<JvmCfaNode,JvmCfaEdge,MethodSignature>
public void setProgramLocation(JvmCfaNode programLocation)
ProgramLocationDependent
setProgramLocation
in interface ProgramLocationDependent<JvmCfaNode,JvmCfaEdge,MethodSignature>
public JvmAbstractState<StateT> copy()
AbstractState
copy
in interface AbstractState
public boolean equals(java.lang.Object obj)
equals
in interface AbstractState
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface AbstractState
hashCode
in class java.lang.Object
public StateT peek()
public StateT peek(int index)
index
th element from the top of the operand stack.public StateT peekOrDefault(StateT defaultState)
defaultState
if the stack is
empty.public StateT peekOrDefault(int index, StateT defaultState)
index
th element from the top of the operand stack or returns defaultState
if the stack does not have enough elements.public StateT pop()
public StateT popOrDefault(StateT defaultState)
defaultState
if
the stack is empty.public java.util.List<StateT> pushAll(java.util.List<StateT> states)
states
to the top of the operand stack and returns
states
.public void clearOperandStack()
public StateT getVariableOrDefault(int index, StateT defaultState)
index
th position of the variable array or defaultState
if there is no entry.public StateT setVariable(int index, StateT state, StateT defaultState)
index
th position of the variable array to state
and returns state
. If the array has to be extended, the added cells are padded with defaultState
.public StateT getStaticOrDefault(java.lang.String fqn, StateT defaultState)
fqn
or defaultState
if
there is no entry.public void setStatic(java.lang.String fqn, StateT value, StateT defaultState)
fqn
to value
, unless the value is defaultState
.public <T> StateT getFieldOrDefault(T object, java.lang.String descriptor, StateT defaultValue)
descriptor
of the object
or
defaultState
if there is no entry.public <T> StateT getFieldOrDefault(T object, StateT defaultValue)
object
or defaultState
if there is no entry.public <T> void setField(T object, java.lang.String descriptor, StateT value)
descriptor
of the object
to value
.public <T> void setField(T object, StateT value)
object
to value
.public JvmFrameAbstractState<StateT> getFrame()
public MapAbstractState<java.lang.String,StateT> getStaticFields()
public JvmHeapAbstractState<StateT> getHeap()
public StateT newArray(java.lang.String type, java.util.List<StateT> dimensions)
type
and dimentions
.public StateT newObject(java.lang.String className)
className
.public StateT newObject(Clazz clazz)
Clazz
.public <T> StateT getArrayElementOrDefault(T array, StateT index, StateT abstractDefault)
array
element at the given index
or the
abstractDefault
if there is no information available.