author | twisti |
Thu, 09 Sep 2010 05:24:11 -0700 | |
changeset 6459 | 3d75ed40a975 |
parent 5547 | f4b087cbb361 |
child 7397 | 5b173b4ca846 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
2 |
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
class Space; |
|
26 |
class OopsInGenClosure; |
|
27 |
class DirtyCardToOopClosure; |
|
28 |
||
29 |
// This kind of "GenRemSet" uses a card table both as shared data structure |
|
30 |
// for a mod ref barrier set and for the rem set information. |
|
31 |
||
32 |
class CardTableRS: public GenRemSet { |
|
33 |
friend class VMStructs; |
|
34 |
// Below are private classes used in impl. |
|
35 |
friend class VerifyCTSpaceClosure; |
|
36 |
friend class ClearNoncleanCardWrapper; |
|
37 |
||
38 |
static jbyte clean_card_val() { |
|
39 |
return CardTableModRefBS::clean_card; |
|
40 |
} |
|
41 |
||
42 |
static bool |
|
43 |
card_is_dirty_wrt_gen_iter(jbyte cv) { |
|
44 |
return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv); |
|
45 |
} |
|
46 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
47 |
CardTableModRefBSForCTRS* _ct_bs; |
1 | 48 |
|
49 |
virtual void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl); |
|
50 |
||
51 |
void verify_space(Space* s, HeapWord* gen_start); |
|
52 |
||
53 |
enum ExtendedCardValue { |
|
54 |
youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1, |
|
55 |
// These are for parallel collection. |
|
56 |
// There are three P (parallel) youngergen card values. In general, this |
|
57 |
// needs to be more than the number of generations (including the perm |
|
58 |
// gen) that might have younger_refs_do invoked on them separately. So |
|
59 |
// if we add more gens, we have to add more values. |
|
60 |
youngergenP1_card = CardTableModRefBS::CT_MR_BS_last_reserved + 2, |
|
61 |
youngergenP2_card = CardTableModRefBS::CT_MR_BS_last_reserved + 3, |
|
62 |
youngergenP3_card = CardTableModRefBS::CT_MR_BS_last_reserved + 4, |
|
63 |
cur_youngergen_and_prev_nonclean_card = |
|
64 |
CardTableModRefBS::CT_MR_BS_last_reserved + 5 |
|
65 |
}; |
|
66 |
||
67 |
// An array that contains, for each generation, the card table value last |
|
68 |
// used as the current value for a younger_refs_do iteration of that |
|
69 |
// portion of the table. (The perm gen is index 0; other gens are at |
|
70 |
// their level plus 1. They youngest gen is in the table, but will |
|
71 |
// always have the value "clean_card".) |
|
72 |
jbyte* _last_cur_val_in_gen; |
|
73 |
||
74 |
jbyte _cur_youngergen_card_val; |
|
75 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
76 |
int _regions_to_iterate; |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
77 |
|
1 | 78 |
jbyte cur_youngergen_card_val() { |
79 |
return _cur_youngergen_card_val; |
|
80 |
} |
|
81 |
void set_cur_youngergen_card_val(jbyte v) { |
|
82 |
_cur_youngergen_card_val = v; |
|
83 |
} |
|
84 |
bool is_prev_youngergen_card_val(jbyte v) { |
|
85 |
return |
|
86 |
youngergen_card <= v && |
|
87 |
v < cur_youngergen_and_prev_nonclean_card && |
|
88 |
v != _cur_youngergen_card_val; |
|
89 |
} |
|
90 |
// Return a youngergen_card_value that is not currently in use. |
|
91 |
jbyte find_unused_youngergenP_card_value(); |
|
92 |
||
93 |
public: |
|
94 |
CardTableRS(MemRegion whole_heap, int max_covered_regions); |
|
95 |
||
96 |
// *** GenRemSet functions. |
|
97 |
GenRemSet::Name rs_kind() { return GenRemSet::CardTable; } |
|
98 |
||
99 |
CardTableRS* as_CardTableRS() { return this; } |
|
100 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
101 |
CardTableModRefBS* ct_bs() { return _ct_bs; } |
1 | 102 |
|
103 |
// Override. |
|
104 |
void prepare_for_younger_refs_iterate(bool parallel); |
|
105 |
||
106 |
// Card table entries are cleared before application; "blk" is |
|
107 |
// responsible for dirtying if the oop is still older-to-younger after |
|
108 |
// closure application. |
|
109 |
void younger_refs_iterate(Generation* g, OopsInGenClosure* blk); |
|
110 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
111 |
void inline_write_ref_field_gc(void* field, oop new_val) { |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
112 |
jbyte* byte = _ct_bs->byte_for(field); |
1 | 113 |
*byte = youngergen_card; |
114 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
115 |
void write_ref_field_gc_work(void* field, oop new_val) { |
1 | 116 |
inline_write_ref_field_gc(field, new_val); |
117 |
} |
|
118 |
||
119 |
// Override. Might want to devirtualize this in the same fashion as |
|
120 |
// above. Ensures that the value of the card for field says that it's |
|
121 |
// a younger card in the current collection. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
122 |
virtual void write_ref_field_gc_par(void* field, oop new_val); |
1 | 123 |
|
124 |
void resize_covered_region(MemRegion new_region); |
|
125 |
||
126 |
bool is_aligned(HeapWord* addr) { |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
127 |
return _ct_bs->is_card_aligned(addr); |
1 | 128 |
} |
129 |
||
130 |
void verify(); |
|
179
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
131 |
void verify_aligned_region_empty(MemRegion mr); |
1 | 132 |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
133 |
void clear(MemRegion mr) { _ct_bs->clear(mr); } |
1 | 134 |
void clear_into_younger(Generation* gen, bool clear_perm); |
135 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
136 |
void invalidate(MemRegion mr, bool whole_heap = false) { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
137 |
_ct_bs->invalidate(mr, whole_heap); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
138 |
} |
1 | 139 |
void invalidate_or_clear(Generation* gen, bool younger, bool perm); |
140 |
||
141 |
static uintx ct_max_alignment_constraint() { |
|
142 |
return CardTableModRefBS::ct_max_alignment_constraint(); |
|
143 |
} |
|
144 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
145 |
jbyte* byte_for(void* p) { return _ct_bs->byte_for(p); } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
146 |
jbyte* byte_after(void* p) { return _ct_bs->byte_after(p); } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
147 |
HeapWord* addr_for(jbyte* p) { return _ct_bs->addr_for(p); } |
1 | 148 |
|
149 |
bool is_prev_nonclean_card_val(jbyte v) { |
|
150 |
return |
|
151 |
youngergen_card <= v && |
|
152 |
v <= cur_youngergen_and_prev_nonclean_card && |
|
153 |
v != _cur_youngergen_card_val; |
|
154 |
} |
|
155 |
||
156 |
static bool youngergen_may_have_been_dirty(jbyte cv) { |
|
157 |
return cv == CardTableRS::cur_youngergen_and_prev_nonclean_card; |
|
158 |
} |
|
159 |
||
160 |
}; |