Package sootup.core.graph
Class MutableStmtGraph
- Direct Known Subclasses:
MutableBlockStmtGraph
- Author:
- Markus Schmidt
performance suggestions for multiple operations on sequential Stmts: addNode(): top->down removeNode(s): bottom->up as then there is no need for copying inside the MutableBasicBlock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
creates a whole BasicBlock which contains the sequence of (n-1)*fallsthrough()-stmt + optional a non-fallsthrough() stmt at the end of the listabstract void
creates a whole BasicBlock with the details from the parametersabstract void
addExceptionalEdge
(@NonNull Stmt stmt, @NonNull ClassType exception, @NonNull Stmt traphandlerStmt) Adds an exceptional flow with the type "exception" to a "stmt" which will reach "traphandlerStmt"void
inserts a "stmt" into the StmtGraphabstract void
inserts a "stmt" with exceptional flows "traps" into the StmtGraphabstract void
clearExceptionalEdges
(@NonNull Stmt stmt) Modifications of exceptional flows removes all exceptional flows from "stmt"abstract BasicBlock<?>
insertAfter
(@NonNull Stmt afterStmt, @NonNull List<FallsThroughStmt> stmts, @NonNull Map<ClassType, Stmt> exceptionMap) BasicBlock<?>
insertAfter
(@NonNull Stmt afterStmt, @NonNull FallsThroughStmt newStmt) inserts the "newStmt" after the position of "afterStmt"abstract BasicBlock<?>
insertBefore
(@NonNull Stmt beforeStmt, @NonNull List<FallsThroughStmt> stmts, @NonNull Map<ClassType, Stmt> exceptionMap) BasicBlock<?>
insertBefore
(@NonNull Stmt beforeStmt, @NonNull FallsThroughStmt newStmt) inserts the "newStmt" before the position of "beforeStmt" i.e.abstract void
putEdge
(@NonNull BranchingStmt from, int successorIdx, @NonNull Stmt to) abstract void
putEdge
(@NonNull FallsThroughStmt from, @NonNull Stmt to) Modifications of unexceptional flowsabstract void
removeBlock
(BasicBlock<?> block) removeEdge
(@NonNull Stmt from, @NonNull Stmt to) removes the current outgoing flows of "from" to "to"abstract void
removeExceptionalEdge
(@NonNull Stmt stmt, @NonNull ClassType exception) removes an exceptional flow of the type "exception" flow from "stmt"abstract void
removeNode
(@NonNull Stmt stmt) removes "stmt" from the StmtGraphabstract void
removeNode
(@NonNull Stmt stmt, boolean keepFlow) abstract void
replaceNode
(@NonNull Stmt oldStmt, @NonNull Stmt newStmt) Modification of stmts (without manipulating any flows; possible assigned exceptional flows stay the same as well)abstract boolean
replaceSucessorEdge
(@NonNull Stmt from, @NonNull Stmt oldTo, @NonNull Stmt newTo) abstract void
setEdges
(@NonNull BranchingStmt from, @NonNull List<Stmt> targets) replaces the current outgoing flows of "from" to "targets"void
setEdges
(@NonNull BranchingStmt from, @NonNull Stmt... targets) replaces the current outgoing flows of "from" to each target of "targets"abstract void
setStartingStmt
(@NonNull Stmt firstStmt) abstract @NonNull StmtGraph<?>
Methods inherited from class sootup.core.graph.StmtGraph
containsNode, degree, equals, exceptionalPredecessors, exceptionalSuccessors, getAllSuccessors, getBlockIterator, getBlockOf, getBlocks, getBlocksSorted, getBranchTargetsOf, getEntrypoints, getExtendedBasicBlockPathBetween, getNodes, getStartingStmt, getStartingStmtBlock, getStmts, getTails, getTailStmtBlocks, hasEdgeConnecting, inDegree, isStmtBranchTarget, iterator, outDegree, predecessors, removeExceptionalFlowFromAllBlocks, successors, toString, validateStmtConnectionsInGraph
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MutableStmtGraph
public MutableStmtGraph()
-
-
Method Details
-
unmodifiableStmtGraph
-
setStartingStmt
-
addNode
inserts a "stmt" into the StmtGraph -
addNode
inserts a "stmt" with exceptional flows "traps" into the StmtGraph -
addBlock
creates a whole BasicBlock with the details from the parameters -
removeBlock
-
addBlock
creates a whole BasicBlock which contains the sequence of (n-1)*fallsthrough()-stmt + optional a non-fallsthrough() stmt at the end of the list -
replaceNode
Modification of stmts (without manipulating any flows; possible assigned exceptional flows stay the same as well) -
insertBefore
public abstract BasicBlock<?> insertBefore(@NonNull Stmt beforeStmt, @NonNull List<FallsThroughStmt> stmts, @NonNull Map<ClassType, Stmt> exceptionMap) -
insertAfter
public abstract BasicBlock<?> insertAfter(@NonNull Stmt afterStmt, @NonNull List<FallsThroughStmt> stmts, @NonNull Map<ClassType, Stmt> exceptionMap) -
insertBefore
inserts the "newStmt" before the position of "beforeStmt" i.e. newStmt.successors().contains(beforeStmt) will be true -
insertAfter
inserts the "newStmt" after the position of "afterStmt" -
removeNode
removes "stmt" from the StmtGraph -
removeNode
-
putEdge
Modifications of unexceptional flowsAdds a flow "from" to "to". if at least one of the parameter Stmts is not already in the StmtGraph it will be added. if "to" needs to be added to the StmtGraph i.e. "to" is not already in the StmtGraph the method assumes "to" has the same exceptional flows as "from".
-
putEdge
-
replaceSucessorEdge
-
setEdges
replaces the current outgoing flows of "from" to "targets" -
setEdges
replaces the current outgoing flows of "from" to each target of "targets" -
removeEdge
removes the current outgoing flows of "from" to "to"- Returns:
- returns List of the successor indices of "from" that were connected to "to" - items are 0 in case of FallsThroughStmts or idx > 0 in case of BranchingStmts with multiple successors
-
clearExceptionalEdges
Modifications of exceptional flows removes all exceptional flows from "stmt" -
addExceptionalEdge
public abstract void addExceptionalEdge(@NonNull Stmt stmt, @NonNull ClassType exception, @NonNull Stmt traphandlerStmt) Adds an exceptional flow with the type "exception" to a "stmt" which will reach "traphandlerStmt" -
removeExceptionalEdge
removes an exceptional flow of the type "exception" flow from "stmt"
-