< prev index next >
src/share/vm/jfr/leakprofiler/chains/bfsClosure.cpp
Print this page
rev 9055 : 8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
Reviewed-by: egahlin, rwestberg
rev 9057 : 8229437: assert(is_aligned(ref, HeapWordSize)) failed: invariant
Reviewed-by: egahlin
*** 1,7 ****
/*
! * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 95,105 ****
(nof_dfs_completed_edges * edge_size) / K
);
}
void BFSClosure::process() {
-
process_root_set();
process_queue();
}
void BFSClosure::process_root_set() {
--- 95,104 ----
*** 134,144 ****
add_chain(reference, pointee);
}
// if we are processinig initial root set, don't add to queue
if (_current_parent != NULL) {
- assert(_current_parent->distance_to_root() == _current_frontier_level, "invariant");
_edge_queue->add(_current_parent, reference);
}
if (_edge_queue->is_full()) {
dfs_fallback();
--- 133,142 ----
*** 147,170 ****
}
void BFSClosure::add_chain(const oop* reference, const oop pointee) {
assert(pointee != NULL, "invariant");
assert(NULL == pointee->mark(), "invariant");
!
! const size_t length = _current_parent == NULL ? 1 : _current_parent->distance_to_root() + 2;
! ResourceMark rm;
! Edge* const chain = NEW_RESOURCE_ARRAY(Edge, length);
! size_t idx = 0;
! chain[idx++] = Edge(NULL, reference);
! // aggregate from breadth-first search
! const Edge* current = _current_parent;
! while (current != NULL) {
! chain[idx++] = Edge(NULL, current->reference());
! current = current->parent();
! }
! assert(length == idx, "invariant");
! _edge_store->add_chain(chain, length);
}
void BFSClosure::dfs_fallback() {
assert(_edge_queue->is_full(), "invariant");
_use_dfs = true;
--- 145,156 ----
}
void BFSClosure::add_chain(const oop* reference, const oop pointee) {
assert(pointee != NULL, "invariant");
assert(NULL == pointee->mark(), "invariant");
! Edge leak_edge(_current_parent, reference);
! _edge_store->put_chain(&leak_edge, _current_parent == NULL ? 1 : _current_frontier_level + 2);
}
void BFSClosure::dfs_fallback() {
assert(_edge_queue->is_full(), "invariant");
_use_dfs = true;
*** 237,241 ****
--- 223,234 ----
const oop pointee = oopDesc::load_decode_heap_oop(ref);
if (pointee != NULL) {
closure_impl(UnifiedOop::encode(ref), pointee);
}
}
+
+ void BFSClosure::do_root(const oop* ref) {
+ assert(ref != NULL, "invariant");
+ if (!_edge_queue->is_full()) {
+ _edge_queue->add(NULL, ref);
+ }
+ }
< prev index next >