Path: blob/master/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp
41153 views
/*1* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_JFR_LEAKPROFILER_CHAINS_DFSCLOSURE_HPP25#define SHARE_JFR_LEAKPROFILER_CHAINS_DFSCLOSURE_HPP2627#include "jfr/leakprofiler/utilities/unifiedOopRef.hpp"28#include "memory/iterator.hpp"2930class BitSet;31class Edge;32class EdgeStore;33class EdgeQueue;3435// Class responsible for iterating the heap depth-first36class DFSClosure : public BasicOopIterateClosure {37private:38// max dfs depth should not exceed size of stack39static const size_t max_dfs_depth = 4000;40static UnifiedOopRef _reference_stack[max_dfs_depth];4142EdgeStore* _edge_store;43BitSet* _mark_bits;44const Edge*_start_edge;45size_t _max_depth;46size_t _depth;47bool _ignore_root_set;4849DFSClosure(EdgeStore* edge_store, BitSet* mark_bits, const Edge* start_edge);5051void add_chain();52void closure_impl(UnifiedOopRef reference, const oop pointee);5354public:55virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS_EXCEPT_REFERENT; }5657static void find_leaks_from_edge(EdgeStore* edge_store, BitSet* mark_bits, const Edge* start_edge);58static void find_leaks_from_root_set(EdgeStore* edge_store, BitSet* mark_bits);59void do_root(UnifiedOopRef ref);6061virtual void do_oop(oop* ref);62virtual void do_oop(narrowOop* ref);63};6465#endif // SHARE_JFR_LEAKPROFILER_CHAINS_DFSCLOSURE_HPP666768