Ejemplo n.º 1
0
 public static void debug(InputAbc ia) {
   for (final Method m : ia.methods) {
     System.out.println("-------------------------------------");
     System.out.println(m.getName().format());
     debug(m.entry.to);
   }
 }
Ejemplo n.º 2
0
  private static void debug(Block b) {
    for (final Expr e : b.exprs) {
      switch (e.op) {
        case 0:
          System.out.println(e.ref);
          break;

        case ActionBlockConstants.OP_pushscope:
          ensure(e.args.length == 1);
          System.out.println(Util.getOpcodeName(e.op) + ' ' + e.args[0].ref);
          break;

        case ActionBlockConstants.OP_getproperty:
          ensure(e.args.length == 1);
          System.out.println(Util.getOpcodeName(e.op) + ' ' + e.args[0].ref + ' ' + '.' + e.ref);
          break;

        case ActionBlockConstants.OP_callpropvoid:
          if (e.args.length == 2) {
            System.out.println(
                Util.getOpcodeName(e.op)
                    + ' '
                    + e.args[0].ref
                    + "."
                    + e.ref
                    + '('
                    + e.args[1].ref
                    + ')');
          } else if (e.args.length == 3) {
            System.out.println(
                Util.getOpcodeName(e.op)
                    + ' '
                    + e.args[0].ref
                    + "."
                    + e.ref
                    + '('
                    + e.args[1].ref
                    + ", "
                    + e.args[2].ref
                    + ')');
          } else {
            throw new AssertionError();
          }
          break;

        case ActionBlockConstants.OP_findpropstrict:
          ensure(e.args.length == 0);
          System.out.println(Util.getOpcodeName(e.op) + ' ' + e.ref.format());
          break;

        case ActionBlockConstants.OP_jump:
          ensure(e.succ.length == 1);
          System.out.println("JUMP");
          debug(e.succ[0].to);
          break;

        default:
          System.out.println(Util.getOpcodeName(e.op) + " " + e.args.length);
      }
    }
  }