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

Print this page
rev 2870 : 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 is guaranteed monotonic if the underlying platform provides a monotonic timesource. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp.
Reviewed-by: dholmes

*** 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,3421 ---- "live objects skipped because closure is full"); } } jlong PSParallelCompact::millis_since_last_gc() { ! // We need a montonically increasing time in ms but os::javaTimeMillis() ! // does not guarantee montonicity. ! 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() { ! // We need a montonically increasing time in ms but os::javaTimeMillis() ! // does not guarantee montonicity. ! _time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; } ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full() { if (source() != destination()) {