RFR: 8316930: HotSpot should use noexcept instead of throw() [v4]
David Holmes
dholmes at openjdk.org
Sun Feb 4 23:12:01 UTC 2024
On Sun, 4 Feb 2024 23:04:05 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/c1/c1_Instruction.hpp line 337:
>>
>>> 335:
>>> 336: public:
>>> 337: void* operator new(size_t size) noexcept {
>>
>> Should the noexcept specifiers on both operator new in this file be removed? They both call Amalloc with the default parameter of EXIT_OOM, which means they both crash instead of returning nullptr when failing to allocate memory
>
> I think EXIT_OOM is an implementation detail. The key point is that these methods do not throw.
Or do I have that backwards ... the key point of `no_except` is that callers of these method must check for `nullptr`, but with EXIT_OOM that is not the case - and we don't want it to appear that the allocation can actually fail and we continue execution!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15910#discussion_r1477473934
More information about the hotspot-dev
mailing list