ContentT - The type of the states contained in the JVM state. e.g., for taint analysis
this would be a SetAbstractState containing the taints
and for value analysis a ValueAbstractState.public class JvmAbstractState<ContentT extends AbstractState<ContentT>> extends java.lang.Object implements AbstractState<JvmAbstractState<ContentT>>, ProgramLocationDependent
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<ContentT> |
frame |
protected JvmHeapAbstractState<ContentT> |
heap |
protected JvmCfaNode |
programLocation |
protected MapAbstractState<java.lang.String,ContentT> |
staticFields |
protected static JvmCfaNode |
topLocation |
| Constructor and Description |
|---|
JvmAbstractState(JvmCfaNode programLocation,
JvmFrameAbstractState<ContentT> frame,
JvmHeapAbstractState<ContentT> heap,
MapAbstractState<java.lang.String,ContentT> staticFields)
Create a JVM abstract state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearOperandStack()
Empties the operand stack.
|
JvmAbstractState<ContentT> |
copy()
Creates a copy of itself.
|
boolean |
equals(java.lang.Object obj) |
<T> ContentT |
getArrayElementOrDefault(T array,
ContentT index,
ContentT abstractDefault)
Returns an abstract state for the
array element at the given index or the
abstractDefault if there is no information available. |
<T> ContentT |
getFieldOrDefault(T object,
ContentT defaultValue)
Returns an abstract state representing the default field of the
object or defaultState if there is no entry. |
<T> ContentT |
getFieldOrDefault(T object,
java.lang.String descriptor,
ContentT defaultValue)
Returns an abstract state representing the field
descriptor of the object or
defaultState if there is no entry. |
JvmFrameAbstractState<ContentT> |
getFrame()
Returns the frame abstract state.
|
JvmHeapAbstractState<ContentT> |
getHeap()
Returns the heap abstract state.
|
JvmCfaNode |
getProgramLocation()
Returns the program location.
|
MapAbstractState<java.lang.String,ContentT> |
getStaticFields()
Returns the static field table abstract state.
|
ContentT |
getStaticOrDefault(java.lang.String fqn,
ContentT defaultState)
Returns an abstract state representing the static field
fqn or defaultState if
there is no entry. |
ContentT |
getVariableOrDefault(int index,
ContentT defaultState)
Returns an abstract state at the
indexth position of the variable array or defaultState if there is no entry. |
int |
hashCode() |
boolean |
isLessOrEqual(JvmAbstractState<ContentT> abstractState)
Compares itself to the
abstractState (i.e., compare the states on the partial order
provided by the domain of the analysis). |
JvmAbstractState<ContentT> |
join(JvmAbstractState<ContentT> abstractState)
Computes a join over itself and another abstract state
abstractState (i.e., finds the
least upper bound on the semilattice). |
ContentT |
newArray(java.lang.String type,
java.util.List<ContentT> dimensions)
Returns an abstract state for a new array for the given
type and dimentions. |
ContentT |
newObject(Clazz clazz)
Returns an abstract state for a new object of the given
Clazz. |
ContentT |
newObject(java.lang.String className)
Returns an abstract state for a new object of the given
className. |
ContentT |
peek()
Returns the top element of the operand stack.
|
ContentT |
peek(int index)
Returns the
indexth element from the top of the operand stack. |
ContentT |
peekOrDefault(ContentT defaultState)
Returns the top element of the operand stack or returns
defaultState if the stack is
empty. |
ContentT |
peekOrDefault(int index,
ContentT defaultState)
Returns the
indexth element from the top of the operand stack or returns defaultState if the stack does not have enough elements. |
ContentT |
pop()
Removes the top element of the operand stack end returns it.
|
ContentT |
popOrDefault(ContentT defaultState)
Removes the top element of the operand stack end returns it.
|
ContentT |
push(ContentT state)
Inserts
state to the top of the operand stack and returns it. |
java.util.List<ContentT> |
pushAll(java.util.List<ContentT> states)
Consequentially inserts elements of
states to the top of the operand stack and returns
states. |
<T> void |
setArrayElement(T array,
ContentT index,
ContentT value)
Sets the
array element at the given index to the value. |
<T> void |
setField(T object,
ContentT value)
Sets the default field of the
object to value. |
<T> void |
setField(T object,
java.lang.String descriptor,
ContentT value)
Sets the field
descriptor of the object to value. |
void |
setProgramLocation(JvmCfaNode programLocation)
Sets the program location.
|
void |
setStatic(java.lang.String fqn,
ContentT value,
ContentT defaultState)
Sets the static field
fqn to value, unless the value is defaultState. |
ContentT |
setVariable(int index,
ContentT state,
ContentT defaultState)
Sets the
indexth position of the variable array to state and returns state. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetPrecision, isLesspublic static final java.lang.String DEFAULT_FIELD
protected final JvmFrameAbstractState<ContentT extends AbstractState<ContentT>> frame
protected final JvmHeapAbstractState<ContentT extends AbstractState<ContentT>> heap
protected final MapAbstractState<java.lang.String,ContentT extends AbstractState<ContentT>> staticFields
protected JvmCfaNode programLocation
protected static final JvmCfaNode topLocation
public JvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<ContentT> frame, JvmHeapAbstractState<ContentT> heap, MapAbstractState<java.lang.String,ContentT> staticFields)
programLocation - a CFA nodeframe - a frame abstract stateheap - a heap abstract statestaticFields - a static field tablepublic JvmAbstractState<ContentT> join(JvmAbstractState<ContentT> abstractState)
AbstractStateabstractState (i.e., finds the
least upper bound on the semilattice).join in interface AbstractState<JvmAbstractState<ContentT extends AbstractState<ContentT>>>public boolean isLessOrEqual(JvmAbstractState<ContentT> abstractState)
AbstractStateabstractState (i.e., compare the states on the partial order
provided by the domain of the analysis).isLessOrEqual in interface AbstractState<JvmAbstractState<ContentT extends AbstractState<ContentT>>>public JvmCfaNode getProgramLocation()
ProgramLocationDependentgetProgramLocation in interface ProgramLocationDependentpublic void setProgramLocation(JvmCfaNode programLocation)
ProgramLocationDependentsetProgramLocation in interface ProgramLocationDependentpublic JvmAbstractState<ContentT> copy()
AbstractStatecopy in interface AbstractState<JvmAbstractState<ContentT extends AbstractState<ContentT>>>public boolean equals(java.lang.Object obj)
equals in interface AbstractState<JvmAbstractState<ContentT extends AbstractState<ContentT>>>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface AbstractState<JvmAbstractState<ContentT extends AbstractState<ContentT>>>hashCode in class java.lang.Objectpublic ContentT peek()
public ContentT peek(int index)
indexth element from the top of the operand stack.public ContentT peekOrDefault(ContentT defaultState)
defaultState if the stack is
empty.public ContentT peekOrDefault(int index, ContentT defaultState)
indexth element from the top of the operand stack or returns defaultState if the stack does not have enough elements.public ContentT pop()
public ContentT popOrDefault(ContentT defaultState)
defaultState if
the stack is empty.public ContentT push(ContentT state)
state to the top of the operand stack and returns it.public java.util.List<ContentT> pushAll(java.util.List<ContentT> states)
states to the top of the operand stack and returns
states.public void clearOperandStack()
public ContentT getVariableOrDefault(int index, ContentT defaultState)
indexth position of the variable array or defaultState if there is no entry.public ContentT setVariable(int index, ContentT state, ContentT defaultState)
indexth 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 ContentT getStaticOrDefault(java.lang.String fqn, ContentT defaultState)
fqn or defaultState if
there is no entry.public void setStatic(java.lang.String fqn,
ContentT value,
ContentT defaultState)
fqn to value, unless the value is defaultState.public <T> ContentT getFieldOrDefault(T object, java.lang.String descriptor, ContentT defaultValue)
descriptor of the object or
defaultState if there is no entry.public <T> ContentT getFieldOrDefault(T object, ContentT defaultValue)
object or defaultState if there is no entry.public <T> void setField(T object,
java.lang.String descriptor,
ContentT value)
descriptor of the object to value.public <T> void setField(T object,
ContentT value)
object to value.public JvmFrameAbstractState<ContentT> getFrame()
public MapAbstractState<java.lang.String,ContentT> getStaticFields()
public JvmHeapAbstractState<ContentT> getHeap()
public ContentT newArray(java.lang.String type, java.util.List<ContentT> dimensions)
type and dimentions.public ContentT newObject(java.lang.String className)
className.public ContentT newObject(Clazz clazz)
Clazz.public <T> ContentT getArrayElementOrDefault(T array, ContentT index, ContentT abstractDefault)
array element at the given index or the
abstractDefault if there is no information available.