From a0caf2c7bf776974efd2a487a307045174b840eb Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Fri, 24 Apr 2026 05:29:07 +0000 Subject: [PATCH] 8383163: Build without CDS broken after 8382170 Reviewed-by: kvn, jiefu --- src/hotspot/share/memory/allocation.cpp | 4 +++- src/hotspot/share/memory/allocation.hpp | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/memory/allocation.cpp b/src/hotspot/share/memory/allocation.cpp index 5237cd5b157..f5e4e1f3df6 100644 --- a/src/hotspot/share/memory/allocation.cpp +++ b/src/hotspot/share/memory/allocation.cpp @@ -67,9 +67,11 @@ void FreeHeap(void* p) { os::free(p); } -#if INCLUDE_CDS +// These are used by the Serviceability Agent even if CDS is disabled void* MetaspaceObj::_aot_metaspace_base = nullptr; void* MetaspaceObj::_aot_metaspace_top = nullptr; + +#if INCLUDE_CDS volatile bool MetaspaceObj::_aot_metaspace_range_initialized = false; void MetaspaceObj::set_aot_metaspace_range(void* base, void* top) { diff --git a/src/hotspot/share/memory/allocation.hpp b/src/hotspot/share/memory/allocation.hpp index 82b388f3878..a49f9ce9a0b 100644 --- a/src/hotspot/share/memory/allocation.hpp +++ b/src/hotspot/share/memory/allocation.hpp @@ -260,6 +260,11 @@ class MetaspaceObj { // void deallocate_contents(ClassLoaderData* loader_data); friend class VMStructs; + + // These are used by the Serviceability Agent even if CDS is disabled + static void* _aot_metaspace_base; // (inclusive) low address + static void* _aot_metaspace_top; // (exclusive) high address + public: // Returns true if the pointer points to a valid MetaspaceObj. A valid @@ -277,8 +282,6 @@ private: // two pointers to quickly determine if a MetaspaceObj is in the // AOT cache. // When AOT/CDS is not enabled, both pointers are set to null. - static void* _aot_metaspace_base; // (inclusive) low address - static void* _aot_metaspace_top; // (exclusive) high address static volatile bool _aot_metaspace_range_initialized; static bool aot_metaspace_range_initialized();