Package proguard.analysis.cpa.jvm.state
Class JvmFrameAbstractState<StateT extends LatticeAbstractState<StateT>>
- java.lang.Object
-
- proguard.analysis.cpa.jvm.state.JvmFrameAbstractState<StateT>
-
- All Implemented Interfaces:
LatticeAbstractState<JvmFrameAbstractState<StateT>>
,AbstractState
public class JvmFrameAbstractState<StateT extends LatticeAbstractState<StateT>> extends java.lang.Object implements LatticeAbstractState<JvmFrameAbstractState<StateT>>
TheJvmFrameAbstractState
combines the operand stack as theStackAbstractState
and the local variable array as theListAbstractState
. This abstract state does not restrict the way one models values, i.e., one abstract state may correspond to a byte sequence of arbitrary length.
-
-
Field Summary
Fields Modifier and Type Field Description protected ListAbstractState<StateT>
localVariables
protected StackAbstractState<StateT>
operandStack
-
Constructor Summary
Constructors Constructor Description JvmFrameAbstractState()
Create an empty frame.JvmFrameAbstractState(ListAbstractState<StateT> localVariables, StackAbstractState<StateT> operandStack)
Create a frame from a local variable array and an operand stack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JvmFrameAbstractState<StateT>
copy()
Creates a copy of itself.boolean
equals(java.lang.Object obj)
ListAbstractState<StateT>
getLocalVariables()
Returns the variable array.StackAbstractState<StateT>
getOperandStack()
Returns the operand stack.StateT
getVariableOrDefault(int index, StateT defaultState)
Returns an abstract state at theindex
th position of the variable array ordefaultState
if there is no entry.int
hashCode()
boolean
isLessOrEqual(JvmFrameAbstractState<StateT> abstractState)
Compares itself to theabstractState
.JvmFrameAbstractState<StateT>
join(JvmFrameAbstractState<StateT> abstractState)
Computes a join over itself and theabstractState
.StateT
peek(int index)
Returns theindex
th element from the top of the operand stack.StateT
peekOrDefault(int index, StateT defaultState)
Returns theindex
th element from the top of the operand stack or returnsdefaultState
if the stack does not have enough elements.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)
Insertsstate
to the top of the operand stack and returns it.java.util.List<StateT>
pushAll(java.util.List<StateT> states)
Sequentially inserts elements ofstates
to the top of the operand stack and returnsstates
.StateT
setVariable(int index, StateT state, StateT defaultState)
Sets theindex
th position of the variable array tostate
and returnsstate
.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface proguard.analysis.cpa.interfaces.AbstractState
getPrecision, getStateByName
-
Methods inherited from interface proguard.analysis.cpa.defaults.LatticeAbstractState
isLess
-
-
-
-
Field Detail
-
localVariables
protected final ListAbstractState<StateT extends LatticeAbstractState<StateT>> localVariables
-
operandStack
protected final StackAbstractState<StateT extends LatticeAbstractState<StateT>> operandStack
-
-
Constructor Detail
-
JvmFrameAbstractState
public JvmFrameAbstractState()
Create an empty frame.
-
JvmFrameAbstractState
public JvmFrameAbstractState(ListAbstractState<StateT> localVariables, StackAbstractState<StateT> operandStack)
Create a frame from a local variable array and an operand stack.- Parameters:
localVariables
- a local variable arrayoperandStack
- an operand stack
-
-
Method Detail
-
join
public JvmFrameAbstractState<StateT> join(JvmFrameAbstractState<StateT> abstractState)
Description copied from interface:LatticeAbstractState
Computes a join over itself and theabstractState
.- Specified by:
join
in interfaceLatticeAbstractState<StateT extends LatticeAbstractState<StateT>>
-
isLessOrEqual
public boolean isLessOrEqual(JvmFrameAbstractState<StateT> abstractState)
Description copied from interface:LatticeAbstractState
Compares itself to theabstractState
.- Specified by:
isLessOrEqual
in interfaceLatticeAbstractState<StateT extends LatticeAbstractState<StateT>>
-
copy
public JvmFrameAbstractState<StateT> copy()
Description copied from interface:AbstractState
Creates a copy of itself.- Specified by:
copy
in interfaceAbstractState
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfaceAbstractState
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceAbstractState
- Overrides:
hashCode
in classjava.lang.Object
-
peekOrDefault
public StateT peekOrDefault(int index, StateT defaultState)
Returns theindex
th element from the top of the operand stack or returnsdefaultState
if the stack does not have enough elements.
-
peek
public StateT peek(int index)
Returns theindex
th element from the top of the operand stack.
-
pop
public StateT pop()
Removes the top element of the operand stack end returns it.
-
popOrDefault
public StateT popOrDefault(StateT defaultState)
Removes the top element of the operand stack end returns it. ReturnsdefaultState
if the stack is empty.
-
push
public StateT push(StateT state)
Insertsstate
to the top of the operand stack and returns it.
-
pushAll
public java.util.List<StateT> pushAll(java.util.List<StateT> states)
Sequentially inserts elements ofstates
to the top of the operand stack and returnsstates
.
-
getVariableOrDefault
public StateT getVariableOrDefault(int index, StateT defaultState)
Returns an abstract state at theindex
th position of the variable array ordefaultState
if there is no entry.
-
setVariable
public StateT setVariable(int index, StateT state, StateT defaultState)
Sets theindex
th position of the variable array tostate
and returnsstate
. If the array has to be extended, the added cells are padded withdefaultState
.
-
getLocalVariables
public ListAbstractState<StateT> getLocalVariables()
Returns the variable array.
-
getOperandStack
public StackAbstractState<StateT> getOperandStack()
Returns the operand stack.
-
-