Ejemplo n.º 1
0
  public static void dumpcode(final MethodEditor m) {

    final PrintWriter out = new PrintWriter(System.out, true);
    final StackHeightCounter shc = new StackHeightCounter(m);

    out.println("Code for method " + m.name() + m.type());
    final List instructions = m.code();
    final ListIterator iter = instructions.listIterator();
    while (iter.hasNext()) {
      final Object obj = iter.next();
      if (obj instanceof Label) {
        shc.handle((Label) obj);
      } else if (obj instanceof Instruction) {
        shc.handle((Instruction) obj);
      }

      System.out.println("        " + obj + " (sh: " + shc.height() + ")");
    }
  }