mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7117303: VM uses non-monotonic time source and complains that it is non-monotonic
Replaces calls to os::javaTimeMillis(), which does not (and cannot) guarantee monotonicity, in GC code to an equivalent expression that uses os::javaTimeNanos(). os::javaTimeNanos is guaranteed monotonically non-decreasing if the underlying platform provides a monotonic time source. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp. Reviewed-by: dholmes, ysr
This commit is contained in:
parent
2768349b41
commit
870bea622a
10 changed files with 57 additions and 57 deletions
|
@ -3398,17 +3398,22 @@ PSParallelCompact::move_and_update(ParCompactionManager* cm, SpaceId space_id) {
|
|||
}
|
||||
|
||||
jlong PSParallelCompact::millis_since_last_gc() {
|
||||
jlong ret_val = os::javaTimeMillis() - _time_of_last_gc;
|
||||
// We need a monotonically non-deccreasing time in ms but
|
||||
// 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: %d", ret_val);)
|
||||
NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);)
|
||||
return 0;
|
||||
}
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
void PSParallelCompact::reset_millis_since_last_gc() {
|
||||
_time_of_last_gc = os::javaTimeMillis();
|
||||
// We need a monotonically non-deccreasing time in ms but
|
||||
// os::javaTimeMillis() does not guarantee monotonicity.
|
||||
_time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
|
||||
}
|
||||
|
||||
ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue