Mercurial > hg > truffle
comparison src/share/vm/memory/generation.hpp @ 4712:e7dead7e90af
7117303: VM uses non-monotonic time source and complains that it is non-monotonic
Summary: 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
author | johnc |
---|---|
date | Mon, 19 Dec 2011 10:02:05 -0800 |
parents | 3c648b9ad052 |
children | b632e80fc9dc |
comparison
equal
deleted
inserted
replaced
4711:adedfbbf0360 | 4712:e7dead7e90af |
---|---|
411 virtual void ensure_parsability() {}; | 411 virtual void ensure_parsability() {}; |
412 | 412 |
413 // Time (in ms) when we were last collected or now if a collection is | 413 // Time (in ms) when we were last collected or now if a collection is |
414 // in progress. | 414 // in progress. |
415 virtual jlong time_of_last_gc(jlong now) { | 415 virtual jlong time_of_last_gc(jlong now) { |
416 // XXX See note in genCollectedHeap::millis_since_last_gc() | 416 // Both _time_of_last_gc and now are set using a time source |
417 // that guarantees monotonically non-decreasing values provided | |
418 // the underlying platform provides such a source. So we still | |
419 // have to guard against non-monotonicity. | |
417 NOT_PRODUCT( | 420 NOT_PRODUCT( |
418 if (now < _time_of_last_gc) { | 421 if (now < _time_of_last_gc) { |
419 warning("time warp: %d to %d", _time_of_last_gc, now); | 422 warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now); |
420 } | 423 } |
421 ) | 424 ) |
422 return _time_of_last_gc; | 425 return _time_of_last_gc; |
423 } | 426 } |
424 | 427 |