< prev index next >

src/hotspot/share/jfr/leakprofiler/chains/objectSampleMarker.hpp

Print this page
*** 64,15 ***
    }
  
    void mark(oop obj) {
      assert(obj != NULL, "invariant");
      // save the original markWord
!     _store->push(ObjectSampleMarkWord(obj, obj->mark()));
      // now we will set the mark word to "marked" in order to quickly
      // identify sample objects during the reachability search from gc roots.
      assert(!obj->mark().is_marked(), "should only mark an object once");
!     obj->set_mark(markWord::prototype().set_marked());
      assert(obj->mark().is_marked(), "invariant");
    }
  };
  
  #endif // SHARE_JFR_LEAKPROFILER_CHAINS_OBJECTSAMPLEMARKER_HPP
--- 64,26 ---
    }
  
    void mark(oop obj) {
      assert(obj != NULL, "invariant");
      // save the original markWord
!     markWord mark = obj->mark();
+     _store->push(ObjectSampleMarkWord(obj, mark));
      // now we will set the mark word to "marked" in order to quickly
      // identify sample objects during the reachability search from gc roots.
      assert(!obj->mark().is_marked(), "should only mark an object once");
! #ifdef _LP64
+     if (UseCompactObjectHeaders) {
+       if (mark.has_displaced_mark_helper()) {
+         mark = mark.displaced_mark_helper();
+       }
+       obj->set_mark(markWord::prototype().set_marked().set_narrow_klass(mark.narrow_klass()));
+     } else
+ #endif
+     {
+       obj->set_mark(markWord::prototype().set_marked());
+     }
      assert(obj->mark().is_marked(), "invariant");
    }
  };
  
  #endif // SHARE_JFR_LEAKPROFILER_CHAINS_OBJECTSAMPLEMARKER_HPP
< prev index next >