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
-
Nested Class Summary
Nested classes/interfaces inherited from class sootup.core.graph.StmtGraph
StmtGraph.BlockGraphIterator, StmtGraph.BlockGraphIteratorAndTrapAggregator
-
Constructor Summary
-
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
(Stmt stmt, ClassType exception, 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
(Stmt stmt) Modifications of exceptional flows removes all exceptional flows from "stmt"abstract void
insertBefore
(Stmt beforeStmt, List<FallsThroughStmt> stmts, Map<ClassType, Stmt> exceptionMap) void
insertBefore
(Stmt beforeStmt, FallsThroughStmt newStmt) inserts the "newStmt" before the position of "beforeStmt" i.e.abstract void
putEdge
(BranchingStmt from, int successorIdx, Stmt to) abstract void
putEdge
(FallsThroughStmt from, Stmt to) Modifications of unexceptional flowsabstract void
removeBlock
(BasicBlock<?> block) removeEdge
(Stmt from, Stmt to) removes the current outgoing flows of "from" to "to"abstract void
removeExceptionalEdge
(Stmt stmt, ClassType exception) removes an exceptional flow of the type "exception" flow from "stmt"abstract void
removeNode
(Stmt stmt) removes "stmt" from the StmtGraphabstract void
removeNode
(Stmt stmt, boolean keepFlow) abstract void
replaceNode
(Stmt oldStmt, Stmt newStmt) Modification of stmts (without manipulating any flows; possible assigned exceptional flows stay the same as well)abstract boolean
replaceSucessorEdge
(Stmt from, Stmt oldTo, Stmt newTo) abstract void
setEdges
(BranchingStmt from, List<Stmt> targets) replaces the current outgoing flows of "from" to "targets"void
setEdges
(BranchingStmt from, Stmt... targets) replaces the current outgoing flows of "from" to each target of "targets"abstract void
setStartingStmt
(Stmt firstStmt) abstract StmtGraph<?>
Methods inherited from class sootup.core.graph.StmtGraph
buildTraps, containsNode, degree, equals, exceptionalPredecessors, exceptionalSuccessors, getAllSuccessors, getBlockIterator, getBlockOf, getBlocks, getBlocksSorted, getBranchTargetsOf, getEntrypoints, getExtendedBasicBlockPathBetween, getLabeledStmts, getNodes, getStartingStmt, getStartingStmtBlock, getStmts, getTails, 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
-
insertBefore
inserts the "newStmt" before the position of "beforeStmt" i.e. newStmt.successors().contains(beforeStmt) will be true -
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"
-