src/share/vm/memory/tenuredGeneration.hpp

Wed, 23 Jan 2013 13:02:39 -0500

author
jprovino
date
Wed, 23 Jan 2013 13:02:39 -0500
changeset 4542
db9981fd3124
parent 2314
f95d63e2154a
child 4900
8617e38bb4cb
permissions
-rw-r--r--

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP
stefank@2314 26 #define SHARE_VM_MEMORY_TENUREDGENERATION_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/shared/cSpaceCounters.hpp"
stefank@2314 29 #include "gc_implementation/shared/gcStats.hpp"
stefank@2314 30 #include "gc_implementation/shared/generationCounters.hpp"
stefank@2314 31 #include "memory/generation.hpp"
jprovino@4542 32 #include "utilities/macros.hpp"
stefank@2314 33
duke@435 34 // TenuredGeneration models the heap containing old (promoted/tenured) objects.
duke@435 35
duke@435 36 class ParGCAllocBufferWithBOT;
duke@435 37
duke@435 38 class TenuredGeneration: public OneContigSpaceCardGeneration {
duke@435 39 friend class VMStructs;
duke@435 40 protected:
duke@435 41 // current shrinking effect: this damps shrinking when the heap gets empty.
duke@435 42 size_t _shrink_factor;
duke@435 43 // Some statistics from before gc started.
duke@435 44 // These are gathered in the gc_prologue (and should_collect)
duke@435 45 // to control growing/shrinking policy in spite of promotions.
duke@435 46 size_t _capacity_at_prologue;
duke@435 47 size_t _used_at_prologue;
duke@435 48
jprovino@4542 49 #if INCLUDE_ALL_GCS
duke@435 50 // To support parallel promotion: an array of parallel allocation
duke@435 51 // buffers, one per thread, initially NULL.
duke@435 52 ParGCAllocBufferWithBOT** _alloc_buffers;
jprovino@4542 53 #endif // INCLUDE_ALL_GCS
duke@435 54
duke@435 55 // Retire all alloc buffers before a full GC, so that they will be
duke@435 56 // re-allocated at the start of the next young GC.
duke@435 57 void retire_alloc_buffers_before_full_gc();
duke@435 58
duke@435 59 GenerationCounters* _gen_counters;
duke@435 60 CSpaceCounters* _space_counters;
duke@435 61
duke@435 62 public:
duke@435 63 TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
duke@435 64 GenRemSet* remset);
duke@435 65
duke@435 66 Generation::Name kind() { return Generation::MarkSweepCompact; }
duke@435 67
duke@435 68 // Printing
duke@435 69 const char* name() const;
duke@435 70 const char* short_name() const { return "Tenured"; }
duke@435 71 bool must_be_youngest() const { return false; }
duke@435 72 bool must_be_oldest() const { return true; }
duke@435 73
duke@435 74 // Does a "full" (forced) collection invoked on this generation collect
duke@435 75 // all younger generations as well? Note that this is a
duke@435 76 // hack to allow the collection of the younger gen first if the flag is
duke@435 77 // set. This is better than using th policy's should_collect_gen0_first()
duke@435 78 // since that causes us to do an extra unnecessary pair of restart-&-stop-world.
duke@435 79 virtual bool full_collects_younger_generations() const {
duke@435 80 return !CollectGen0First;
duke@435 81 }
duke@435 82
duke@435 83 // Mark sweep support
duke@435 84 void compute_new_size();
duke@435 85
duke@435 86 virtual void gc_prologue(bool full);
duke@435 87 virtual void gc_epilogue(bool full);
duke@435 88 bool should_collect(bool full,
duke@435 89 size_t word_size,
duke@435 90 bool is_tlab);
duke@435 91
duke@435 92 virtual void collect(bool full,
duke@435 93 bool clear_all_soft_refs,
duke@435 94 size_t size,
duke@435 95 bool is_tlab);
duke@435 96
jprovino@4542 97 #if INCLUDE_ALL_GCS
duke@435 98 // Overrides.
duke@435 99 virtual oop par_promote(int thread_num,
duke@435 100 oop obj, markOop m, size_t word_sz);
duke@435 101 virtual void par_promote_alloc_undo(int thread_num,
duke@435 102 HeapWord* obj, size_t word_sz);
duke@435 103 virtual void par_promote_alloc_done(int thread_num);
jprovino@4542 104 #endif // INCLUDE_ALL_GCS
duke@435 105
duke@435 106 // Performance Counter support
duke@435 107 void update_counters();
duke@435 108
duke@435 109 // Statistics
duke@435 110
duke@435 111 virtual void update_gc_stats(int level, bool full);
duke@435 112
ysr@2243 113 virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
duke@435 114
duke@435 115 void verify_alloc_buffers_clean();
duke@435 116 };
stefank@2314 117
stefank@2314 118 #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP

mercurial