Path: blob/master/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.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_BFSCLOSURE_HPP25#define SHARE_JFR_LEAKPROFILER_CHAINS_BFSCLOSURE_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 breadth-first36class BFSClosure : public BasicOopIterateClosure {37private:38EdgeQueue* _edge_queue;39EdgeStore* _edge_store;40BitSet* _mark_bits;41const Edge* _current_parent;42mutable size_t _current_frontier_level;43mutable size_t _next_frontier_idx;44mutable size_t _prev_frontier_idx;45size_t _dfs_fallback_idx;46bool _use_dfs;4748void log_completed_frontier() const;49void log_dfs_fallback() const;5051bool is_complete() const;52void step_frontier() const;5354void closure_impl(UnifiedOopRef reference, const oop pointee);55void add_chain(UnifiedOopRef reference, const oop pointee);56void dfs_fallback();5758void iterate(const Edge* parent);59void process(UnifiedOopRef reference, const oop pointee);6061void process_root_set();62void process_queue();6364public:65virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS_EXCEPT_REFERENT; }6667BFSClosure(EdgeQueue* edge_queue, EdgeStore* edge_store, BitSet* mark_bits);68void process();69void do_root(UnifiedOopRef ref);7071virtual void do_oop(oop* ref);72virtual void do_oop(narrowOop* ref);73};7475#endif // SHARE_JFR_LEAKPROFILER_CHAINS_BFSCLOSURE_HPP767778