mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-05 11:15:13 +00:00
8231356: Fix broken ResourceObj::operator new[] in debug builds
Reviewed-by: kbarrett, iklam
This commit is contained in:
parent
81c719be39
commit
3cd95a2932
@ -110,12 +110,6 @@ void* ResourceObj::operator new(size_t size, Arena *arena) throw() {
|
||||
return res;
|
||||
}
|
||||
|
||||
void* ResourceObj::operator new [](size_t size, Arena *arena) throw() {
|
||||
address res = (address)arena->Amalloc(size);
|
||||
DEBUG_ONLY(set_allocation_type(res, ARENA);)
|
||||
return res;
|
||||
}
|
||||
|
||||
void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
|
||||
address res = NULL;
|
||||
switch (type) {
|
||||
@ -133,10 +127,6 @@ void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flag
|
||||
return res;
|
||||
}
|
||||
|
||||
void* ResourceObj::operator new [](size_t size, allocation_type type, MEMFLAGS flags) throw() {
|
||||
return (address) operator new(size, type, flags);
|
||||
}
|
||||
|
||||
void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_constant,
|
||||
allocation_type type, MEMFLAGS flags) throw() {
|
||||
// should only call this with std::nothrow, use other operator new() otherwise
|
||||
@ -156,11 +146,6 @@ void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_cons
|
||||
return res;
|
||||
}
|
||||
|
||||
void* ResourceObj::operator new [](size_t size, const std::nothrow_t& nothrow_constant,
|
||||
allocation_type type, MEMFLAGS flags) throw() {
|
||||
return (address)operator new(size, nothrow_constant, type, flags);
|
||||
}
|
||||
|
||||
void ResourceObj::operator delete(void* p) {
|
||||
assert(((ResourceObj *)p)->allocated_on_C_heap(),
|
||||
"delete only allowed for C_HEAP objects");
|
||||
@ -168,10 +153,6 @@ void ResourceObj::operator delete(void* p) {
|
||||
FreeHeap(p);
|
||||
}
|
||||
|
||||
void ResourceObj::operator delete [](void* p) {
|
||||
operator delete(p);
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
void ResourceObj::set_allocation_type(address res, allocation_type type) {
|
||||
// Set allocation type in the resource object
|
||||
|
||||
@ -421,15 +421,13 @@ protected:
|
||||
|
||||
public:
|
||||
void* operator new(size_t size, allocation_type type, MEMFLAGS flags) throw();
|
||||
void* operator new [](size_t size, allocation_type type, MEMFLAGS flags) throw();
|
||||
void* operator new [](size_t size, allocation_type type, MEMFLAGS flags) throw() = delete;
|
||||
void* operator new(size_t size, const std::nothrow_t& nothrow_constant,
|
||||
allocation_type type, MEMFLAGS flags) throw();
|
||||
void* operator new [](size_t size, const std::nothrow_t& nothrow_constant,
|
||||
allocation_type type, MEMFLAGS flags) throw();
|
||||
|
||||
allocation_type type, MEMFLAGS flags) throw() = delete;
|
||||
void* operator new(size_t size, Arena *arena) throw();
|
||||
|
||||
void* operator new [](size_t size, Arena *arena) throw();
|
||||
void* operator new [](size_t size, Arena *arena) throw() = delete;
|
||||
|
||||
void* operator new(size_t size) throw() {
|
||||
address res = (address)resource_allocate_bytes(size);
|
||||
@ -443,20 +441,10 @@ protected:
|
||||
return res;
|
||||
}
|
||||
|
||||
void* operator new [](size_t size) throw() {
|
||||
address res = (address)resource_allocate_bytes(size);
|
||||
DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
|
||||
return res;
|
||||
}
|
||||
|
||||
void* operator new [](size_t size, const std::nothrow_t& nothrow_constant) throw() {
|
||||
address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
|
||||
DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
|
||||
return res;
|
||||
}
|
||||
|
||||
void* operator new [](size_t size) throw() = delete;
|
||||
void* operator new [](size_t size, const std::nothrow_t& nothrow_constant) throw() = delete;
|
||||
void operator delete(void* p);
|
||||
void operator delete [](void* p);
|
||||
void operator delete [](void* p) = delete;
|
||||
};
|
||||
|
||||
// One of the following macros must be used when allocating an array
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user