Path: blob/master/src/hotspot/share/gc/shared/cardGeneration.hpp
40957 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_GC_SHARED_CARDGENERATION_HPP25#define SHARE_GC_SHARED_CARDGENERATION_HPP2627// Class CardGeneration is a generation that is covered by a card table,28// and uses a card-size block-offset array to implement block_start.2930#include "gc/shared/generation.hpp"3132class BlockOffsetSharedArray;33class CardTableRS;34class CompactibleSpace;3536class CardGeneration: public Generation {37friend class VMStructs;38protected:39// This is shared with other generations.40CardTableRS* _rs;41// This is local to this generation.42BlockOffsetSharedArray* _bts;4344// Current shrinking effect: this damps shrinking when the heap gets empty.45size_t _shrink_factor;4647size_t _min_heap_delta_bytes; // Minimum amount to expand.4849// Some statistics from before gc started.50// These are gathered in the gc_prologue (and should_collect)51// to control growing/shrinking policy in spite of promotions.52size_t _capacity_at_prologue;53size_t _used_at_prologue;5455CardGeneration(ReservedSpace rs, size_t initial_byte_size, CardTableRS* remset);5657virtual void assert_correct_size_change_locking() = 0;5859virtual CompactibleSpace* space() const = 0;6061public:6263// Attempt to expand the generation by "bytes". Expand by at a64// minimum "expand_bytes". Return true if some amount (not65// necessarily the full "bytes") was done.66virtual bool expand(size_t bytes, size_t expand_bytes);6768// Shrink generation with specified size69virtual void shrink(size_t bytes);7071virtual void compute_new_size();7273virtual void clear_remembered_set();7475virtual void invalidate_remembered_set();7677virtual void prepare_for_verify();7879// Grow generation with specified size (returns false if unable to grow)80bool grow_by(size_t bytes);81// Grow generation to reserved size.82bool grow_to_reserved();8384size_t capacity() const;85size_t used() const;86size_t free() const;87MemRegion used_region() const;8889void space_iterate(SpaceClosure* blk, bool usedOnly = false);9091void younger_refs_iterate(OopIterateClosure* blk);9293bool is_in(const void* p) const;9495CompactibleSpace* first_compaction_space() const;96};9798#endif // SHARE_GC_SHARED_CARDGENERATION_HPP99100101