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

ZGC: Incorrect use of RootAccess in ZHeapIterator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 11
    • 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);
           }

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

                Created:
                Updated:
                Resolved: