RFR: 8305590: Remove nothrow exception specifications from operator new

Coleen Phillimore coleenp at openjdk.org
Tue Apr 18 15:22:05 UTC 2023


On Mon, 17 Apr 2023 17:09:44 GMT, Afshin Zafari <duke at openjdk.org> wrote:

> - The `throw()` (i.e., no throw) specifications are removed from the instances of `operator new` where _do not_ return `nullptr`.
> 
> - The `-fcheck-new` is removed from the gcc compile flags.
> 
> - The `operator new` and `operator delete` are deleted from `StackObj`.
> 
> - The `GrowableArrayCHeap::operator delete` is added to be matched with its corresponding allocation`AnyObj::operator new`, because gcc complains on that after removing the `-fcheck-new` flag. 
> - The `Thread::operator new`with and without `null` return are removed.
> 
> ### Tests
> local: linux-x64 gtest:GrowableArrayCHeap, macosx-aarch64 hotspot:tier1
> mach5: tiers 1-5

Changes requested by coleenp (Reviewer).

src/hotspot/share/memory/allocation.hpp line 289:

> 287:   void* operator new [](size_t size) throw() = delete;
> 288:   void  operator delete(void* p) = delete;
> 289:   void  operator delete [](void* p) = delete;

Nice.

src/hotspot/share/runtime/thread.hpp line 203:

> 201:   static bool is_JavaThread_protected_by_TLH(const JavaThread* target);
> 202: 
> 203:   void  operator delete(void* p);

Should you have removed delete and Thread::allocate() also?  is Thread::allocate now unused?

-------------

PR Review: https://git.openjdk.org/jdk/pull/13498#pullrequestreview-1390368704
PR Review Comment: https://git.openjdk.org/jdk/pull/13498#discussion_r1170196398
PR Review Comment: https://git.openjdk.org/jdk/pull/13498#discussion_r1170197505



More information about the build-dev mailing list