diff --git a/src/hotspot/share/gc/g1/g1CollectorState.hpp b/src/hotspot/share/gc/g1/g1CollectorState.hpp index 762ddb1fc8f..002b7894030 100644 --- a/src/hotspot/share/gc/g1/g1CollectorState.hpp +++ b/src/hotspot/share/gc/g1/g1CollectorState.hpp @@ -59,7 +59,7 @@ class G1CollectorState { // has been in progress when the request came in. // // This flag remembers that there is an unfullfilled request. - volatile bool _initiate_conc_mark_if_possible; + bool _initiate_conc_mark_if_possible; public: G1CollectorState() : diff --git a/src/hotspot/share/gc/g1/g1CollectorState.inline.hpp b/src/hotspot/share/gc/g1/g1CollectorState.inline.hpp index b63d683bb63..1a0e91f1adb 100644 --- a/src/hotspot/share/gc/g1/g1CollectorState.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectorState.inline.hpp @@ -42,7 +42,7 @@ inline void G1CollectorState::set_in_full_gc() { inline void G1CollectorState::set_in_concurrent_start_gc() { _phase = Phase::YoungConcurrentStart; - _initiate_conc_mark_if_possible = false; + set_initiate_conc_mark_if_possible(false); } inline void G1CollectorState::set_in_prepare_mixed_gc() { _phase = Phase::YoungPrepareMixed; diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 2414fdd7840..d271a8a610a 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -1253,6 +1253,7 @@ void G1Policy::update_survivors_policy() { } bool G1Policy::force_concurrent_start_if_outside_cycle(GCCause::Cause gc_cause) { + assert_at_safepoint_on_vm_thread(); // Check whether a concurrent cycle is active, do not include the // reclamation/mixed phase. This means that we can schedule a concurrent cycle // even while in the mixed phase. diff --git a/src/hotspot/share/gc/g1/g1Policy.hpp b/src/hotspot/share/gc/g1/g1Policy.hpp index 1fa81fe60b6..e09a76397cc 100644 --- a/src/hotspot/share/gc/g1/g1Policy.hpp +++ b/src/hotspot/share/gc/g1/g1Policy.hpp @@ -335,9 +335,8 @@ private: public: // This sets the initiate_conc_mark_if_possible() flag to start a - // new cycle, as long as we are not already in one. It's best if it - // is called during a safepoint when the test whether a cycle is in - // progress or not is stable. + // new cycle, as long as we are not already in one. It is called + // at a safepoint. bool force_concurrent_start_if_outside_cycle(GCCause::Cause gc_cause); // Decide whether this garbage collection pause should be a concurrent start diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.hpp b/src/hotspot/share/gc/g1/g1YoungCollector.hpp index 7415bc83827..e9f2477ea76 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.hpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.hpp @@ -144,7 +144,7 @@ public: size_t allocation_word_size); void collect(); - G1CollectorState next_state() const { return _next_state; } + const G1CollectorState next_state() const { return _next_state; } bool concurrent_operation_is_full_mark() const { return _concurrent_operation_is_full_mark; } };