< prev index next >

src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp

Print this page




 104   assert(reference != NULL, "invariant");
 105 
 106   if (GranularTimer::is_finished()) {
 107      return;
 108   }
 109   if (_depth == 0 && _ignore_root_set) {
 110     // Root set is already marked, but we want
 111     // to continue, so skip is_marked check.
 112     assert(_mark_bits->is_marked(pointee), "invariant");
 113   } else {
 114     if (_mark_bits->is_marked(pointee)) {
 115       return;
 116     }
 117   }
 118 
 119   _reference = reference;
 120   _mark_bits->mark_obj(pointee);
 121   assert(_mark_bits->is_marked(pointee), "invariant");
 122 
 123   // is the pointee a sample object?
 124   if (0 == pointee->mark().value()) {
 125     add_chain();
 126   }
 127 
 128   assert(_max_depth >= 1, "invariant");
 129   if (_depth < _max_depth - 1) {
 130     DFSClosure next_level(this, _depth + 1);
 131     pointee->oop_iterate(&next_level);
 132   }
 133 }
 134 
 135 void DFSClosure::add_chain() {
 136   const size_t array_length = _depth + 2;
 137 
 138   ResourceMark rm;
 139   Edge* const chain = NEW_RESOURCE_ARRAY(Edge, array_length);
 140   size_t idx = 0;
 141 
 142   // aggregate from depth-first search
 143   const DFSClosure* c = this;
 144   while (c != NULL) {




 104   assert(reference != NULL, "invariant");
 105 
 106   if (GranularTimer::is_finished()) {
 107      return;
 108   }
 109   if (_depth == 0 && _ignore_root_set) {
 110     // Root set is already marked, but we want
 111     // to continue, so skip is_marked check.
 112     assert(_mark_bits->is_marked(pointee), "invariant");
 113   } else {
 114     if (_mark_bits->is_marked(pointee)) {
 115       return;
 116     }
 117   }
 118 
 119   _reference = reference;
 120   _mark_bits->mark_obj(pointee);
 121   assert(_mark_bits->is_marked(pointee), "invariant");
 122 
 123   // is the pointee a sample object?
 124   if (NULL == pointee->mark().to_pointer()) {
 125     add_chain();
 126   }
 127 
 128   assert(_max_depth >= 1, "invariant");
 129   if (_depth < _max_depth - 1) {
 130     DFSClosure next_level(this, _depth + 1);
 131     pointee->oop_iterate(&next_level);
 132   }
 133 }
 134 
 135 void DFSClosure::add_chain() {
 136   const size_t array_length = _depth + 2;
 137 
 138   ResourceMark rm;
 139   Edge* const chain = NEW_RESOURCE_ARRAY(Edge, array_length);
 140   size_t idx = 0;
 141 
 142   // aggregate from depth-first search
 143   const DFSClosure* c = this;
 144   while (c != NULL) {


< prev index next >