RFR: 8331418: ZGC: generalize barrier liveness logic [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Fri May 3 06:42:57 UTC 2024


On Thu, 2 May 2024 07:57:18 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> This changeset generalizes the logic to analyze, declare, and communicate which registers are live at a C2 barrier stub so that it can be used by other collectors than ZGC adopting the late barrier expansion model (including G1 in the near future, see [JEP 475](https://openjdk.org/jeps/475)).
>> 
>> The main changes are:
>> 
>> - Make it possible to compute register liveness information before (live-in) or after (live-out) each barrier, and let the collector choose by implementing `BarrierSetC2State::needs_livein_data()`.
>> 
>> - Generalize the interface with which collectors declare which registers must be additionally preserved across barrier runtime calls, adding the methods `BarrierStubC2::preserve(Register r)` and `BarrierStubC2::dont_preserve(Register r)`.
>> 
>> - Simplify the interface with which platform-specific logic computes which registers to preserve across barrier runtime calls, replacing the calls to `BarrierStubC2::result()` and `BarrierStubC2::live()` with a single call to `BarrierStubC2::preserve_set()`.
>> 
>> #### Testing
>> 
>> - tier1-5 (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64; release and debug mode).
>> - tier1-7 (linux-x64, linux-aarch64; release and debug mode; ZGC tests only) with [an additional patch](https://github.com/openjdk/jdk/commit/4d4e743d8f4cddd5288cee1d69c70fe2b9bea066) that exercises the spilling and restoring logic by forcing ZGC read barriers to always take the slow path and clearing all general-purpose save-on-call registers upon the slow path's runtime call.
>> - Build with `make hotspot` (linux-riscv64-debug, linux-ppc64le-debug). @RealFYang, @TheRealMDoerr: could you please test and review the riscv and ppc changes? Thanks!
>
> Roberto Castañeda Lozano has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use VMReg::is_concrete for testing sub-registers

lgtm.

A few nits.

src/hotspot/share/gc/shared/c2/barrierSetC2.cpp line 98:

> 96:     _entry(),
> 97:     _continuation(),
> 98:     _preserve(live()){}

Suggestion:

    _preserve(live()) {}

src/hotspot/share/gc/shared/c2/barrierSetC2.cpp line 879:

> 877:       if (!bs_state->needs_livein_data()) {
> 878:         RegMask* const regs = bs_state->live(node);
> 879:         if (regs != NULL) {

Suggestion:

        if (regs != nullptr) {

src/hotspot/share/gc/shared/c2/barrierSetC2.cpp line 910:

> 908:       if (bs_state->needs_livein_data()) {
> 909:         RegMask* const regs = bs_state->live(node);
> 910:         if (regs != NULL) {

Suggestion:

        if (regs != nullptr) {

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

Marked as reviewed by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19026#pullrequestreview-2037480805
PR Review Comment: https://git.openjdk.org/jdk/pull/19026#discussion_r1588795914
PR Review Comment: https://git.openjdk.org/jdk/pull/19026#discussion_r1588796061
PR Review Comment: https://git.openjdk.org/jdk/pull/19026#discussion_r1588796181


More information about the hotspot-compiler-dev mailing list