Path: blob/master/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp
40961 views
/*1* Copyright (c) 2013, 2021, Red Hat, Inc. 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_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP25#define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP2627#include "gc/shared/gcTrace.hpp"28#include "gc/shenandoah/shenandoahGC.hpp"29#include "gc/shenandoah/shenandoahSharedVariables.hpp"30#include "memory/allocation.hpp"31#include "utilities/ostream.hpp"3233class ShenandoahTracer : public GCTracer {34public:35ShenandoahTracer() : GCTracer(Shenandoah) {}36};3738class ShenandoahCollectorPolicy : public CHeapObj<mtGC> {39private:40size_t _success_concurrent_gcs;41size_t _success_degenerated_gcs;42size_t _success_full_gcs;43size_t _alloc_failure_degenerated;44size_t _alloc_failure_degenerated_upgrade_to_full;45size_t _alloc_failure_full;46size_t _explicit_concurrent;47size_t _explicit_full;48size_t _implicit_concurrent;49size_t _implicit_full;50size_t _degen_points[ShenandoahGC::_DEGENERATED_LIMIT];5152ShenandoahSharedFlag _in_shutdown;5354ShenandoahTracer* _tracer;5556size_t _cycle_counter;5758public:59ShenandoahCollectorPolicy();6061// TODO: This is different from gc_end: that one encompasses one VM operation.62// These two encompass the entire cycle.63void record_cycle_start();6465void record_success_concurrent();66void record_success_degenerated();67void record_success_full();68void record_alloc_failure_to_degenerated(ShenandoahGC::ShenandoahDegenPoint point);69void record_alloc_failure_to_full();70void record_degenerated_upgrade_to_full();71void record_explicit_to_concurrent();72void record_explicit_to_full();73void record_implicit_to_concurrent();74void record_implicit_to_full();7576void record_shutdown();77bool is_at_shutdown();7879ShenandoahTracer* tracer() {return _tracer;}8081size_t cycle_counter() const;8283void print_gc_stats(outputStream* out) const;84};8586#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP878889