< prev index next >

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

Print this page
*** 21,14 ***
   * questions.
   *
   */
  
  #include "precompiled.hpp"
- #include "jfr/leakprofiler/chains/bitset.inline.hpp"
  #include "jfr/leakprofiler/chains/dfsClosure.hpp"
  #include "jfr/leakprofiler/chains/edge.hpp"
  #include "jfr/leakprofiler/chains/edgeStore.hpp"
  #include "jfr/leakprofiler/chains/rootSetClosure.hpp"
  #include "jfr/leakprofiler/utilities/granularTimer.hpp"
  #include "jfr/leakprofiler/utilities/rootType.hpp"
  #include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp"
  #include "memory/iterator.inline.hpp"
--- 21,14 ---
   * questions.
   *
   */
  
  #include "precompiled.hpp"
  #include "jfr/leakprofiler/chains/dfsClosure.hpp"
  #include "jfr/leakprofiler/chains/edge.hpp"
  #include "jfr/leakprofiler/chains/edgeStore.hpp"
+ #include "jfr/leakprofiler/chains/jfrbitset.hpp"
  #include "jfr/leakprofiler/chains/rootSetClosure.hpp"
  #include "jfr/leakprofiler/utilities/granularTimer.hpp"
  #include "jfr/leakprofiler/utilities/rootType.hpp"
  #include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp"
  #include "memory/iterator.inline.hpp"

*** 38,11 ***
  #include "utilities/align.hpp"
  
  UnifiedOopRef DFSClosure::_reference_stack[max_dfs_depth];
  
  void DFSClosure::find_leaks_from_edge(EdgeStore* edge_store,
!                                       BitSet* mark_bits,
                                        const Edge* start_edge) {
    assert(edge_store != NULL, "invariant");
    assert(mark_bits != NULL," invariant");
    assert(start_edge != NULL, "invariant");
  
--- 38,11 ---
  #include "utilities/align.hpp"
  
  UnifiedOopRef DFSClosure::_reference_stack[max_dfs_depth];
  
  void DFSClosure::find_leaks_from_edge(EdgeStore* edge_store,
!                                       JFRBitSet* mark_bits,
                                        const Edge* start_edge) {
    assert(edge_store != NULL, "invariant");
    assert(mark_bits != NULL," invariant");
    assert(start_edge != NULL, "invariant");
  

*** 50,11 ***
    DFSClosure dfs(edge_store, mark_bits, start_edge);
    start_edge->pointee()->oop_iterate(&dfs);
  }
  
  void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store,
!                                           BitSet* mark_bits) {
    assert(edge_store != NULL, "invariant");
    assert(mark_bits != NULL, "invariant");
  
    // Mark root set, to avoid going sideways
    DFSClosure dfs(edge_store, mark_bits, NULL);
--- 50,11 ---
    DFSClosure dfs(edge_store, mark_bits, start_edge);
    start_edge->pointee()->oop_iterate(&dfs);
  }
  
  void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store,
!                                           JFRBitSet* mark_bits) {
    assert(edge_store != NULL, "invariant");
    assert(mark_bits != NULL, "invariant");
  
    // Mark root set, to avoid going sideways
    DFSClosure dfs(edge_store, mark_bits, NULL);

*** 66,11 ***
    dfs._max_depth = max_dfs_depth;
    dfs._ignore_root_set = true;
    rs.process();
  }
  
! DFSClosure::DFSClosure(EdgeStore* edge_store, BitSet* mark_bits, const Edge* start_edge)
    :_edge_store(edge_store), _mark_bits(mark_bits), _start_edge(start_edge),
    _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false) {
  }
  
  void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) {
--- 66,11 ---
    dfs._max_depth = max_dfs_depth;
    dfs._ignore_root_set = true;
    rs.process();
  }
  
! DFSClosure::DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge)
    :_edge_store(edge_store), _mark_bits(mark_bits), _start_edge(start_edge),
    _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false) {
  }
  
  void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) {

*** 78,28 ***
    assert(!reference.is_null(), "invariant");
  
    if (GranularTimer::is_finished()) {
      return;
    }
    if (_depth == 0 && _ignore_root_set) {
      // Root set is already marked, but we want
      // to continue, so skip is_marked check.
      assert(_mark_bits->is_marked(pointee), "invariant");
!   }  else {
      if (_mark_bits->is_marked(pointee)) {
        return;
      }
    }
-   _reference_stack[_depth] = reference;
-   _mark_bits->mark_obj(pointee);
-   assert(_mark_bits->is_marked(pointee), "invariant");
- 
-   // is the pointee a sample object?
-   if (pointee->mark().is_marked()) {
-     add_chain();
-   }
- 
    assert(_max_depth >= 1, "invariant");
    if (_depth < _max_depth - 1) {
      _depth++;
      pointee->oop_iterate(this);
      assert(_depth > 0, "invariant");
--- 78,27 ---
    assert(!reference.is_null(), "invariant");
  
    if (GranularTimer::is_finished()) {
      return;
    }
+ 
    if (_depth == 0 && _ignore_root_set) {
      // Root set is already marked, but we want
      // to continue, so skip is_marked check.
      assert(_mark_bits->is_marked(pointee), "invariant");
!     _reference_stack[_depth] = reference;
+   } else {
      if (_mark_bits->is_marked(pointee)) {
        return;
      }
+     _mark_bits->mark_obj(pointee);
+     _reference_stack[_depth] = reference;
+     // is the pointee a sample object?
+     if (pointee->mark().is_marked()) {
+       add_chain();
+     }
    }
    assert(_max_depth >= 1, "invariant");
    if (_depth < _max_depth - 1) {
      _depth++;
      pointee->oop_iterate(this);
      assert(_depth > 0, "invariant");
< prev index next >