diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index b8e4ad9bef1ce..aa0f20d904b7f 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -320,13 +320,12 @@ inline bool G1CollectedHeap::is_collection_set_candidate(const HeapRegion* r) co BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()), \ BOOL_TO_STR(Thread::current()->is_VM_thread()) -DEBUG_ONLY( +#ifdef ASSERT inline void G1CollectedHeap::assert_heap_locked() { assert(Heap_lock->owned_by_self(), heap_locking_asserts_params("should be holding the Heap_lock")); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap:: assert_heap_locked_or_at_safepoint(bool should_be_vm_thread) { assert(Heap_lock->owned_by_self() || @@ -334,47 +333,41 @@ assert_heap_locked_or_at_safepoint(bool should_be_vm_thread) { ((should_be_vm_thread) == Thread::current()->is_VM_thread())), heap_locking_asserts_params("should be holding the Heap_lock or " "should be at a safepoint")); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap::assert_heap_locked_and_not_at_safepoint() { assert(Heap_lock->owned_by_self() && !SafepointSynchronize::is_at_safepoint(), heap_locking_asserts_params("should be holding the Heap_lock and " "should not be at a safepoint")); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap::assert_heap_not_locked() { assert(!Heap_lock->owned_by_self(), heap_locking_asserts_params("should not be holding the Heap_lock")); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap::assert_heap_not_locked_and_not_at_safepoint() { assert(!Heap_lock->owned_by_self() && !SafepointSynchronize::is_at_safepoint(), heap_locking_asserts_params("should not be holding the Heap_lock and " "should not be at a safepoint")); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap::assert_at_safepoint_on_vm_thread() { assert_at_safepoint(); assert(Thread::current_or_null() != nullptr, "no current thread"); assert(Thread::current()->is_VM_thread(), "current thread is not VM thread"); -}) +} -DEBUG_ONLY( inline void G1CollectedHeap:: assert_used_and_recalculate_used_equal(G1CollectedHeap* g1h) { -#ifdef ASSERT size_t cur_used_bytes = g1h->used(); size_t recal_used_bytes = g1h->recalculate_used(); assert(cur_used_bytes == recal_used_bytes, "Used(" SIZE_FORMAT ") is not" " same as recalculated used(" SIZE_FORMAT ").", cur_used_bytes, recal_used_bytes); -#endif -}) +} +#endif // ASSERT #endif // SHARE_GC_G1_G1COLLECTEDHEAP_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp index 90100f701d4be..2e85dd6a57bf3 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "ci/ciUtilities.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" -#include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1MonotonicArenaFreeMemoryTask.hpp" #include "gc/g1/g1MonotonicArenaFreePool.hpp" #include "gc/g1/g1_globals.hpp"