src/share/vm/memory/tenuredGeneration.hpp

Wed, 29 Oct 2008 06:30:02 -0700

author
jcoomes
date
Wed, 29 Oct 2008 06:30:02 -0700
changeset 873
122d10c82f3f
parent 435
a61af66fc99e
child 905
ad8c8ca4ab0f
permissions
-rw-r--r--

6765804: GC "dead ratios" should be unsigned
Reviewed-by: ysr, tonyp

duke@435 1 /*
duke@435 2 * Copyright 2001-2007 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // TenuredGeneration models the heap containing old (promoted/tenured) objects.
duke@435 26
duke@435 27 class ParGCAllocBufferWithBOT;
duke@435 28
duke@435 29 class TenuredGeneration: public OneContigSpaceCardGeneration {
duke@435 30 friend class VMStructs;
duke@435 31 protected:
duke@435 32 // current shrinking effect: this damps shrinking when the heap gets empty.
duke@435 33 size_t _shrink_factor;
duke@435 34 // Some statistics from before gc started.
duke@435 35 // These are gathered in the gc_prologue (and should_collect)
duke@435 36 // to control growing/shrinking policy in spite of promotions.
duke@435 37 size_t _capacity_at_prologue;
duke@435 38 size_t _used_at_prologue;
duke@435 39
duke@435 40 #ifndef SERIALGC
duke@435 41 // To support parallel promotion: an array of parallel allocation
duke@435 42 // buffers, one per thread, initially NULL.
duke@435 43 ParGCAllocBufferWithBOT** _alloc_buffers;
duke@435 44 #endif // SERIALGC
duke@435 45
duke@435 46 // Retire all alloc buffers before a full GC, so that they will be
duke@435 47 // re-allocated at the start of the next young GC.
duke@435 48 void retire_alloc_buffers_before_full_gc();
duke@435 49
duke@435 50 GenerationCounters* _gen_counters;
duke@435 51 CSpaceCounters* _space_counters;
duke@435 52
duke@435 53 public:
duke@435 54 TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
duke@435 55 GenRemSet* remset);
duke@435 56
duke@435 57 Generation::Name kind() { return Generation::MarkSweepCompact; }
duke@435 58
duke@435 59 // Printing
duke@435 60 const char* name() const;
duke@435 61 const char* short_name() const { return "Tenured"; }
duke@435 62 bool must_be_youngest() const { return false; }
duke@435 63 bool must_be_oldest() const { return true; }
duke@435 64
duke@435 65 // Does a "full" (forced) collection invoked on this generation collect
duke@435 66 // all younger generations as well? Note that this is a
duke@435 67 // hack to allow the collection of the younger gen first if the flag is
duke@435 68 // set. This is better than using th policy's should_collect_gen0_first()
duke@435 69 // since that causes us to do an extra unnecessary pair of restart-&-stop-world.
duke@435 70 virtual bool full_collects_younger_generations() const {
duke@435 71 return !CollectGen0First;
duke@435 72 }
duke@435 73
duke@435 74 // Mark sweep support
duke@435 75 void compute_new_size();
duke@435 76
duke@435 77 virtual void gc_prologue(bool full);
duke@435 78 virtual void gc_epilogue(bool full);
duke@435 79 bool should_collect(bool full,
duke@435 80 size_t word_size,
duke@435 81 bool is_tlab);
duke@435 82
duke@435 83 virtual void collect(bool full,
duke@435 84 bool clear_all_soft_refs,
duke@435 85 size_t size,
duke@435 86 bool is_tlab);
duke@435 87
duke@435 88 #ifndef SERIALGC
duke@435 89 // Overrides.
duke@435 90 virtual oop par_promote(int thread_num,
duke@435 91 oop obj, markOop m, size_t word_sz);
duke@435 92 virtual void par_promote_alloc_undo(int thread_num,
duke@435 93 HeapWord* obj, size_t word_sz);
duke@435 94 virtual void par_promote_alloc_done(int thread_num);
duke@435 95 #endif // SERIALGC
duke@435 96
duke@435 97 // Performance Counter support
duke@435 98 void update_counters();
duke@435 99
duke@435 100 // Statistics
duke@435 101
duke@435 102 virtual void update_gc_stats(int level, bool full);
duke@435 103
duke@435 104 virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes,
duke@435 105 bool younger_handles_promotion_failure) const;
duke@435 106
duke@435 107 void verify_alloc_buffers_clean();
duke@435 108 };

mercurial