ZGC: Incorrect use of RootAccess in ZHeapIterator

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 11
    • Affects Version/s: 11
    • Component/s: hotspot
    • gc
    • b19

        In ZHeapIteratorRootOopClosure::do_oop() we're using RootAccess<>::oop_load() to load oops. However, as the comment right above that line suggests, that's incorrect and we should have a load barrier here. In fact, we used to have a load barrier here, but this was for some mysterious reason changed. We should revert back to the code that used to be there.

        diff --git a/src/hotspot/share/gc/z/zHeapIterator.cpp b/src/hotspot/share/gc/z/zHeapIterator.cpp
        --- a/src/hotspot/share/gc/z/zHeapIterator.cpp
        +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp
        @@ -63,7 +63,7 @@
           virtual void do_oop(oop* p) {
             // Load barrier needed here for the same reason we
             // need fixup_partial_loads() in ZHeap::mark_end()
        - const oop obj = RootAccess<>::oop_load(p);
        + const oop obj = ZBarrier::load_barrier_on_oop_field(p);
             _iter->push(obj);
             _iter->drain(_cl);
           }

              Assignee:
              Per Liden (Inactive)
              Reporter:
              Per Liden (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: