RFR: 8342014: RISC-V: ZStoreBarrierStubC2 clobbers rflags

Fei Yang fyang at openjdk.org
Mon Oct 14 03:02:41 UTC 2024


`ZStoreBarrierStubC2` (`ZBarriersetAssembler::generate_c2_store_barrier_stub`) clobbers rflags (the `t1` register) on riscv [1].
And `ZStoreBarrierStubC2` is used by `z_store_barrier` in file gc/z/z_riscv.ad. But the calling instructs in the same ad file
didn't list the rflags as being killed. As the call chain is not simple, this kind of problem could go silently unnoticed.
I would suggest we add clobbering of rflags for all gc-related C2 instructs. No obvious impact witnessed on performance.
This would help reduce the risk of another PR: https://github.com/openjdk/jdk/pull/21406 which touches g1/x/z prefering `t1` for performance reasons. Tagging @robehn 

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp#L746

Testing on linux-riscv64:
- [ ] hs-tier1 - hs-tier3

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

Commit messages:
 - 8342014: RISC-V: ZStoreBarrierStubC2 clobbers rflags

Changes: https://git.openjdk.org/jdk/pull/21485/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21485&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8342014
  Stats: 64 lines in 3 files changed: 0 ins; 0 del; 64 mod
  Patch: https://git.openjdk.org/jdk/pull/21485.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21485/head:pull/21485

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


More information about the hotspot-dev mailing list