Path: blob/master/src/hotspot/share/gc/serial/tenuredGeneration.hpp
41149 views
/*1* Copyright (c) 2001, 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_GC_SERIAL_TENUREDGENERATION_HPP25#define SHARE_GC_SERIAL_TENUREDGENERATION_HPP2627#include "gc/serial/cSpaceCounters.hpp"28#include "gc/shared/cardGeneration.hpp"29#include "gc/shared/gcStats.hpp"30#include "gc/shared/generationCounters.hpp"31#include "utilities/macros.hpp"3233// TenuredGeneration models the heap containing old (promoted/tenured) objects34// contained in a single contiguous space.35//36// Garbage collection is performed using mark-compact.3738class TenuredGeneration: public CardGeneration {39friend class VMStructs;40// Abstractly, this is a subtype that gets access to protected fields.41friend class VM_PopulateDumpSharedSpace;4243protected:44ContiguousSpace* _the_space; // Actual space holding objects4546GenerationCounters* _gen_counters;47CSpaceCounters* _space_counters;4849// Allocation failure50virtual bool expand(size_t bytes, size_t expand_bytes);5152// Accessing spaces53ContiguousSpace* space() const { return _the_space; }5455void assert_correct_size_change_locking();5657public:58TenuredGeneration(ReservedSpace rs,59size_t initial_byte_size,60size_t min_byte_size,61size_t max_byte_size,62CardTableRS* remset);6364Generation::Name kind() { return Generation::MarkSweepCompact; }6566// Printing67const char* name() const { return "tenured generation"; }68const char* short_name() const { return "Tenured"; }6970size_t unsafe_max_alloc_nogc() const;71size_t contiguous_available() const;7273// Iteration74void object_iterate(ObjectClosure* blk);7576virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);77virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);7879template <typename OopClosureType>80void oop_since_save_marks_iterate(OopClosureType* cl);8182void save_marks();83void reset_saved_marks();84bool no_allocs_since_save_marks();8586inline size_t block_size(const HeapWord* addr) const;8788inline bool block_is_obj(const HeapWord* addr) const;8990virtual void collect(bool full,91bool clear_all_soft_refs,92size_t size,93bool is_tlab);9495HeapWord* expand_and_allocate(size_t size,96bool is_tlab,97bool parallel = false);9899virtual void prepare_for_verify();100101virtual void gc_prologue(bool full);102virtual void gc_epilogue(bool full);103104bool should_collect(bool full,105size_t word_size,106bool is_tlab);107108virtual void compute_new_size();109110// Performance Counter support111void update_counters();112113virtual void record_spaces_top();114115// Statistics116117virtual void update_gc_stats(Generation* current_generation, bool full);118119virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;120121virtual void verify();122virtual void print_on(outputStream* st) const;123};124125#endif // SHARE_GC_SERIAL_TENUREDGENERATION_HPP126127128