< prev index next >

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

Print this page

53  public:
54   ObjectSampleMarker() :
55        _store(new GrowableArray<ObjectSampleMarkWord>(16)) {}
56   ~ObjectSampleMarker() {
57     assert(_store != nullptr, "invariant");
58     // restore the saved, original, markWord for sample objects
59     while (_store->is_nonempty()) {
60       ObjectSampleMarkWord sample_oop = _store->pop();
61       sample_oop._obj->set_mark(sample_oop._mark_word);
62       assert(sample_oop._obj->mark() == sample_oop._mark_word, "invariant");
63     }
64   }
65 
66   void mark(oop obj) {
67     assert(obj != nullptr, "invariant");
68     // save the original markWord
69     _store->push(ObjectSampleMarkWord(obj, obj->mark()));
70     // now we will set the mark word to "marked" in order to quickly
71     // identify sample objects during the reachability search from gc roots.
72     assert(!obj->mark().is_marked(), "should only mark an object once");
73     obj->set_mark(markWord::prototype().set_marked());
74     assert(obj->mark().is_marked(), "invariant");
75   }
76 };
77 
78 #endif // SHARE_JFR_LEAKPROFILER_CHAINS_OBJECTSAMPLEMARKER_HPP

53  public:
54   ObjectSampleMarker() :
55        _store(new GrowableArray<ObjectSampleMarkWord>(16)) {}
56   ~ObjectSampleMarker() {
57     assert(_store != nullptr, "invariant");
58     // restore the saved, original, markWord for sample objects
59     while (_store->is_nonempty()) {
60       ObjectSampleMarkWord sample_oop = _store->pop();
61       sample_oop._obj->set_mark(sample_oop._mark_word);
62       assert(sample_oop._obj->mark() == sample_oop._mark_word, "invariant");
63     }
64   }
65 
66   void mark(oop obj) {
67     assert(obj != nullptr, "invariant");
68     // save the original markWord
69     _store->push(ObjectSampleMarkWord(obj, obj->mark()));
70     // now we will set the mark word to "marked" in order to quickly
71     // identify sample objects during the reachability search from gc roots.
72     assert(!obj->mark().is_marked(), "should only mark an object once");
73     obj->set_mark(obj->prototype_mark().set_marked());
74     assert(obj->mark().is_marked(), "invariant");
75   }
76 };
77 
78 #endif // SHARE_JFR_LEAKPROFILER_CHAINS_OBJECTSAMPLEMARKER_HPP
< prev index next >