equal
deleted
inserted
replaced
326 // Arming must be done after resetting _current_jni_active_count, _waiting_to_block. |
326 // Arming must be done after resetting _current_jni_active_count, _waiting_to_block. |
327 _wait_barrier->arm(static_cast<int>(_safepoint_counter + 1)); |
327 _wait_barrier->arm(static_cast<int>(_safepoint_counter + 1)); |
328 |
328 |
329 assert((_safepoint_counter & 0x1) == 0, "must be even"); |
329 assert((_safepoint_counter & 0x1) == 0, "must be even"); |
330 // The store to _safepoint_counter must happen after any stores in arming. |
330 // The store to _safepoint_counter must happen after any stores in arming. |
331 OrderAccess::release_store(&_safepoint_counter, _safepoint_counter + 1); |
331 Atomic::release_store(&_safepoint_counter, _safepoint_counter + 1); |
332 |
332 |
333 // We are synchronizing |
333 // We are synchronizing |
334 OrderAccess::storestore(); // Ordered with _safepoint_counter |
334 OrderAccess::storestore(); // Ordered with _safepoint_counter |
335 _state = _synchronizing; |
335 _state = _synchronizing; |
336 |
336 |
480 // No threads should see _synchronized when running. |
480 // No threads should see _synchronized when running. |
481 _state = _not_synchronized; |
481 _state = _not_synchronized; |
482 |
482 |
483 // Set the next dormant (even) safepoint id. |
483 // Set the next dormant (even) safepoint id. |
484 assert((_safepoint_counter & 0x1) == 1, "must be odd"); |
484 assert((_safepoint_counter & 0x1) == 1, "must be odd"); |
485 OrderAccess::release_store(&_safepoint_counter, _safepoint_counter + 1); |
485 Atomic::release_store(&_safepoint_counter, _safepoint_counter + 1); |
486 |
486 |
487 OrderAccess::fence(); // Keep the local state from floating up. |
487 OrderAccess::fence(); // Keep the local state from floating up. |
488 |
488 |
489 jtiwh.rewind(); |
489 jtiwh.rewind(); |
490 for (; JavaThread *current = jtiwh.next(); ) { |
490 for (; JavaThread *current = jtiwh.next(); ) { |
966 thread->set_safepoint_state(NULL); |
966 thread->set_safepoint_state(NULL); |
967 } |
967 } |
968 } |
968 } |
969 |
969 |
970 uint64_t ThreadSafepointState::get_safepoint_id() const { |
970 uint64_t ThreadSafepointState::get_safepoint_id() const { |
971 return OrderAccess::load_acquire(&_safepoint_id); |
971 return Atomic::load_acquire(&_safepoint_id); |
972 } |
972 } |
973 |
973 |
974 void ThreadSafepointState::reset_safepoint_id() { |
974 void ThreadSafepointState::reset_safepoint_id() { |
975 OrderAccess::release_store(&_safepoint_id, SafepointSynchronize::InactiveSafepointCounter); |
975 Atomic::release_store(&_safepoint_id, SafepointSynchronize::InactiveSafepointCounter); |
976 } |
976 } |
977 |
977 |
978 void ThreadSafepointState::set_safepoint_id(uint64_t safepoint_id) { |
978 void ThreadSafepointState::set_safepoint_id(uint64_t safepoint_id) { |
979 OrderAccess::release_store(&_safepoint_id, safepoint_id); |
979 Atomic::release_store(&_safepoint_id, safepoint_id); |
980 } |
980 } |
981 |
981 |
982 void ThreadSafepointState::examine_state_of_thread(uint64_t safepoint_count) { |
982 void ThreadSafepointState::examine_state_of_thread(uint64_t safepoint_count) { |
983 assert(is_running(), "better be running or just have hit safepoint poll"); |
983 assert(is_running(), "better be running or just have hit safepoint poll"); |
984 |
984 |