VM.sysFail("GC Error: Barrier Timeout");
VM_Interface.sysFail("GC Error: Barrier Timeout");
  public int arrive (int where) {    VM_Magic.isync();    int cur = currentCounter.peek();    SynchronizedCounter c = counters[cur];    int myValue = c.increment();    // Do NOT use the currentCounter variables unless designated thread    if (verbose >= 1) VM.sysWriteln("", where, ": myValue = ", myValue);    if (VM.VerifyAssertions)       VM._assert(myValue >= 0 && (target == -1 || myValue <= target));    if (myValue + 2 == target) {       // last one to show up      int next = (cur + 1) % NUM_COUNTERS;      int prev = (cur - 1 + NUM_COUNTERS) % NUM_COUNTERS;       counters[prev].reset();       // everyone has seen the value so safe to reset now      if (next == 0)	currentCounter.reset();    // everyone has arrived but still waiting      else	currentCounter.increment();         c.increment();                // now safe to let others past barrier      // VM.sysWriteln("last guy done ", where);      VM_Magic.sync();      return myValue;    } else {      // everyone else      long startCheck = 0;      long lastElapsed = 0;      for (int i=0; ; i++) {	if (target != -1 && c.peek() == target) {	  VM_Magic.sync();	  return myValue;	}	if (((i - 1) % TIME_CHECK) == 0) {	  if (startCheck == 0) {	    startCheck = VM_Interface.cycles();	  } else {	    long elapsed = VM_Interface.cycles() - startCheck;	    if (elapsed - lastElapsed > WARN_PERIOD) {	      VM.sysWrite("GC Warning: Barrier wait has reached ", VM_Interface.cyclesToSecs(elapsed));	      VM.sysWrite(" seconds.  Called from ", where, ".  myOrder = ", myValue);	      VM.sysWriteln("  count is ", c.peek(), " waiting for ", target - 1);	      lastElapsed = elapsed;	    }	    if (elapsed > TIME_OUT)	      VM.sysFail("GC Error: Barrier Timeout");	  }	}      }    }  }