示例#1
0
  /** {@inheritDoc} */
  public void convert(Klass klass) {
    lastClassNameStack.push(klass.getName());
    int state = klass.getState();
    if (state < Klass.STATE_CONVERTING) {
      if (klass.isArray()) {
        convert(Klass.OBJECT);
        klass.changeState(Klass.STATE_CONVERTED);
      } else {
        traceProgress();

        ClassFile classFile = getClassFile(klass);
        classFile.convertPhase1(this, translationStrategy != BY_METHOD);
        if (klass.hasGlobalStatics()) {
          // record globals now.
          recordGlobalStatics(klass);
        }

        if (translationStrategy == BY_METHOD || translationStrategy == BY_CLASS) {
          // if NOT inlining, then generate squawk code now.
          classFile.convertPhase2(this, translationStrategy == BY_METHOD);
          classFiles.remove(klass.getName());
        }
      }
    }
    lastClassNameStack.pop();
  }
示例#2
0
 /**
  * Generate squawk code for methods of <code>klass</code> when doing whole-suite translation
  * (inlining, etc.)
  *
  * @param klass the klass to generate code for
  */
 void convertPhase2(Klass klass) {
   Assert.that(translationStrategy != BY_METHOD);
   convert(klass);
   if (klass.getState() < Klass.STATE_CONVERTED) {
     if (!VM
         .isVerbose()) { // "squawk -verbose" will show the class names as it finishes loading
                         // them, which is progress enough
       traceProgress();
     }
     lastClassNameStack.push(klass.getName());
     ClassFile classFile = getClassFile(klass);
     classFile.convertPhase2(this, false);
     classFiles.remove(klass.getName());
     lastClassNameStack.pop();
   }
 }