diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 402165ff8e7..9b84ee838ad 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -86,10 +86,10 @@ void DFSClosure::find_leaks_from_edge(EdgeStore* edge_store, // Depth-first search, starting from a BFS edge DFSClosure dfs(edge_store, mark_bits, start_edge); - dfs.log("DFS: scanning from edge"); + log_debug(jfr, system, dfs)("DFS: scanning from edge"); start_edge->pointee()->oop_iterate(&dfs); dfs.drain_probe_stack(); - dfs.log("DFS: done"); + log_debug(jfr, system, dfs)("DFS: done"); } void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store, @@ -103,17 +103,17 @@ void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store, DFSClosure dfs(edge_store, mark_bits, nullptr); dfs._max_depth = 1; RootSetClosure rs(&dfs); - dfs.log("DFS: scanning roots..."); + log_debug(jfr, system, dfs)("DFS: scanning roots..."); rs.process(); dfs.drain_probe_stack(); // Depth-first search dfs._max_depth = max_dfs_depth; dfs._ignore_root_set = true; - dfs.log("DFS: scanning in depth ..."); + log_debug(jfr, system, dfs)("DFS: scanning in depth ..."); rs.process(); dfs.drain_probe_stack(); - dfs.log("DFS: done"); + log_debug(jfr, system, dfs)("DFS: done"); } @@ -161,7 +161,7 @@ DFSClosure::~DFSClosure() { if (!GranularTimer::is_finished()) { assert(_probe_stack.is_empty(), "We should have drained the probe stack?"); } - log("DFS: " UINT64_FORMAT " objects processed, " UINT64_FORMAT " sample objects found", + log_info(jfr, system, dfs)("DFS: " UINT64_FORMAT " objects processed, " UINT64_FORMAT " sample objects found", _num_objects_processed, _num_sampled_objects_found); } @@ -179,7 +179,7 @@ void DFSClosure::probe_stack_push(UnifiedOopRef ref, oop pointee, size_t depth) } if (_probe_stack.is_full()) { - log("Probe stack full (graph depth: %zu, probe stack size: %zu), aborting graph edge", + log_debug(jfr, system, dfs)("Probe stack full (graph depth: %zu, probe stack size: %zu)", _current_depth, _probe_stack.size()); return; } @@ -195,7 +195,7 @@ void DFSClosure::probe_stack_push_followup_chunk(UnifiedOopRef ref, oop pointee, assert(chunkindex > 0, "invariant"); if (_probe_stack.is_full()) { - log("Probe stack full (graph depth: %zu, probe stack size: %zu), aborting graph edge", + log_debug(jfr, system, dfs)("Probe stack full (graph depth: %zu, probe stack size: %zu)", _current_depth, _probe_stack.size()); return; } @@ -248,7 +248,7 @@ void DFSClosure::handle_oop() { // trace children if needed if (_current_depth == _max_depth - 1) { - log("max graph depth reached (graph depth: %zu, probe stack size: %zu), aborting graph edge", + log_debug(jfr, system, dfs)("max depth reached (%zu, probe stack size: %zu)", _current_depth, _probe_stack.size()); return; // stop following this chain } @@ -283,7 +283,7 @@ void DFSClosure::handle_objarrayoop() { // trace children if needed if (_current_depth == _max_depth - 1) { - log("max graph depth reached (graph depth: %zu, probe stack size: %zu), aborting graph edge", + log_debug(jfr, system, dfs)("max depth reached (%zu, probe stack size: %zu)", _current_depth, _probe_stack.size()); return; // stop following this chain } @@ -337,7 +337,7 @@ void DFSClosure::add_chain() { _num_sampled_objects_found++; #ifdef ASSERT - log("Sample object found (" UINT64_FORMAT " so far)", _num_sampled_objects_found); + log_trace(jfr, system, dfs)("Sample object found (" UINT64_FORMAT " so far)", _num_sampled_objects_found); log_reference_stack(); #endif diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp index 05357fd3362..b0b998f3ff9 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp @@ -39,7 +39,6 @@ class EdgeQueue; // Class responsible for iterating the heap depth-first class DFSClosure : public BasicOopIterateClosure { private: - // max dfs depth should not exceed size of stack static const size_t max_dfs_depth = 3200; static UnifiedOopRef _reference_stack[max_dfs_depth]; diff --git a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp index e3bd9c66975..28643acf3ad 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp @@ -47,7 +47,7 @@ PathToGcRootsOperation::PathToGcRootsOperation(ObjectSampler* sampler, EdgeStore* edge_store, int64_t cutoff, bool emit_all, bool skip_bfs) : _sampler(sampler),_edge_store(edge_store), _cutoff_ticks(cutoff), _emit_all(emit_all), - _skip_bfs(UseNewCode/*skip_bfs*/) {} + _skip_bfs(skip_bfs) {} /* The EdgeQueue is backed by directly managed virtual memory. * We will attempt to dimension an initial reservation diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRootsBFSDFS.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRootsBFSDFS.java index 6815d354309..a275e4e4d4b 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRootsBFSDFS.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRootsBFSDFS.java @@ -80,9 +80,8 @@ public class TestJcmdDumpPathToGCRootsBFSDFS { // DFS-only mode should work well, and so should BFS-only mode. // The minimum size of the edge queue in BFS (keep in sync with hotspot) + // see edge_queue_memory_reservation() in pathToGCRootsOperation.cpp private final static int minimumEdgeQueueSizeCap = 32 * 1024 * 1024; - // The size of the Edge structure (keep in sync with hotspot) - private final static int edgeSizeBytes = 16; public static List leak; diff --git a/test/jdk/jdk/jfr/jvm/TestWaste.java b/test/jdk/jdk/jfr/jvm/TestWaste.java index 4de14fc2461..ad97c2e604f 100644 --- a/test/jdk/jdk/jfr/jvm/TestWaste.java +++ b/test/jdk/jdk/jfr/jvm/TestWaste.java @@ -47,7 +47,7 @@ import jdk.jfr.Configuration; * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test - * @run main/othervm -Xlog:jfr+system+parser=debug -XX:TLABSize=2k jdk.jfr.jvm.TestWaste + * @run main/othervm -Xmx256m -Xlog:jfr+system+parser=debug -XX:TLABSize=2k jdk.jfr.jvm.TestWaste */ public class TestWaste { static List list = new LinkedList<>(); @@ -55,6 +55,7 @@ public class TestWaste { public static void main(String... args) throws Exception { WhiteBox.setWriteAllObjectSamples(true); + WhiteBox.setSkipBFS(true); Configuration c = Configuration.getConfiguration("profile"); Path file = Path.of("recording.jfr"); Path scrubbed = Path.of("scrubbed.jfr");