RFR: 8297766: Remove UseMallocOnly development option
Thomas Stuefe
stuefe at openjdk.org
Fri Dec 2 14:35:11 UTC 2022
On Fri, 2 Dec 2022 13:19:14 GMT, Afshin Zafari <duke at openjdk.org> wrote:
> > Good riddance :-)
> > I think `HandleArea` can be simplified too. It does a lot of gymnastics to work around the UseMallocOnly mode.
> > I believe you can scratch `HandleArea::real_allocate_handle()` and redirect `HandleArea::allocate_handle()` to directly call `Arena::Amalloc`. Have not tested though.
>
> The current Call hierarchy is:
>
> ```
> HandleArea::allocate_handle()
> HandleArea::real_allocate_handle()
> Arena::internal_amalloc()
> ```
>
> and your suggestion is:
>
> ```
> HandleArea::allocate_handle()
> Arena::Amalloc()
> Arena::internal_malloc()
> ```
>
> Question: `Arena::Amalloc` has some more lines of code before calling `internal_malloc()`. So what to be done for these extra lines of codes? Can I simply replace `internal_malloc` with `Arena::Amalloc`?
Looking at this closer, I would call either `internal_malloc` or `AmallocWords` in `allocate_handle`. Both come to almost the same now, with UseMallocOnly gone.
`Amalloc` would give you automatic alignment to word location. Which would be harmless in this case, oop is word sized too, but I rather assert the correct alignment here than to align.
(Backstory: HandleArea contains, basically, an array of oop. oop are word sized. For HandleArea to work correctly, the oop in it must sit "tight", no interleaving of alignment paddings or whatnot. Therefore one should not align, even out of accident.)
HTH, Thomas
-------------
PR: https://git.openjdk.org/jdk/pull/11456
More information about the hotspot-dev
mailing list