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

ZGC: Incorrect use of RootAccess in ZHeapIterator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b19

      Backports

        Description

        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);
           }

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: