--- old/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp 2020-01-14 13:46:50.789328565 -0800 +++ new/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp 2020-01-14 13:46:50.557328573 -0800 @@ -131,7 +131,7 @@ if (!_mark_bits->is_marked(pointee)) { _mark_bits->mark_obj(pointee); // is the pointee a sample object? - if (NULL == pointee->mark().to_pointer()) { + if (pointee->mark().is_marked()) { add_chain(reference, pointee); } @@ -148,7 +148,7 @@ void BFSClosure::add_chain(UnifiedOopRef reference, const oop pointee) { assert(pointee != NULL, "invariant"); - assert(NULL == pointee->mark().to_pointer(), "invariant"); + assert(pointee->mark().is_marked(), "invariant"); Edge leak_edge(_current_parent, reference); _edge_store->put_chain(&leak_edge, _current_parent == NULL ? 1 : _current_frontier_level + 2); } --- old/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp 2020-01-14 13:46:51.489328541 -0800 +++ new/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp 2020-01-14 13:46:51.257328549 -0800 @@ -121,7 +121,7 @@ assert(_mark_bits->is_marked(pointee), "invariant"); // is the pointee a sample object? - if (NULL == pointee->mark().to_pointer()) { + if (pointee->mark().is_marked()) { add_chain(); } --- old/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp 2020-01-14 13:46:52.173328517 -0800 +++ new/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp 2020-01-14 13:46:51.941328525 -0800 @@ -231,7 +231,7 @@ StoredEdge* const leak_context_edge = put(edge->reference()); oop sample_object = edge->pointee(); assert(sample_object != NULL, "invariant"); - assert(NULL == sample_object->mark().to_pointer(), "invariant"); + assert(sample_object->mark().is_marked(), "invariant"); sample_object->set_mark(markWord::from_pointer(leak_context_edge)); return leak_context_edge; } --- old/src/hotspot/share/jfr/leakprofiler/chains/objectSampleMarker.hpp 2020-01-14 13:46:52.933328491 -0800 +++ new/src/hotspot/share/jfr/leakprofiler/chains/objectSampleMarker.hpp 2020-01-14 13:46:52.637328501 -0800 @@ -68,13 +68,12 @@ // save the original markWord _store->push(ObjectSampleMarkWord(obj, obj->mark())); // now we will "poison" the mark word of the sample object - // to the intermediate monitor INFLATING state. - // This is an "impossible" state during a safepoint, - // hence we will use it to quickly identify sample objects + // to marked. + // This will be used to quickly identify sample objects // during the reachability search from gc roots. - assert(NULL == markWord::INFLATING().to_pointer(), "invariant"); - obj->set_mark(markWord::INFLATING()); - assert(NULL == obj->mark().to_pointer(), "invariant"); + assert(!obj->mark().is_marked(), "should only mark an object once"); + obj->set_mark(markWord::prototype().set_marked()); + assert(obj->mark().is_marked(), "invariant"); } }; --- old/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp 2020-01-14 13:46:53.721328463 -0800 +++ new/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp 2020-01-14 13:46:53.437328473 -0800 @@ -116,7 +116,9 @@ traceid gc_root_id = 0; const Edge* edge = NULL; if (SafepointSynchronize::is_at_safepoint()) { - edge = (const Edge*)(sample->object())->mark().to_pointer(); + if (!sample->object()->mark().is_marked()) { + edge = (const Edge*)(sample->object())->mark().to_pointer(); + } } if (edge == NULL) { // In order to dump out a representation of the event