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:
John Cuthbertson 2011-12-19 10:02:05 -08:00
parent 2768349b41
commit 870bea622a
10 changed files with 57 additions and 57 deletions

View file

@ -1674,7 +1674,6 @@ void* os::thread_local_storage_at(int index) {
}
const int NANOSECS_PER_MILLISECS = 1000000;
// gethrtime can move backwards if read from one cpu and then a different cpu
// getTimeNanos is guaranteed to not move backward on Solaris
// local spinloop created as faster for a CAS on an int than
@ -1803,7 +1802,7 @@ double os::elapsedVTime() {
// getTimeMillis guaranteed to not move backwards on Solaris
jlong getTimeMillis() {
jlong nanotime = getTimeNanos();
return (jlong)(nanotime / NANOSECS_PER_MILLISECS);
return (jlong)(nanotime / NANOSECS_PER_MILLISEC);
}
// Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis
@ -6064,10 +6063,7 @@ void os::PlatformEvent::unpark() {
* is no need to track notifications.
*/
#define NANOSECS_PER_SEC 1000000000
#define NANOSECS_PER_MILLISEC 1000000
#define MAX_SECS 100000000
/*
* This code is common to linux and solaris and will be moved to a
* common place in dolphin.