From 5ad126f44662d81d2d065b215ed967c0b983f9c9 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Wed, 12 Oct 2022 01:55:58 +0000 Subject: [PATCH] 8295012: Arena should not derive from CHeapObj Reviewed-by: stefank, dholmes --- src/hotspot/share/memory/arena.cpp | 23 ----------------------- src/hotspot/share/memory/arena.hpp | 11 +---------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/hotspot/share/memory/arena.cpp b/src/hotspot/share/memory/arena.cpp index c32c355bee7..b925daecd3c 100644 --- a/src/hotspot/share/memory/arena.cpp +++ b/src/hotspot/share/memory/arena.cpp @@ -271,29 +271,6 @@ Arena::~Arena() { MemTracker::record_arena_free(_flags); } -void* Arena::operator new(size_t size) throw() { - assert(false, "Use dynamic memory type binding"); - return NULL; -} - -void* Arena::operator new (size_t size, const std::nothrow_t& nothrow_constant) throw() { - assert(false, "Use dynamic memory type binding"); - return NULL; -} - - // dynamic memory type binding -void* Arena::operator new(size_t size, MEMFLAGS flags) throw() { - return (void *) AllocateHeap(size, flags, CALLER_PC); -} - -void* Arena::operator new(size_t size, const std::nothrow_t& nothrow_constant, MEMFLAGS flags) throw() { - return (void*)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL); -} - -void Arena::operator delete(void* p) { - FreeHeap(p); -} - // Destroy this arenas contents and reset to empty void Arena::destruct_contents() { if (UseMallocOnly && _first != NULL) { diff --git a/src/hotspot/share/memory/arena.hpp b/src/hotspot/share/memory/arena.hpp index e002fe0769c..bdddf5a3feb 100644 --- a/src/hotspot/share/memory/arena.hpp +++ b/src/hotspot/share/memory/arena.hpp @@ -86,7 +86,7 @@ class Chunk: CHeapObj { //------------------------------Arena------------------------------------------ // Fast allocation of memory -class Arena : public CHeapObj { +class Arena : public CHeapObjBase { protected: friend class HandleMark; friend class NoHandleMark; @@ -121,15 +121,6 @@ protected: void destruct_contents(); char* hwm() const { return _hwm; } - // new operators - void* operator new (size_t size) throw(); - void* operator new (size_t size, const std::nothrow_t& nothrow_constant) throw(); - - // dynamic memory type tagging - void* operator new(size_t size, MEMFLAGS flags) throw(); - void* operator new(size_t size, const std::nothrow_t& nothrow_constant, MEMFLAGS flags) throw(); - void operator delete(void* p); - // Fast allocate in the arena. Common case aligns to the size of jlong which is 64 bits // on both 32 and 64 bit platforms. Required for atomic jlong operations on 32 bits. void* Amalloc(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {