annotate src/share/vm/memory/genRemSet.hpp @ 12233:40136aa2cdb1

8010722: assert: failed: heap size is too big for compressed oops Summary: Use conservative assumptions of required alignment for the various garbage collector components into account when determining the maximum heap size that supports compressed oops. Using this conservative value avoids several circular dependencies in the calculation. Reviewed-by: stefank, dholmes
author tschatzl
date Wed, 11 Sep 2013 16:25:02 +0200
parents bd902affe102
children de6a9e811145
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
2 * Copyright (c) 2001, 2012, 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: 356
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 356
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: 356
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: 1552
diff changeset
25 #ifndef SHARE_VM_MEMORY_GENREMSET_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_MEMORY_GENREMSET_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "oops/oop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // A GenRemSet provides ways of iterating over pointers accross generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // (This is especially useful for older-to-younger.)
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class Generation;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class BarrierSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class OopsInGenClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class CardTableRS;
a61af66fc99e Initial load
duke
parents:
diff changeset
37
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
38 // Helper to remember modified oops in all klasses.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
39 class KlassRemSet {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
40 bool _accumulate_modified_oops;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
41 public:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
42 KlassRemSet() : _accumulate_modified_oops(false) {}
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
43 void set_accumulate_modified_oops(bool value) { _accumulate_modified_oops = value; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
44 bool accumulate_modified_oops() { return _accumulate_modified_oops; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
45 bool mod_union_is_clear();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
46 void clear_mod_union();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
47 };
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
48
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
49 class GenRemSet: public CHeapObj<mtGC> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
50 friend class Generation;
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 BarrierSet* _bs;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
53 KlassRemSet _klass_rem_set;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
56 enum Name {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 CardTable,
a61af66fc99e Initial load
duke
parents:
diff changeset
58 Other
a61af66fc99e Initial load
duke
parents:
diff changeset
59 };
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 GenRemSet(BarrierSet * bs) : _bs(bs) {}
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
62 GenRemSet() : _bs(NULL) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 virtual Name rs_kind() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // These are for dynamic downcasts. Unfortunately that it names the
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // possible subtypes (but not that they are subtypes!) Return NULL if
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // the cast is invalide.
a61af66fc99e Initial load
duke
parents:
diff changeset
69 virtual CardTableRS* as_CardTableRS() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // Return the barrier set associated with "this."
a61af66fc99e Initial load
duke
parents:
diff changeset
72 BarrierSet* bs() { return _bs; }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
74 // Set the barrier set.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
75 void set_bs(BarrierSet* bs) { _bs = bs; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
76
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
77 KlassRemSet* klass_rem_set() { return &_klass_rem_set; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
78
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Do any (sequential) processing necessary to prepare for (possibly
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // "parallel", if that arg is true) calls to younger_refs_iterate.
a61af66fc99e Initial load
duke
parents:
diff changeset
81 virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // Apply the "do_oop" method of "blk" to (exactly) all oop locations
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // 1) that are in objects allocated in "g" at the time of the last call
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // to "save_Marks", and
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // 2) that point to objects in younger generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
87 virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 virtual void younger_refs_in_space_iterate(Space* sp,
a61af66fc99e Initial load
duke
parents:
diff changeset
90 OopsInGenClosure* cl) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // This method is used to notify the remembered set that "new_val" has
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // been written into "field" by the garbage collector.
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
94 void write_ref_field_gc(void* field, oop new_val);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
95 protected:
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
96 virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // A version of the above suitable for use by parallel collectors.
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
100 virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // Resize one of the regions covered by the remembered set.
a61af66fc99e Initial load
duke
parents:
diff changeset
103 virtual void resize_covered_region(MemRegion new_region) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // If the rem set imposes any alignment restrictions on boundaries
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // within the heap, this function tells whether they are met.
a61af66fc99e Initial load
duke
parents:
diff changeset
107 virtual bool is_aligned(HeapWord* addr) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // If the RS (or BS) imposes an aligment constraint on maximum heap size.
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // (This must be static, and dispatch on "nm", because it is called
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // before an RS is created.)
a61af66fc99e Initial load
duke
parents:
diff changeset
112 static uintx max_alignment_constraint(Name nm);
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 virtual void verify() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Verify that the remembered set has no entries for
6
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
117 // the heap interval denoted by mr. If there are any
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
118 // alignment constraints on the remembered set, only the
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
119 // part of the region that is aligned is checked.
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
120 //
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
121 // alignment boundaries
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
122 // +--------+-------+--------+-------+
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
123 // [ region mr )
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
124 // [ part checked )
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
125 virtual void verify_aligned_region_empty(MemRegion mr) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // If appropriate, print some information about the remset on "tty".
a61af66fc99e Initial load
duke
parents:
diff changeset
128 virtual void print() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // Informs the RS that the given memregion contains no references to
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // younger generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
132 virtual void clear(MemRegion mr) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // Informs the RS that there are no references to generations
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // younger than gen from generations gen and older.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // The parameter clear_perm indicates if the perm_gen's
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // remembered set should also be processed/cleared.
12033
bd902affe102 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 12030
diff changeset
138 virtual void clear_into_younger(Generation* old_gen) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // Informs the RS that refs in the given "mr" may have changed
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // arbitrarily, and therefore may contain old-to-young pointers.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
142 // If "whole heap" is true, then this invalidation is part of an
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
143 // invalidation of the whole heap, which an implementation might
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
144 // handle differently than that of a sub-part of the heap.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
145 virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // Informs the RS that refs in this generation
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // may have changed arbitrarily, and therefore may contain
12030
330dfb0476f4 8022800: Use specific generations rather than generation iteration
brutisso
parents: 6725
diff changeset
149 // old-to-young pointers in arbitrary locations.
12033
bd902affe102 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 12030
diff changeset
150 virtual void invalidate_or_clear(Generation* old_gen) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
151 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
152
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
153 #endif // SHARE_VM_MEMORY_GENREMSET_HPP