Beispiel #1
0
  /**
   * Get the size of the bytecode of the current graph. This only works if the current graph type is
   * {@link #TYPE_STACK}.
   *
   * @return the size of the corresponding bytecode in bytes or 0 if the graph is not in stack-form.
   */
  public int getBytecodeSize() {
    if (graphType != TYPE_STACK) {
      return 0;
    }

    int size = 0;
    for (Iterator it = blocks.iterator(); it.hasNext(); ) {
      BasicBlock block = (BasicBlock) it.next();
      size += block.getStackCode().getBytecodeSize();
    }

    return size;
  }
Beispiel #2
0
  /**
   * Get a set of all blocks containing return-stmts.
   *
   * @return a set of BasicBlocks.
   */
  public Set findReturnBlocks() {

    Set returnBlocks = new HashSet(1);

    for (Iterator it = blocks.iterator(); it.hasNext(); ) {
      BasicBlock block = (BasicBlock) it.next();
      ControlFlowStmt stmt = block.getControlFlowStmt();
      if (stmt instanceof ReturnStmt) {
        returnBlocks.add(stmt);
      }
    }

    return returnBlocks;
  }
Beispiel #3
0
 protected void transformTo(int type) throws GraphException {
   super.transformTo(type);
 }