From c5b7af73d07f7458e970f5752eb75640562ddc7b Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Sat, 20 Jul 2024 15:41:29 +0000 Subject: [PATCH] 8336692: Redo fix for JDK-8284620 Reviewed-by: dlong --- src/hotspot/share/asm/codeBuffer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp index ea47e435c0b..b25e07bc36d 100644 --- a/src/hotspot/share/asm/codeBuffer.cpp +++ b/src/hotspot/share/asm/codeBuffer.cpp @@ -135,10 +135,11 @@ CodeBuffer::~CodeBuffer() { // Previous incarnations of this buffer are held live, so that internal // addresses constructed before expansions will not be confused. cb->free_blob(); - // free any overflow storage - delete cb->_overflow_arena; } - + if (_overflow_arena != nullptr) { + // free any overflow storage + delete _overflow_arena; + } if (_shared_trampoline_requests != nullptr) { delete _shared_trampoline_requests; } @@ -973,8 +974,6 @@ void CodeBuffer::take_over_code_from(CodeBuffer* cb) { CodeSection* this_sect = code_section(n); this_sect->take_over_code_from(cb_sect); } - _overflow_arena = cb->_overflow_arena; - cb->_overflow_arena = nullptr; // Make sure the old cb won't try to use it or free it. DEBUG_ONLY(cb->_blob = (BufferBlob*)badAddress); }