--- a/src/hotspot/share/runtime/safepoint.hpp Fri Nov 23 10:51:59 2018 +0100
+++ b/src/hotspot/share/runtime/safepoint.hpp Fri Nov 23 10:43:18 2018 +0100
@@ -101,11 +101,11 @@
// safepoint. The fact that Threads_lock is held throughout each pair of
// increments (at the beginning and end of each safepoint) guarantees
// race freedom.
-public:
- static volatile int _safepoint_counter;
+ static volatile uint64_t _safepoint_counter;
+
private:
- static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
- static julong _coalesced_vmop_count; // coalesced vmop count
+ static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
+ static julong _coalesced_vmop_count; // coalesced vmop count
// Statistics
static void begin_statistics(int nof_threads, int nof_running);
@@ -132,9 +132,9 @@
static void check_for_lazy_critical_native(JavaThread *thread, JavaThreadState state);
// Query
- inline static bool is_at_safepoint() { return _state == _synchronized; }
- inline static bool is_synchronizing() { return _state == _synchronizing; }
- inline static int safepoint_counter() { return _safepoint_counter; }
+ inline static bool is_at_safepoint() { return _state == _synchronized; }
+ inline static bool is_synchronizing() { return _state == _synchronizing; }
+ inline static uint64_t safepoint_counter() { return _safepoint_counter; }
inline static void increment_jni_active_count() {
assert_locked_or_safepoint(Safepoint_lock);
@@ -176,8 +176,17 @@
// Assembly support
static address address_of_state() { return (address)&_state; }
- static address safepoint_counter_addr() { return (address)&_safepoint_counter; }
-
+ // Only used for making sure that no safepoint has happened in
+ // JNI_FastGetField. Therefore only the low 32-bits are needed
+ // even if this is a 64-bit counter.
+ static address safepoint_counter_addr() {
+#ifdef VM_LITTLE_ENDIAN
+ return (address)&_safepoint_counter;
+#else /* BIG */
+ // Return pointer to the 32 LSB:
+ return (address) (((uint32_t*)(&_safepoint_counter)) + 1);
+#endif
+ }
};
// Some helper assert macros for safepoint checks.