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

David Holmes dholmes at openjdk.org
Mon Oct 10 05:06:51 UTC 2022


On Sun, 9 Oct 2022 00:21:18 GMT, Kim Barrett <kbarrett 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()` ??

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

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


More information about the hotspot-runtime-dev mailing list