示例#1
0
 /** Print out statistics at the end of a GC */
 public final void printPostStats() {
   if ((Options.verbose.getValue() == 1) || (Options.verbose.getValue() == 2)) {
     Log.write("-> ");
     Log.writeDec(Conversions.pagesToBytes(getPagesUsed()).toWord().rshl(10));
     Log.write("KB   ");
     if (Options.verbose.getValue() == 1) {
       totalTime.printLast();
       Log.writeln(" ms]");
     } else {
       Log.write("End ");
       totalTime.printTotal();
       Log.writeln(" ms]");
     }
   }
   if (Options.verbose.getValue() > 2) {
     Log.write("   After Collection: ");
     Space.printUsageMB();
     if (Options.verbose.getValue() >= 4) {
       Log.write("                     ");
       Space.printUsagePages();
     }
     if (Options.verbose.getValue() >= 5) {
       Space.printVMMap();
     }
     Log.write("                     ");
     printUsedPages();
     Log.write("    Collection time: ");
     totalTime.printLast();
     Log.writeln(" ms");
   }
 }
示例#2
0
 /** Print out statistics at the start of a GC */
 public void printPreStats() {
   if ((Options.verbose.getValue() == 1) || (Options.verbose.getValue() == 2)) {
     Log.write("[GC ");
     Log.write(Stats.gcCount());
     if (Options.verbose.getValue() == 1) {
       Log.write(" Start ");
       Plan.totalTime.printTotalSecs();
       Log.write(" s");
     } else {
       Log.write(" Start ");
       Plan.totalTime.printTotalMillis();
       Log.write(" ms");
     }
     Log.write("   ");
     Log.write(Conversions.pagesToKBytes(getPagesUsed()));
     Log.write("KB ");
     Log.flush();
   }
   if (Options.verbose.getValue() > 2) {
     Log.write("Collection ");
     Log.write(Stats.gcCount());
     Log.write(":        ");
     printUsedPages();
     Log.write("  Before Collection: ");
     Space.printUsageMB();
     if (Options.verbose.getValue() >= 4) {
       Log.write("                     ");
       Space.printUsagePages();
     }
     if (Options.verbose.getValue() >= 5) {
       Space.printVMMap();
     }
   }
 }
示例#3
0
 /**
  * The postBoot method is called by the runtime immediately after command-line arguments are
  * available. Note that allocation must be supported prior to this point because the runtime
  * infrastructure may require allocation in order to parse the command line arguments. For this
  * reason all plans should operate gracefully on the default minimum heap size until the point
  * that boot is called.
  */
 @Interruptible
 public void postBoot() {
   VM.statistics.perfEventInit(Options.perfEvents.getValue());
   if (Options.verbose.getValue() > 2) Space.printVMMap();
   if (Options.verbose.getValue() > 3) VM.config.printConfig();
   if (Options.verbose.getValue() > 0) Stats.startAll();
   if (Options.eagerMmapSpaces.getValue()) Space.eagerlyMmapMMTkSpaces();
 }
示例#4
0
  @Uninterruptible
  public static boolean validRef(ObjectReference ref) {

    if (ref.isNull()) return true;
    if (!Space.isMappedObject(ref)) {
      VM.sysWrite("validRef: REF outside heap, ref = ");
      VM.sysWrite(ref);
      VM.sysWrite("\n");
      Space.printVMMap();
      return false;
    }
    if (MOVES_OBJECTS) {
      /*
      TODO: Work out how to check if forwarded
      if (Plan.isForwardedOrBeingForwarded(ref)) {
        // TODO: actually follow forwarding pointer
        // (need to bound recursion when things are broken!!)
        return true;
      }
      */
    }

    TIB tib = ObjectModel.getTIB(ref);
    Address tibAddr = Magic.objectAsAddress(tib);
    if (!Space.isMappedObject(ObjectReference.fromObject(tib))) {
      VM.sysWrite("validRef: TIB outside heap, ref = ");
      VM.sysWrite(ref);
      VM.sysWrite(" tib = ");
      VM.sysWrite(tibAddr);
      VM.sysWrite("\n");
      ObjectModel.dumpHeader(ref);
      return false;
    }
    if (tibAddr.isZero()) {
      VM.sysWrite("validRef: TIB is Zero! ");
      VM.sysWrite(ref);
      VM.sysWrite("\n");
      ObjectModel.dumpHeader(ref);
      return false;
    }
    if (tib.length() == 0) {
      VM.sysWrite("validRef: TIB length zero, ref = ");
      VM.sysWrite(ref);
      VM.sysWrite(" tib = ");
      VM.sysWrite(tibAddr);
      VM.sysWrite("\n");
      ObjectModel.dumpHeader(ref);
      return false;
    }

    ObjectReference type = ObjectReference.fromObject(tib.getType());
    if (!validType(type)) {
      VM.sysWrite("validRef: invalid TYPE, ref = ");
      VM.sysWrite(ref);
      VM.sysWrite(" tib = ");
      VM.sysWrite(Magic.objectAsAddress(tib));
      VM.sysWrite(" type = ");
      VM.sysWrite(type);
      VM.sysWrite("\n");
      ObjectModel.dumpHeader(ref);
      return false;
    }
    return true;
  } // validRef