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