Class DefaultExpandOperator<ContentT extends AbstractState<ContentT>>
- java.lang.Object
-
- proguard.analysis.cpa.jvm.operators.DefaultExpandOperator<ContentT>
-
- Type Parameters:
ContentT
- The content of the jvm states. For example, this can be aSetAbstractState
of taints for taint analysis or aValueAbstractState
for value analysis.
- All Implemented Interfaces:
ExpandOperator<ContentT>
- Direct Known Subclasses:
TaintExpandOperator
,ValueExpandOperator
public class DefaultExpandOperator<ContentT extends AbstractState<ContentT>> extends java.lang.Object implements ExpandOperator<ContentT>
ThisExpandOperator
simulates the JVM behavior on a method exit.In case of exit with a return instruction it takes the heap and the frame from the exit state of the called function and the local variables of the caller. Then pops the arguments of the call from the stack, pushes the return value, and creates an abstract state at the target of the intra-procedural call edge.
In case of exit with an exception besides performing the same reconstruction for local variables, heap, and static fields, it discards the operand stack of the caller and pushes the exception. The abstract successor location is either the first applicable catch node of the caller, if exists, or the exception exit node of the caller.
-
-
Constructor Summary
Constructors Constructor Description DefaultExpandOperator(JvmCfa cfa)
Create the default expand operator for the JVM.DefaultExpandOperator(JvmCfa cfa, boolean expandHeap)
Create the default expand operator for the JVM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<ContentT>
calculateReturnValues(JvmAbstractState<ContentT> reducedExitState, Instruction returnInstruction, Call call)
Calculates the returned state.protected JvmAbstractState<ContentT>
createJvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<ContentT> frame, JvmHeapAbstractState<ContentT> heap, MapAbstractState<java.lang.String,ContentT> staticFields)
JvmAbstractState<ContentT>
expand(JvmAbstractState<ContentT> expandedInitialState, JvmAbstractState<ContentT> reducedExitState, JvmCfaNode blockEntryNode, Call call)
Reconstructs the state of the caller of a procedure using the information of the expanded initial state, the reduced exit state, the block entry node (that can be used to retrieve the CFA subgraph of the function), and the call to the procedure.protected void
expandHeap(JvmHeapAbstractState<ContentT> heap, JvmHeapAbstractState<ContentT> callerHeap)
-
-
-
Constructor Detail
-
DefaultExpandOperator
public DefaultExpandOperator(JvmCfa cfa)
Create the default expand operator for the JVM.- Parameters:
cfa
- the control flow automaton of the analyzed program
-
DefaultExpandOperator
public DefaultExpandOperator(JvmCfa cfa, boolean expandHeap)
Create the default expand operator for the JVM.- Parameters:
cfa
- the control flow automaton of the analyzed programexpandHeap
- whether expansion of the heap is performed
-
-
Method Detail
-
expand
public JvmAbstractState<ContentT> expand(JvmAbstractState<ContentT> expandedInitialState, JvmAbstractState<ContentT> reducedExitState, JvmCfaNode blockEntryNode, Call call)
Description copied from interface:ExpandOperator
Reconstructs the state of the caller of a procedure using the information of the expanded initial state, the reduced exit state, the block entry node (that can be used to retrieve the CFA subgraph of the function), and the call to the procedure.- Specified by:
expand
in interfaceExpandOperator<ContentT extends AbstractState<ContentT>>
- Parameters:
expandedInitialState
- the entry state of the called procedure before any reductionreducedExitState
- the state of the called procedure in its exit nodeblockEntryNode
- the entry node of the called procedurecall
- the information of the call to the procedure- Returns:
- The state of the caller after the procedure call, eventually with some collisions of
identifiers that need the
RebuildOperator
to be solved
-
calculateReturnValues
protected java.util.List<ContentT> calculateReturnValues(JvmAbstractState<ContentT> reducedExitState, Instruction returnInstruction, Call call)
Calculates the returned state. Can be overridden to handle special behavior.
-
expandHeap
protected void expandHeap(JvmHeapAbstractState<ContentT> heap, JvmHeapAbstractState<ContentT> callerHeap)
-
createJvmAbstractState
protected JvmAbstractState<ContentT> createJvmAbstractState(JvmCfaNode programLocation, JvmFrameAbstractState<ContentT> frame, JvmHeapAbstractState<ContentT> heap, MapAbstractState<java.lang.String,ContentT> staticFields)
-
-