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