Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8341525

G1: use bit clearing to remove tightly-coupled initialization store pre-barriers

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 24
    • hotspot
    • b19

      Currently, when ReduceInitialCardMarks is disabled, the pre-barrier of tightly-coupled initialization stores is cleared using bit toggling:

      Node* G1BarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
        (...)
        access.set_barrier_data(get_store_barrier(access));
        if (tightly_coupled_alloc) {
          assert(!use_ReduceInitialCardMarks(), ...);
          access.set_barrier_data(access.barrier_data() ^ G1C2BarrierPre);
        }
        (...)
      }

      This assumes that G1C2BarrierPre is always set at this point, which is guaranteed because an `access` corresponding to a tightly-coupled initialization store is always of type `C2OptAccess`, hence `!access.is_parse_access()` and `get_store_barrier(access)` trivially returns `G1C2BarrierPre | G1C2BarrierPost`. However, the intent of the code would be clearer if bit clearing (access.set_barrier_data(access.barrier_data() & ~G1C2BarrierPre)) was used instead.

      This issue was originally reported by [~shade] and discussed here: https://github.com/openjdk/jdk/pull/19746#discussion_r1786573527.

            rcastanedalo Roberto Castaneda Lozano
            rcastanedalo Roberto Castaneda Lozano
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: