Beispiel #1
0
  /** {@inheritDoc} */
  public void close(int suiteType) throws NoClassDefFoundError {
    long time = 0;
    this.suiteType = suiteType;

    if (verbose()) {
      Tracer.trace("[Translator: computing closure...");
      time = System.currentTimeMillis();
    }

    computeClosure();

    if (translationStrategy == BY_SUITE || translationStrategy == BY_TRANSLATION) {
      if (verbose()) {
        time = System.currentTimeMillis() - time;
        Tracer.traceln(time + "ms.]");
        Tracer.trace("[Translator: whole-suite optimizing and inlining...");
        time = System.currentTimeMillis();
      }
      // bytecode optimizations and inlining go here

      if (Arg.get(Arg.DEAD_METHOD_ELIMINATION).getBool()) {
        dme = new DeadMethodEliminator(this);
        dme.computeMethodsUsed();
      }

      if (Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool()) {
        dce = new DeadClassEliminator(this);
        dce.computeClassesUsed();
      }

      if (verbose()) {
        time = System.currentTimeMillis() - time;
        Tracer.traceln(time + "ms.]");
        Tracer.trace("[Translator: phase2...");
        time = System.currentTimeMillis();
      }

      for (int cno = 0; cno < suite.getClassCount(); cno++) {
        Klass klass = suite.getKlass(cno);
        Assert.always(Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool() || (klass != null));
        if (klass != null) {
          convertPhase2(klass);
        }
      }
    }
    classFiles.clear();

    if (verbose()) {
      time = System.currentTimeMillis() - time;
      Tracer.traceln(time + "ms.]");

      if (VM.isVeryVerbose()) {
        InstructionEmitter.printUncalledNativeMethods();
      }
    }
    Assert.always(lastClassNameStack.empty());
  }
Beispiel #2
0
  /** Read translator properties and set corresponding options. */
  private void setOptions() {
    Arg.setOptions();

    if (Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool()
        || Arg.get(Arg.DEAD_METHOD_ELIMINATION)
            .getBool() /* || (Arg.get(Arg.INLINE_METHOD_LIMIT).getInt() > 0)*/) {
      translationStrategy = BY_SUITE;
    } else if (Arg.get(Arg.OPTIMIZE_CONSTANT_OBJECTS).getBool()) {
      translationStrategy = BY_CLASS;
    } else {
      translationStrategy = BY_METHOD;
    }

    if (translationStrategy >= BY_SUITE
        && ((shouldDoInlining()
        /*|| Arg.get(Arg.OPTIMIZE_BYTECODE).getBool()
        || Arg.get(Arg.OPTIMIZE_BYTECODE_CONTROL).getBool()
        || Arg.get(Arg.OPTIMIZE_DEADCODE).getBool()*/ ))) {
      optimizeSuite = true;
    }
  }
Beispiel #3
0
 /** Returns true if the translator should print verbose progress */
 public static boolean verbose() {
   return Arg.get(Arg.VERBOSE).getBool();
 }