RFR: 8307058: Implementation of Generational ZGC [v8]

Erik Österlund eosterlund at openjdk.org
Mon May 8 09:04:39 UTC 2023


On Sat, 6 May 2023 08:14:24 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp line 310:
>> 
>>> 308:     // A not relocatable object could have spurious raw null pointers in its fields after
>>> 309:     // getting promoted to the old generation.
>>> 310:     __ cmpw(ref_addr, barrier_Relocation::unpatched);
>> 
>> `cmpw` with immediates stalls the predecoder, it may be better to `movzwl` to a spare register and `cmpl` there.
>
> I think we use the flag `UseStoreImmI16` for these kinds of situations.

We did indeed run into the predecoder issue when we used testw for normal store barriers, so I changed to testl. However, this cmpw is only taken when we use atomics. I felt less motivated to optimize every bit in this path as the ratio of atomic accesses compared to normal stores/loads is typically really small, when I have profiled it. That's why I haven't optimized this path further. However, we can fix it too. It will however require some changes to the assembler, as it currently tries to be too smart about encoding cmpl with register + immediate operands with varying sizes. I'd like to postpone that until after we integrate, as it seems mostly like a micro optimization.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13771#discussion_r1187207769


More information about the hotspot-dev mailing list