0N/A/*
1879N/A * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP
1879N/A#define SHARE_VM_MEMORY_TENUREDGENERATION_HPP
1879N/A
1879N/A#include "gc_implementation/shared/cSpaceCounters.hpp"
1879N/A#include "gc_implementation/shared/gcStats.hpp"
1879N/A#include "gc_implementation/shared/generationCounters.hpp"
1879N/A#include "memory/generation.hpp"
1879N/A
0N/A// TenuredGeneration models the heap containing old (promoted/tenured) objects.
0N/A
0N/Aclass ParGCAllocBufferWithBOT;
0N/A
0N/Aclass TenuredGeneration: public OneContigSpaceCardGeneration {
0N/A friend class VMStructs;
0N/A protected:
0N/A // current shrinking effect: this damps shrinking when the heap gets empty.
0N/A size_t _shrink_factor;
0N/A // Some statistics from before gc started.
0N/A // These are gathered in the gc_prologue (and should_collect)
0N/A // to control growing/shrinking policy in spite of promotions.
0N/A size_t _capacity_at_prologue;
0N/A size_t _used_at_prologue;
0N/A
0N/A#ifndef SERIALGC
0N/A // To support parallel promotion: an array of parallel allocation
0N/A // buffers, one per thread, initially NULL.
0N/A ParGCAllocBufferWithBOT** _alloc_buffers;
0N/A#endif // SERIALGC
0N/A
0N/A // Retire all alloc buffers before a full GC, so that they will be
0N/A // re-allocated at the start of the next young GC.
0N/A void retire_alloc_buffers_before_full_gc();
0N/A
0N/A GenerationCounters* _gen_counters;
0N/A CSpaceCounters* _space_counters;
0N/A
0N/A public:
0N/A TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
0N/A GenRemSet* remset);
0N/A
0N/A Generation::Name kind() { return Generation::MarkSweepCompact; }
0N/A
0N/A // Printing
0N/A const char* name() const;
0N/A const char* short_name() const { return "Tenured"; }
0N/A bool must_be_youngest() const { return false; }
0N/A bool must_be_oldest() const { return true; }
0N/A
0N/A // Does a "full" (forced) collection invoked on this generation collect
0N/A // all younger generations as well? Note that this is a
0N/A // hack to allow the collection of the younger gen first if the flag is
0N/A // set. This is better than using th policy's should_collect_gen0_first()
0N/A // since that causes us to do an extra unnecessary pair of restart-&-stop-world.
0N/A virtual bool full_collects_younger_generations() const {
0N/A return !CollectGen0First;
0N/A }
0N/A
0N/A // Mark sweep support
0N/A void compute_new_size();
0N/A
0N/A virtual void gc_prologue(bool full);
0N/A virtual void gc_epilogue(bool full);
0N/A bool should_collect(bool full,
0N/A size_t word_size,
0N/A bool is_tlab);
0N/A
0N/A virtual void collect(bool full,
0N/A bool clear_all_soft_refs,
0N/A size_t size,
0N/A bool is_tlab);
0N/A
0N/A#ifndef SERIALGC
0N/A // Overrides.
0N/A virtual oop par_promote(int thread_num,
0N/A oop obj, markOop m, size_t word_sz);
0N/A virtual void par_promote_alloc_undo(int thread_num,
0N/A HeapWord* obj, size_t word_sz);
0N/A virtual void par_promote_alloc_done(int thread_num);
0N/A#endif // SERIALGC
0N/A
0N/A // Performance Counter support
0N/A void update_counters();
0N/A
0N/A // Statistics
0N/A
0N/A virtual void update_gc_stats(int level, bool full);
0N/A
1808N/A virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
0N/A
0N/A void verify_alloc_buffers_clean();
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP