RFR: 8354668: Missing REX2 prefix accounting in ZGC barriers leads to incorrect encoding

Jatin Bhateja jbhateja at openjdk.org
Wed Apr 16 07:52:09 UTC 2025


On Wed, 16 Apr 2025 01:58:53 GMT, Dean Long <dlong at openjdk.org> wrote:

> This looks OK, but we could do better. Instead of making the relocation point to the end of the instruction and then looking up the offset with patch_barrier_relocation_offset(), why not make the offset always 0 and have the relocation point to the data offset inside the instruction?

Hi @dean-long , 
As of now, barrier relocations are placed either before[1] or after[2] the instructions, offset is then added to compute the effective address of the patch site.  I think you are suggesting to extend the barrier structure itself to cache the patch site address. For this bug fix PR I intend to make the patch offset agnostic to REX/REX2 prefix without disturbing the existing implimentation.

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp#L394
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp#L397

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

PR Comment: https://git.openjdk.org/jdk/pull/24664#issuecomment-2808697302


More information about the hotspot-gc-dev mailing list