if (VM_Interface.VerifyAssertions) VM_Interface._assert(gcLoad >= 0);
if (VM_Interface.VerifyAssertions && gcLoad < 0) { VM_Interface.sysWriteln("gcLoad computed to be ",gcLoad); VM_Interface.sysWriteln("\taccumulateGCTime was ",accumulatedGCTime); VM_Interface.sysWriteln("\ttotalTime was ", totalTime); VM_Interface._assert(false); }
  private static double computeHeapChangeRatio(double liveRatio) {    // (1) compute GC load.    double totalTime = VM_Interface.now() - endLastMajorGC;    double gcLoad = accumulatedGCTime / totalTime;    if (liveRatio > 1) {      // Perhaps indicates bad bookkeeping in JMTk?      VM_Interface.sysWriteln("GCWarning: Live ratio greater than 1: ",liveRatio);      liveRatio = 1;    }    if (gcLoad > 1) {      // Appears that this can actually happen....I can't explain why --dave      VM_Interface.sysWriteln("GCWarning: GC load was greater than 1!! ",gcLoad);      VM_Interface.sysWriteln("GCWarning:\ttotal time ",totalTime);      VM_Interface.sysWriteln("GCWarnin:\tgc time ",accumulatedGCTime);      gcLoad = 1;    }    if (VM_Interface.VerifyAssertions) VM_Interface._assert(liveRatio >= 0);    if (VM_Interface.VerifyAssertions) VM_Interface._assert(gcLoad >= 0);        if (Options.verbose > 2) {      VM_Interface.sysWriteln("Live ratio ",liveRatio);      VM_Interface.sysWriteln("GCLoad     ",gcLoad);    }        // (2) Find the 4 points surrounding gcLoad and liveRatio    int liveRatioUnder = 1;    int liveRatioAbove = function[0].length-1;    int gcLoadUnder = 1;    int gcLoadAbove = function.length-1;    while (true) {      if (function[0][liveRatioUnder+1] >= liveRatio) break;      liveRatioUnder++;    }    while (true) {      if (function[0][liveRatioAbove-1] <= liveRatio) break;      liveRatioAbove--;    }    while (true) {      if (function[gcLoadUnder+1][0] >= gcLoad) break;      gcLoadUnder++;    }    while (true) {      if (function[gcLoadAbove-1][0] <= gcLoad) break;      gcLoadAbove--;    }    // (3) Compute the heap change ratio    double factor = function[gcLoadUnder][liveRatioUnder];    double liveRatioFraction =       (liveRatio - function[0][liveRatioUnder]) /      (function[0][liveRatioAbove] - function[0][liveRatioUnder]);    double liveRatioDelta =       function[gcLoadUnder][liveRatioAbove] - function[gcLoadUnder][liveRatioUnder];    factor += (liveRatioFraction * liveRatioDelta);    double gcLoadFraction =       (gcLoad - function[gcLoadUnder][0]) /       (function[gcLoadAbove][0] - function[gcLoadUnder][0]);    double gcLoadDelta =       function[gcLoadAbove][liveRatioUnder] - function[gcLoadUnder][liveRatioUnder];    factor += (gcLoadFraction * gcLoadDelta);    if (Options.verbose > 2) VM_Interface.sysWriteln("After gcLoad adjustment factor is ",factor);    return factor;  }