From 44f5dfef976bbe81c4b76b8b432f29ca2ea223d4 Mon Sep 17 00:00:00 2001 From: Boris Ulasevich Date: Fri, 11 Jul 2025 11:59:32 +0000 Subject: [PATCH] 8358183: [JVMCI] crash accessing nmethod::jvmci_name in CodeCache::aggregate Reviewed-by: thartmann Backport-of: 74822ce12acaf9816aa49b75ab5817ced3710776 --- src/hotspot/share/code/codeBlob.cpp | 2 ++ src/hotspot/share/code/nmethod.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 81ebb08fd51..cf21f1f89a4 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -210,6 +210,8 @@ void CodeBlob::purge() { if (_mutable_data != blob_end()) { os::free(_mutable_data); _mutable_data = blob_end(); // Valid not null address + _mutable_data_size = 0; + _relocation_size = 0; } if (_oop_maps != nullptr) { delete _oop_maps; diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 685740e4b88..412cf222997 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2166,6 +2166,7 @@ void nmethod::purge(bool unregister_nmethod) { } CodeCache::unregister_old_nmethod(this); + JVMCI_ONLY( _metadata_size = 0; ) CodeBlob::purge(); }