RFR: 8334060: Implementation of Late Barrier Expansion for G1

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Jun 19 08:37:11 UTC 2024


On Tue, 18 Jun 2024 18:37:41 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp line 479:
>> 
>>> 477: 
>>> 478:   if (g1_can_remove_pre_barrier(kit, &kit->gvn(), adr, access.type(), adr_idx)) {
>>> 479:     barriers ^= G1C2BarrierPre;
>> 
>> Is it possible to rewrite this method to remove `^=`? This method first construct both pre/post barriers and remove if needed. I wonder if the logic will be cleaner if we track if pre/post barrier can be removed using two `bool` and construct the actual barrier in the end using two `bool` -- this way, we can avoid mutating the `barriers` var.
>
> Thanks for the suggestion, I will try it out.

Is [this](https://github.com/robcasloz/jdk/compare/JDK-8334060-g1-late-barrier-expansion...robcasloz:jdk:JDK-8334060-g1-late-barrier-expansion-alberts-barriers-suggestion) what you had in mind? I don't have a strong opinion, but if you think the change improves readability I am happy to merge it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19746#discussion_r1645691876


More information about the hotspot-compiler-dev mailing list