RFR: 8270179: Rename Amalloc_4
Thomas Stuefe
stuefe at openjdk.java.net
Mon Jul 12 08:26:53 UTC 2021
On Mon, 12 Jul 2021 08:15:01 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> > Consider this sequence, on 32bit:
> > ```
> > 1. AmallocWords(4) -> _hwm = 4
> >
> > 2. Amalloc(8) -> will return a pointer to offset 4, so not 64bit aligned.
> > ```
>
> I thought that's what ARENA_ALIGN at the beginning of Amalloc was for. But you are right, there's nothing to align `_hwm`. This looks like a pre-existing bug, and I wonder how this ever worked on 32bit platforms.
My guess would be that the only widely relevant 32bit architecture was x86, and they allow unaligned access. I wonder how 32bit arm handles this. Maybe allocating 32bit words of memory is just very rare.
I honestly always thought Amalloc4 was for allocating 32bits, if you knew 32bit alignment was enough. E.g. for storing ints. But seems I was wrong all along.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4750
More information about the hotspot-dev
mailing list