diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index ef99bd98c93..ccfc1c036c2 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -2719,18 +2719,6 @@ bool ShenandoahRegionIterator::has_next() const { return _index < _heap->num_regions(); } -char ShenandoahHeap::gc_state() const { - return _gc_state.raw_value(); -} - -bool ShenandoahHeap::is_gc_state(GCState state) const { - // If the global gc state has been changed, but hasn't yet been propagated to all threads, then - // the global gc state is the correct value. Once the gc state has been synchronized with all threads, - // _gc_state_changed will be toggled to false and we need to use the thread local state. - return _gc_state_changed ? _gc_state.is_set(state) : ShenandoahThreadLocalData::is_gc_state(state); -} - - ShenandoahLiveData* ShenandoahHeap::get_liveness_cache(uint worker_id) { #ifdef ASSERT assert(_liveness_cache != nullptr, "sanity"); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 174001170f4..9240091070b 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -353,7 +353,7 @@ private: public: // This returns the raw value of the singular, global gc state. - char gc_state() const; + inline char gc_state() const; // Compares the given state against either the global gc state, or the thread local state. // The global gc state may change on a safepoint and is the correct value to use until @@ -361,7 +361,7 @@ public: // compare against the thread local state). The thread local gc state may also be changed // by a handshake operation, in which case, this function continues using the updated thread // local value. - bool is_gc_state(GCState state) const; + inline bool is_gc_state(GCState state) const; // This copies the global gc state into a thread local variable for all threads. // The thread local gc state is primarily intended to support quick access at barriers. diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index 34c279a1495..e35f116b843 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -452,6 +452,17 @@ inline bool ShenandoahHeap::in_collection_set_loc(void* p) const { return collection_set()->is_in_loc(p); } +inline char ShenandoahHeap::gc_state() const { + return _gc_state.raw_value(); +} + +inline bool ShenandoahHeap::is_gc_state(GCState state) const { + // If the global gc state has been changed, but hasn't yet been propagated to all threads, then + // the global gc state is the correct value. Once the gc state has been synchronized with all threads, + // _gc_state_changed will be toggled to false and we need to use the thread local state. + return _gc_state_changed ? _gc_state.is_set(state) : ShenandoahThreadLocalData::is_gc_state(state); +} + inline bool ShenandoahHeap::is_idle() const { return _gc_state_changed ? _gc_state.is_clear() : ShenandoahThreadLocalData::gc_state(Thread::current()) == 0; }