RFR: 8295012: Arena should not derive from CHeapObj<mtNone>

Stefan Karlsson stefank at openjdk.org
Mon Oct 10 08:55:13 UTC 2022


On Mon, 10 Oct 2022 05:03:02 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Please review this change to the `Arena` class.  Rather than deriving from
>> `CHeapObj<mtNone>` (which has the effect of preventing C-heap allocation for an
>> arena by asserting if such is attempted), instead have no allocation base
>> class so that `new Arena(...)` will fail to compile.
>> 
>> Testing: mach5 tier1
>
> src/hotspot/share/memory/arena.hpp line 89:
> 
>> 87: //------------------------------Arena------------------------------------------
>> 88: // Fast allocation of memory
>> 89: class Arena {
> 
> The allocation base class tells the reader that `Arena` has special allocation constraints, by removing this it is not apparent there are any such constraints. Can we at least add a comment?
> 
> I confess I've forgotten how not having an allocation base class prevents use of `new Foo()` ??

We have a link-time check in debug builds that fails the build if someone tries to use the global new operators.

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

PR: https://git.openjdk.org/jdk/pull/10621


More information about the hotspot-runtime-dev mailing list