8295012: Arena should not derive from CHeapObj<mtNone>

Reviewed-by: stefank, dholmes
This commit is contained in:
Kim Barrett 2022-10-12 01:55:58 +00:00
parent ab8c1361bc
commit 5ad126f446
2 changed files with 1 additions and 33 deletions

View File

@ -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) {

View File

@ -86,7 +86,7 @@ class Chunk: CHeapObj<mtChunk> {
//------------------------------Arena------------------------------------------
// Fast allocation of memory
class Arena : public CHeapObj<mtNone> {
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) {