Example #1
0
File: CFG.java Project: cwgem/jruby
  public String toStringInstrs() {
    StringBuilder buf = new StringBuilder();

    for (BasicBlock b : getSortedBasicBlocks()) {
      buf.append(b.toStringInstrs());
    }
    buf.append("\n\n------ Rescue block map ------\n");
    for (BasicBlock bb : rescuerMap.keySet()) {
      buf.append("BB ")
          .append(bb.getID())
          .append(" --> BB ")
          .append(rescuerMap.get(bb).getID())
          .append("\n");
    }
    buf.append("\n\n------ Ensure block map ------\n");
    for (BasicBlock bb : ensurerMap.keySet()) {
      buf.append("BB ")
          .append(bb.getID())
          .append(" --> BB ")
          .append(ensurerMap.get(bb).getID())
          .append("\n");
    }

    List<IRClosure> closures = scope.getClosures();
    if (!closures.isEmpty()) {
      buf.append("\n\n------ Closures encountered in this scope ------\n");
      for (IRClosure c : closures) {
        buf.append(c.toStringBody());
      }
      buf.append("------------------------------------------------\n");
    }

    return buf.toString();
  }
 private void addClosureExitBindingStores(
     IRExecutionScope s, ListIterator<Instr> instrs, Set<LocalVariable> dirtyVars) {
   for (Variable v : dirtyVars) {
     if (v instanceof ClosureLocalVariable) {
       IRClosure definingScope = ((ClosureLocalVariable) v).definingScope;
       if ((s != definingScope) && s.nestedInClosure(definingScope))
         instrs.add(new StoreToBindingInstr(s, v.getName(), v));
     } else {
       instrs.add(new StoreToBindingInstr(s, v.getName(), v));
     }
   }
 }
Example #3
0
File: CFG.java Project: cwgem/jruby
 private BasicBlock createBB(Stack<ExceptionRegion> nestedExceptionRegions) {
   return createBB(scope.getNewLabel(), nestedExceptionRegions);
 }