Class MutableStmtGraph

All Implemented Interfaces:
Iterable<Stmt>
Direct Known Subclasses:
MutableBlockStmtGraph

public abstract class MutableStmtGraph extends StmtGraph<MutableBasicBlock>
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 Details

    • MutableStmtGraph

      public MutableStmtGraph()
  • Method Details

    • unmodifiableStmtGraph

      @Nonnull public abstract StmtGraph<?> unmodifiableStmtGraph()
    • setStartingStmt

      public abstract void setStartingStmt(@Nonnull Stmt firstStmt)
    • addNode

      public void addNode(@Nonnull Stmt stmt)
      inserts a "stmt" into the StmtGraph
    • addNode

      public abstract void addNode(@Nonnull Stmt stmt, @Nonnull Map<ClassType,Stmt> traps)
      inserts a "stmt" with exceptional flows "traps" into the StmtGraph
    • addBlock

      public abstract void addBlock(@Nonnull List<Stmt> stmts, @Nonnull Map<ClassType,Stmt> traps)
      creates a whole BasicBlock with the details from the parameters
    • removeBlock

      public abstract void removeBlock(BasicBlock<?> block)
    • addBlock

      public void addBlock(@Nonnull List<Stmt> stmts)
      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

      public 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)
    • insertBefore

      public abstract void insertBefore(@Nonnull Stmt beforeStmt, @Nonnull List<FallsThroughStmt> stmts, @Nonnull Map<ClassType,Stmt> exceptionMap)
    • insertBefore

      public void insertBefore(@Nonnull Stmt beforeStmt, @Nonnull FallsThroughStmt newStmt)
      inserts the "newStmt" before the position of "beforeStmt" i.e. newStmt.successors().contains(beforeStmt) will be true
    • removeNode

      public abstract void removeNode(@Nonnull Stmt stmt)
      removes "stmt" from the StmtGraph
    • removeNode

      public abstract void removeNode(@Nonnull Stmt stmt, boolean keepFlow)
    • putEdge

      public abstract void putEdge(@Nonnull FallsThroughStmt from, @Nonnull Stmt to)
      Modifications of unexceptional flows

      Adds 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

      public abstract void putEdge(@Nonnull BranchingStmt from, int successorIdx, @Nonnull Stmt to)
    • replaceSucessorEdge

      public abstract boolean replaceSucessorEdge(@Nonnull Stmt from, @Nonnull Stmt oldTo, @Nonnull Stmt newTo)
    • setEdges

      public abstract void setEdges(@Nonnull BranchingStmt from, @Nonnull List<Stmt> targets)
      replaces the current outgoing flows of "from" to "targets"
    • setEdges

      public void setEdges(@Nonnull BranchingStmt from, @Nonnull Stmt... targets)
      replaces the current outgoing flows of "from" to each target of "targets"
    • removeEdge

      public abstract List<Integer> removeEdge(@Nonnull Stmt from, @Nonnull Stmt to)
      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

      public abstract void clearExceptionalEdges(@Nonnull Stmt stmt)
      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

      public abstract void removeExceptionalEdge(@Nonnull Stmt stmt, @Nonnull ClassType exception)
      removes an exceptional flow of the type "exception" flow from "stmt"