Package proguard.analysis.cpa.jvm.state
Class JvmAbstractState<ContentT extends AbstractState<ContentT>>
java.lang.Object
proguard.analysis.cpa.jvm.state.JvmAbstractState<ContentT>
- Type Parameters:
ContentT- The type of the states contained in the JVM state. e.g., for taint analysis this would be aSetAbstractStatecontaining the taints and for value analysis aValueAbstractState.
- All Implemented Interfaces:
AbstractState<JvmAbstractState<ContentT>>,ProgramLocationDependent
- Direct Known Subclasses:
JvmValueAbstractState
public class JvmAbstractState<ContentT extends AbstractState<ContentT>>
extends Object
implements AbstractState<JvmAbstractState<ContentT>>, ProgramLocationDependent
The
JvmAbstractState consists of the method frame JvmFrameAbstractState and the
heap JvmHeapAbstractState.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final JvmFrameAbstractState<ContentT>protected final JvmHeapAbstractState<ContentT>protected JvmCfaNodeprotected final MapAbstractState<String,ContentT> protected static final JvmCfaNode -
Constructor Summary
ConstructorsConstructorDescriptionJvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<ContentT> frame, JvmHeapAbstractState<ContentT> heap, MapAbstractState<String, ContentT> staticFields) Create a JVM abstract state. -
Method Summary
Modifier and TypeMethodDescriptionvoidEmpties the operand stack.copy()Creates a copy of itself.boolean<T> ContentTgetArrayElementOrDefault(T array, ContentT index, ContentT abstractDefault) Returns an abstract state for thearrayelement at the givenindexor theabstractDefaultif there is no information available.<T> ContentTgetFieldOrDefault(T object, ContentT defaultValue) Returns an abstract state representing the default field of theobjectordefaultStateif there is no entry.<T> ContentTgetFieldOrDefault(T object, String descriptor, ContentT defaultValue) Returns an abstract state representing the fielddescriptorof theobjectordefaultStateif there is no entry.getFrame()Returns the frame abstract state.getHeap()Returns the heap abstract state.Returns the program location.Returns the static field table abstract state.getStaticOrDefault(String fqn, ContentT defaultState) Returns an abstract state representing the static fieldfqnordefaultStateif there is no entry.getVariableOrDefault(int index, ContentT defaultState) Returns an abstract state at theindexth position of the variable array ordefaultStateif there is no entry.inthashCode()booleanisLessOrEqual(JvmAbstractState<ContentT> abstractState) Compares itself to theabstractState(i.e., compare the states on the partial order provided by the domain of the analysis).join(JvmAbstractState<ContentT> abstractState) Computes a join over itself and another abstract stateabstractState(i.e., finds the least upper bound on the semilattice).Returns an abstract state for a new array for the giventypeanddimentions.Returns an abstract state for a new object of the givenclassName.Returns an abstract state for a new object of the givenClazz.peek()Returns the top element of the operand stack.peek(int index) Returns theindexth element from the top of the operand stack.peekOrDefault(int index, ContentT defaultState) Returns theindexth element from the top of the operand stack or returnsdefaultStateif the stack does not have enough elements.peekOrDefault(ContentT defaultState) Returns the top element of the operand stack or returnsdefaultStateif the stack is empty.pop()Removes the top element of the operand stack end returns it.popOrDefault(ContentT defaultState) Removes the top element of the operand stack end returns it.Insertsstateto the top of the operand stack and returns it.Consequentially inserts elements ofstatesto the top of the operand stack and returnsstates.<T> voidsetArrayElement(T array, ContentT index, ContentT value) Sets thearrayelement at the givenindexto thevalue.<T> voidSets the default field of theobjecttovalue.<T> voidSets the fielddescriptorof theobjecttovalue.voidsetProgramLocation(JvmCfaNode programLocation) Sets the program location.voidSets the static fieldfqntovalue, unless the value isdefaultState.setVariable(int index, ContentT state, ContentT defaultState) Sets theindexth position of the variable array tostateand returnsstate.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, isLess
-
Field Details
-
DEFAULT_FIELD
- See Also:
-
frame
-
heap
-
staticFields
-
programLocation
-
topLocation
-
-
Constructor Details
-
JvmAbstractState
public JvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<ContentT> frame, JvmHeapAbstractState<ContentT> heap, MapAbstractState<String, ContentT> staticFields) Create a JVM abstract state.- Parameters:
programLocation- a CFA nodeframe- a frame abstract stateheap- a heap abstract statestaticFields- a static field table
-
-
Method Details
-
join
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<ContentT extends AbstractState<ContentT>>
-
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<ContentT extends AbstractState<ContentT>>
-
getProgramLocation
Description copied from interface:ProgramLocationDependentReturns the program location.- Specified by:
getProgramLocationin interfaceProgramLocationDependent
-
setProgramLocation
Description copied from interface:ProgramLocationDependentSets the program location.- Specified by:
setProgramLocationin interfaceProgramLocationDependent
-
copy
Description copied from interface:AbstractStateCreates a copy of itself.- Specified by:
copyin interfaceAbstractState<ContentT extends AbstractState<ContentT>>
-
equals
- Specified by:
equalsin interfaceAbstractState<ContentT extends AbstractState<ContentT>>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceAbstractState<ContentT extends AbstractState<ContentT>>- Overrides:
hashCodein classObject
-
peek
Returns the top element of the operand stack. -
peek
Returns theindexth element from the top of the operand stack. -
peekOrDefault
Returns the top element of the operand stack or returnsdefaultStateif the stack is empty. -
peekOrDefault
Returns theindexth element from the top of the operand stack or returnsdefaultStateif the stack does not have enough elements. -
pop
Removes the top element of the operand stack end returns it. -
popOrDefault
Removes the top element of the operand stack end returns it. ReturnsdefaultStateif the stack is empty. -
push
Insertsstateto the top of the operand stack and returns it. -
pushAll
Consequentially inserts elements ofstatesto the top of the operand stack and returnsstates. -
clearOperandStack
public void clearOperandStack()Empties the operand stack. -
getVariableOrDefault
Returns an abstract state at theindexth position of the variable array ordefaultStateif there is no entry. -
setVariable
Sets theindexth position of the variable array tostateand returnsstate. If the array has to be extended, the added cells are padded withdefaultState. -
getStaticOrDefault
Returns an abstract state representing the static fieldfqnordefaultStateif there is no entry. -
setStatic
Sets the static fieldfqntovalue, unless the value isdefaultState. -
getFieldOrDefault
Returns an abstract state representing the fielddescriptorof theobjectordefaultStateif there is no entry. -
getFieldOrDefault
Returns an abstract state representing the default field of theobjectordefaultStateif there is no entry. -
setField
Sets the fielddescriptorof theobjecttovalue. -
setField
Sets the default field of theobjecttovalue. -
getFrame
Returns the frame abstract state. -
getStaticFields
Returns the static field table abstract state. -
getHeap
Returns the heap abstract state. -
newArray
Returns an abstract state for a new array for the giventypeanddimentions. -
newObject
Returns an abstract state for a new object of the givenclassName. -
newObject
Returns an abstract state for a new object of the givenClazz. -
getArrayElementOrDefault
Returns an abstract state for thearrayelement at the givenindexor theabstractDefaultif there is no information available. -
setArrayElement
Sets thearrayelement at the givenindexto thevalue.
-