src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp

Print this page
rev 2869 : 7117303: VM uses non-monotonic time source and complains that it is non-monotonic
Summary: Replaces calls to os::javaTimeMillis(), which does not guarantee montonicity, in GC code to os::javaTimeNanos() with a suitable conversion factor. os::javaTimeNanos() mostly guarantees montonicity depending on the underlying OS implementation and, as a result, a better alternative. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp.
Reviewed-by:

*** 3396,3416 **** "live objects skipped because closure is full"); } } jlong PSParallelCompact::millis_since_last_gc() { ! jlong ret_val = os::javaTimeMillis() - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { ! NOT_PRODUCT(warning("time warp: %d", ret_val);) return 0; } return ret_val; } void PSParallelCompact::reset_millis_since_last_gc() { ! _time_of_last_gc = os::javaTimeMillis(); } ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full() { if (source() != destination()) { --- 3396,3419 ---- "live objects skipped because closure is full"); } } jlong PSParallelCompact::millis_since_last_gc() { ! // os::javaTimeMillis() does not guarantee monotonicity. ! jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; ! jlong ret_val = now - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { ! NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);) return 0; } return ret_val; } void PSParallelCompact::reset_millis_since_last_gc() { ! // os::javaTimeMillis() does not guarantee monotonicity. ! _time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; } ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full() { if (source() != destination()) {