annotate src/share/vm/memory/tenuredGeneration.hpp @ 1994:6cd6d394f280

7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed()) 7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages. Reviewed-by: johnc, tonyp
author ysr
date Tue, 07 Dec 2010 21:55:53 -0800
parents f95d63e2154a
children db9981fd3124
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
25 #ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
26 #define SHARE_VM_MEMORY_TENUREDGENERATION_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
28 #include "gc_implementation/shared/cSpaceCounters.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
29 #include "gc_implementation/shared/gcStats.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
30 #include "gc_implementation/shared/generationCounters.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
31 #include "memory/generation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // TenuredGeneration models the heap containing old (promoted/tenured) objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class ParGCAllocBufferWithBOT;
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class TenuredGeneration: public OneContigSpaceCardGeneration {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // current shrinking effect: this damps shrinking when the heap gets empty.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 size_t _shrink_factor;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Some statistics from before gc started.
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // These are gathered in the gc_prologue (and should_collect)
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // to control growing/shrinking policy in spite of promotions.
a61af66fc99e Initial load
duke
parents:
diff changeset
45 size_t _capacity_at_prologue;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 size_t _used_at_prologue;
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // To support parallel promotion: an array of parallel allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // buffers, one per thread, initially NULL.
a61af66fc99e Initial load
duke
parents:
diff changeset
51 ParGCAllocBufferWithBOT** _alloc_buffers;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // Retire all alloc buffers before a full GC, so that they will be
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // re-allocated at the start of the next young GC.
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void retire_alloc_buffers_before_full_gc();
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 GenerationCounters* _gen_counters;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 CSpaceCounters* _space_counters;
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
62 TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
a61af66fc99e Initial load
duke
parents:
diff changeset
63 GenRemSet* remset);
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 Generation::Name kind() { return Generation::MarkSweepCompact; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
68 const char* name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 const char* short_name() const { return "Tenured"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 bool must_be_youngest() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
71 bool must_be_oldest() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Does a "full" (forced) collection invoked on this generation collect
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // all younger generations as well? Note that this is a
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // hack to allow the collection of the younger gen first if the flag is
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // set. This is better than using th policy's should_collect_gen0_first()
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // since that causes us to do an extra unnecessary pair of restart-&-stop-world.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 virtual bool full_collects_younger_generations() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return !CollectGen0First;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Mark sweep support
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void compute_new_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 virtual void gc_prologue(bool full);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 virtual void gc_epilogue(bool full);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 bool should_collect(bool full,
a61af66fc99e Initial load
duke
parents:
diff changeset
88 size_t word_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
89 bool is_tlab);
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 virtual void collect(bool full,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 bool clear_all_soft_refs,
a61af66fc99e Initial load
duke
parents:
diff changeset
93 size_t size,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 bool is_tlab);
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Overrides.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 virtual oop par_promote(int thread_num,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 oop obj, markOop m, size_t word_sz);
a61af66fc99e Initial load
duke
parents:
diff changeset
100 virtual void par_promote_alloc_undo(int thread_num,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 HeapWord* obj, size_t word_sz);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 virtual void par_promote_alloc_done(int thread_num);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Performance Counter support
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void update_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 virtual void update_gc_stats(int level, bool full);
a61af66fc99e Initial load
duke
parents:
diff changeset
111
1888
a7214d79fcf1 6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents: 1552
diff changeset
112 virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 void verify_alloc_buffers_clean();
a61af66fc99e Initial load
duke
parents:
diff changeset
115 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
116
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1888
diff changeset
117 #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP