annotate src/share/vm/memory/cardTableRS.hpp @ 12146:9758d9f36299

8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced Summary: declare all user-defined operator new()s within Hotspot code with the empty throw() exception specification Reviewed-by: coleenp, twisti, dholmes, hseigel, dcubed, kvn, ccheung Contributed-by: lois.foltan@oracle.com
author coleenp
date Thu, 29 Aug 2013 18:56:29 -0400
parents bd902affe102
children 284953caf7aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
10271
f9be75d21404 8012902: remove use of global operator new - take 2
minqi
parents: 10135
diff changeset
2 * Copyright (c) 2001, 2013, 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_CARDTABLERS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_MEMORY_CARDTABLERS_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 "memory/cardTableModRefBS.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/genRemSet.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "memory/memRegion.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 class Space;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class OopsInGenClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // This kind of "GenRemSet" uses a card table both as shared data structure
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // for a mod ref barrier set and for the rem set information.
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class CardTableRS: public GenRemSet {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // Below are private classes used in impl.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 friend class VerifyCTSpaceClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 friend class ClearNoncleanCardWrapper;
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 static jbyte clean_card_val() {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 return CardTableModRefBS::clean_card;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47
5939
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
48 static intptr_t clean_card_row() {
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
49 return CardTableModRefBS::clean_card_row;
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
50 }
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
51
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52 static bool
a61af66fc99e Initial load
duke
parents:
diff changeset
53 card_is_dirty_wrt_gen_iter(jbyte cv) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 }
a61af66fc99e Initial load
duke
parents:
diff changeset
56
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
57 CardTableModRefBSForCTRS* _ct_bs;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 virtual void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl);
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 void verify_space(Space* s, HeapWord* gen_start);
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 enum ExtendedCardValue {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // These are for parallel collection.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // There are three P (parallel) youngergen card values. In general, this
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // needs to be more than the number of generations (including the perm
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // gen) that might have younger_refs_do invoked on them separately. So
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // if we add more gens, we have to add more values.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 youngergenP1_card = CardTableModRefBS::CT_MR_BS_last_reserved + 2,
a61af66fc99e Initial load
duke
parents:
diff changeset
71 youngergenP2_card = CardTableModRefBS::CT_MR_BS_last_reserved + 3,
a61af66fc99e Initial load
duke
parents:
diff changeset
72 youngergenP3_card = CardTableModRefBS::CT_MR_BS_last_reserved + 4,
a61af66fc99e Initial load
duke
parents:
diff changeset
73 cur_youngergen_and_prev_nonclean_card =
a61af66fc99e Initial load
duke
parents:
diff changeset
74 CardTableModRefBS::CT_MR_BS_last_reserved + 5
a61af66fc99e Initial load
duke
parents:
diff changeset
75 };
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // An array that contains, for each generation, the card table value last
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // used as the current value for a younger_refs_do iteration of that
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // portion of the table. (The perm gen is index 0; other gens are at
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // their level plus 1. They youngest gen is in the table, but will
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // always have the value "clean_card".)
a61af66fc99e Initial load
duke
parents:
diff changeset
82 jbyte* _last_cur_val_in_gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 jbyte _cur_youngergen_card_val;
a61af66fc99e Initial load
duke
parents:
diff changeset
85
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
86 int _regions_to_iterate;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
87
0
a61af66fc99e Initial load
duke
parents:
diff changeset
88 jbyte cur_youngergen_card_val() {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return _cur_youngergen_card_val;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 void set_cur_youngergen_card_val(jbyte v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 _cur_youngergen_card_val = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94 bool is_prev_youngergen_card_val(jbyte v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 return
a61af66fc99e Initial load
duke
parents:
diff changeset
96 youngergen_card <= v &&
a61af66fc99e Initial load
duke
parents:
diff changeset
97 v < cur_youngergen_and_prev_nonclean_card &&
a61af66fc99e Initial load
duke
parents:
diff changeset
98 v != _cur_youngergen_card_val;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // Return a youngergen_card_value that is not currently in use.
a61af66fc99e Initial load
duke
parents:
diff changeset
101 jbyte find_unused_youngergenP_card_value();
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
104 CardTableRS(MemRegion whole_heap, int max_covered_regions);
10271
f9be75d21404 8012902: remove use of global operator new - take 2
minqi
parents: 10135
diff changeset
105 ~CardTableRS();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // *** GenRemSet functions.
a61af66fc99e Initial load
duke
parents:
diff changeset
108 GenRemSet::Name rs_kind() { return GenRemSet::CardTable; }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 CardTableRS* as_CardTableRS() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
112 CardTableModRefBS* ct_bs() { return _ct_bs; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Override.
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void prepare_for_younger_refs_iterate(bool parallel);
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Card table entries are cleared before application; "blk" is
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // responsible for dirtying if the oop is still older-to-younger after
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // closure application.
a61af66fc99e Initial load
duke
parents:
diff changeset
120 void younger_refs_iterate(Generation* g, OopsInGenClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
121
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
122 void inline_write_ref_field_gc(void* field, oop new_val) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
123 jbyte* byte = _ct_bs->byte_for(field);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 *byte = youngergen_card;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
126 void write_ref_field_gc_work(void* field, oop new_val) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
127 inline_write_ref_field_gc(field, new_val);
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // Override. Might want to devirtualize this in the same fashion as
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // above. Ensures that the value of the card for field says that it's
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // a younger card in the current collection.
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
133 virtual void write_ref_field_gc_par(void* field, oop new_val);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 void resize_covered_region(MemRegion new_region);
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 bool is_aligned(HeapWord* addr) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
138 return _ct_bs->is_card_aligned(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 void verify();
6
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
142 void verify_aligned_region_empty(MemRegion mr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
143
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
144 void clear(MemRegion mr) { _ct_bs->clear(mr); }
12033
bd902affe102 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 12030
diff changeset
145 void clear_into_younger(Generation* old_gen);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
146
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
147 void invalidate(MemRegion mr, bool whole_heap = false) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
148 _ct_bs->invalidate(mr, whole_heap);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
149 }
12033
bd902affe102 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 12030
diff changeset
150 void invalidate_or_clear(Generation* old_gen);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 static uintx ct_max_alignment_constraint() {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 return CardTableModRefBS::ct_max_alignment_constraint();
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
156 jbyte* byte_for(void* p) { return _ct_bs->byte_for(p); }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
157 jbyte* byte_after(void* p) { return _ct_bs->byte_after(p); }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
158 HeapWord* addr_for(jbyte* p) { return _ct_bs->addr_for(p); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 bool is_prev_nonclean_card_val(jbyte v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 return
a61af66fc99e Initial load
duke
parents:
diff changeset
162 youngergen_card <= v &&
a61af66fc99e Initial load
duke
parents:
diff changeset
163 v <= cur_youngergen_and_prev_nonclean_card &&
a61af66fc99e Initial load
duke
parents:
diff changeset
164 v != _cur_youngergen_card_val;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 }
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 static bool youngergen_may_have_been_dirty(jbyte cv) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 return cv == CardTableRS::cur_youngergen_and_prev_nonclean_card;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 }
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
172
3287
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
173 class ClearNoncleanCardWrapper: public MemRegionClosure {
3357
fc2b798ab316 6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents: 3287
diff changeset
174 DirtyCardToOopClosure* _dirty_card_closure;
3287
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
175 CardTableRS* _ct;
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
176 bool _is_par;
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
177 private:
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
178 // Clears the given card, return true if the corresponding card should be
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
179 // processed.
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
180 inline bool clear_card(jbyte* entry);
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
181 // Work methods called by the clear_card()
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
182 inline bool clear_card_serial(jbyte* entry);
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
183 inline bool clear_card_parallel(jbyte* entry);
5939
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
184 // check alignment of pointer
c7a555a9449a 7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
brutisso
parents: 3357
diff changeset
185 bool is_word_aligned(jbyte* entry);
3287
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
186
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
187 public:
3357
fc2b798ab316 6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents: 3287
diff changeset
188 ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
3287
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
189 void do_MemRegion(MemRegion mr);
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
190 };
c48ad6ab8bdf 7037276: Unnecessary double traversal of dirty card windows
ysr
parents: 1972
diff changeset
191
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
192 #endif // SHARE_VM_MEMORY_CARDTABLERS_HPP