Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/g1/sparsePRT.hpp @ 1286:ab75c83d7c37
Merge
author | johnc |
---|---|
date | Tue, 02 Mar 2010 13:57:46 -0800 |
parents | 0414c1049f15 |
children | c18cbe5936b8 |
rev | line source |
---|---|
342 | 1 /* |
579 | 2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. |
342 | 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 // Sparse remembered set for a heap region (the "owning" region). Maps | |
26 // indices of other regions to short sequences of cards in the other region | |
27 // that might contain pointers into the owner region. | |
28 | |
29 // These tables only expand while they are accessed in parallel -- | |
30 // deletions may be done in single-threaded code. This allows us to allow | |
31 // unsynchronized reads/iterations, as long as expansions caused by | |
32 // insertions only enqueue old versions for deletions, but do not delete | |
33 // old versions synchronously. | |
34 | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
35 class SparsePRTEntry: public CHeapObj { |
342 | 36 public: |
37 enum SomePublicConstants { | |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
38 NullEntry = -1, |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
39 UnrollFactor = 4 |
342 | 40 }; |
41 private: | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
42 RegionIdx_t _region_ind; |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
43 int _next_index; |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
44 CardIdx_t _cards[1]; |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
45 // WARNING: Don't put any data members beyond this line. Card array has, in fact, variable length. |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
46 // It should always be the last data member. |
342 | 47 public: |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
48 // Returns the size of the entry, used for entry allocation. |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
49 static size_t size() { return sizeof(SparsePRTEntry) + sizeof(CardIdx_t) * (cards_num() - 1); } |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
50 // Returns the size of the card array. |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
51 static int cards_num() { |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
52 // The number of cards should be a multiple of 4, because that's our current |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
53 // unrolling factor. |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
54 static const int s = MAX2<int>(G1RSetSparseRegionEntries & ~(UnrollFactor - 1), UnrollFactor); |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
55 return s; |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
56 } |
342 | 57 |
58 // Set the region_ind to the given value, and delete all cards. | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
59 inline void init(RegionIdx_t region_ind); |
342 | 60 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
61 RegionIdx_t r_ind() const { return _region_ind; } |
342 | 62 bool valid_entry() const { return r_ind() >= 0; } |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
63 void set_r_ind(RegionIdx_t rind) { _region_ind = rind; } |
342 | 64 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
65 int next_index() const { return _next_index; } |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
66 int* next_index_addr() { return &_next_index; } |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
67 void set_next_index(int ni) { _next_index = ni; } |
342 | 68 |
69 // Returns "true" iff the entry contains the given card index. | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
70 inline bool contains_card(CardIdx_t card_index) const; |
342 | 71 |
72 // Returns the number of non-NULL card entries. | |
73 inline int num_valid_cards() const; | |
74 | |
75 // Requires that the entry not contain the given card index. If there is | |
76 // space available, add the given card index to the entry and return | |
77 // "true"; otherwise, return "false" to indicate that the entry is full. | |
78 enum AddCardResult { | |
79 overflow, | |
80 found, | |
81 added | |
82 }; | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
83 inline AddCardResult add_card(CardIdx_t card_index); |
342 | 84 |
85 // Copy the current entry's cards into "cards". | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
86 inline void copy_cards(CardIdx_t* cards) const; |
342 | 87 // Copy the current entry's cards into the "_card" array of "e." |
88 inline void copy_cards(SparsePRTEntry* e) const; | |
89 | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
90 inline CardIdx_t card(int i) const { return _cards[i]; } |
342 | 91 }; |
92 | |
93 | |
94 class RSHashTable : public CHeapObj { | |
95 | |
96 friend class RSHashTableIter; | |
97 | |
98 enum SomePrivateConstants { | |
99 NullEntry = -1 | |
100 }; | |
101 | |
102 size_t _capacity; | |
103 size_t _capacity_mask; | |
104 size_t _occupied_entries; | |
105 size_t _occupied_cards; | |
106 | |
107 SparsePRTEntry* _entries; | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
108 int* _buckets; |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
109 int _free_region; |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
110 int _free_list; |
342 | 111 |
112 // Requires that the caller hold a lock preventing parallel modifying | |
113 // operations, and that the the table be less than completely full. If | |
114 // an entry for "region_ind" is already in the table, finds it and | |
115 // returns its address; otherwise returns "NULL." | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
116 SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const; |
342 | 117 |
118 // Requires that the caller hold a lock preventing parallel modifying | |
119 // operations, and that the the table be less than completely full. If | |
120 // an entry for "region_ind" is already in the table, finds it and | |
121 // returns its address; otherwise allocates, initializes, inserts and | |
122 // returns a new entry for "region_ind". | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
123 SparsePRTEntry* entry_for_region_ind_create(RegionIdx_t region_ind); |
342 | 124 |
125 // Returns the index of the next free entry in "_entries". | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
126 int alloc_entry(); |
342 | 127 // Declares the entry "fi" to be free. (It must have already been |
128 // deleted from any bucket lists. | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
129 void free_entry(int fi); |
342 | 130 |
131 public: | |
132 RSHashTable(size_t capacity); | |
133 ~RSHashTable(); | |
134 | |
135 // Attempts to ensure that the given card_index in the given region is in | |
136 // the sparse table. If successful (because the card was already | |
137 // present, or because it was successfullly added) returns "true". | |
138 // Otherwise, returns "false" to indicate that the addition would | |
139 // overflow the entry for the region. The caller must transfer these | |
140 // entries to a larger-capacity representation. | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
141 bool add_card(RegionIdx_t region_id, CardIdx_t card_index); |
342 | 142 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
143 bool get_cards(RegionIdx_t region_id, CardIdx_t* cards); |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
144 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
145 bool delete_entry(RegionIdx_t region_id); |
342 | 146 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
147 bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const; |
342 | 148 |
149 void add_entry(SparsePRTEntry* e); | |
150 | |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
151 SparsePRTEntry* get_entry(RegionIdx_t region_id); |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
152 |
342 | 153 void clear(); |
154 | |
155 size_t capacity() const { return _capacity; } | |
156 size_t capacity_mask() const { return _capacity_mask; } | |
157 size_t occupied_entries() const { return _occupied_entries; } | |
158 size_t occupied_cards() const { return _occupied_cards; } | |
159 size_t mem_size() const; | |
160 | |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
161 SparsePRTEntry* entry(int i) const { return (SparsePRTEntry*)((char*)_entries + SparsePRTEntry::size() * i); } |
342 | 162 |
163 void print(); | |
164 }; | |
165 | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
166 // ValueObj because will be embedded in HRRS iterator. |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
167 class RSHashTableIter VALUE_OBJ_CLASS_SPEC { |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
168 int _tbl_ind; // [-1, 0.._rsht->_capacity) |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
169 int _bl_ind; // [-1, 0.._rsht->_capacity) |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
170 short _card_ind; // [0..SparsePRTEntry::cards_num()) |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
171 RSHashTable* _rsht; |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
172 size_t _heap_bot_card_ind; |
342 | 173 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
174 // If the bucket list pointed to by _bl_ind contains a card, sets |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
175 // _bl_ind to the index of that entry, and returns the card. |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
176 // Otherwise, returns SparseEntry::NullEntry. |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
177 CardIdx_t find_first_card_in_list(); |
342 | 178 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
179 // Computes the proper card index for the card whose offset in the |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
180 // current region (as indicated by _bl_ind) is "ci". |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
181 // This is subject to errors when there is iteration concurrent with |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
182 // modification, but these errors should be benign. |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
183 size_t compute_card_ind(CardIdx_t ci); |
342 | 184 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
185 public: |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
186 RSHashTableIter(size_t heap_bot_card_ind) : |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
187 _tbl_ind(RSHashTable::NullEntry), |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
188 _bl_ind(RSHashTable::NullEntry), |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
189 _card_ind((SparsePRTEntry::cards_num() - 1)), |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
190 _rsht(NULL), |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
191 _heap_bot_card_ind(heap_bot_card_ind) |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
192 {} |
342 | 193 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
194 void init(RSHashTable* rsht) { |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
195 _rsht = rsht; |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
196 _tbl_ind = -1; // So that first increment gets to 0. |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
197 _bl_ind = RSHashTable::NullEntry; |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
198 _card_ind = (SparsePRTEntry::cards_num() - 1); |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
199 } |
342 | 200 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
201 bool has_next(size_t& card_index); |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
202 }; |
342 | 203 |
204 // Concurrent accesss to a SparsePRT must be serialized by some external | |
205 // mutex. | |
206 | |
207 class SparsePRTIter; | |
208 | |
549
fe3d7c11b4b7
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
342
diff
changeset
|
209 class SparsePRT VALUE_OBJ_CLASS_SPEC { |
342 | 210 // Iterations are done on the _cur hash table, since they only need to |
211 // see entries visible at the start of a collection pause. | |
212 // All other operations are done using the _next hash table. | |
213 RSHashTable* _cur; | |
214 RSHashTable* _next; | |
215 | |
216 HeapRegion* _hr; | |
217 | |
218 enum SomeAdditionalPrivateConstants { | |
219 InitialCapacity = 16 | |
220 }; | |
221 | |
222 void expand(); | |
223 | |
224 bool _expanded; | |
225 | |
226 bool expanded() { return _expanded; } | |
227 void set_expanded(bool b) { _expanded = b; } | |
228 | |
229 SparsePRT* _next_expanded; | |
230 | |
231 SparsePRT* next_expanded() { return _next_expanded; } | |
232 void set_next_expanded(SparsePRT* nxt) { _next_expanded = nxt; } | |
233 | |
234 static SparsePRT* _head_expanded_list; | |
235 | |
236 public: | |
237 SparsePRT(HeapRegion* hr); | |
238 | |
239 ~SparsePRT(); | |
240 | |
241 size_t occupied() const { return _next->occupied_cards(); } | |
242 size_t mem_size() const; | |
243 | |
244 // Attempts to ensure that the given card_index in the given region is in | |
245 // the sparse table. If successful (because the card was already | |
246 // present, or because it was successfullly added) returns "true". | |
247 // Otherwise, returns "false" to indicate that the addition would | |
248 // overflow the entry for the region. The caller must transfer these | |
249 // entries to a larger-capacity representation. | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
250 bool add_card(RegionIdx_t region_id, CardIdx_t card_index); |
342 | 251 |
252 // If the table hold an entry for "region_ind", Copies its | |
253 // cards into "cards", which must be an array of length at least | |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
254 // "SparePRTEntry::cards_num()", and returns "true"; otherwise, |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
255 // returns "false". |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
256 bool get_cards(RegionIdx_t region_ind, CardIdx_t* cards); |
342 | 257 |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
258 // Return the pointer to the entry associated with the given region. |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
259 SparsePRTEntry* get_entry(RegionIdx_t region_ind); |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1045
diff
changeset
|
260 |
342 | 261 // If there is an entry for "region_ind", removes it and return "true"; |
262 // otherwise returns "false." | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
263 bool delete_entry(RegionIdx_t region_ind); |
342 | 264 |
265 // Clear the table, and reinitialize to initial capacity. | |
266 void clear(); | |
267 | |
268 // Ensure that "_cur" and "_next" point to the same table. | |
269 void cleanup(); | |
270 | |
271 // Clean up all tables on the expanded list. Called single threaded. | |
272 static void cleanup_all(); | |
617
0db4adb6e914
6810698: G1: two small bugs in the sparse remembered sets
tonyp
parents:
549
diff
changeset
|
273 RSHashTable* cur() const { return _cur; } |
342 | 274 |
275 void init_iterator(SparsePRTIter* sprt_iter); | |
276 | |
277 static void add_to_expanded_list(SparsePRT* sprt); | |
278 static SparsePRT* get_from_expanded_list(); | |
279 | |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
628
diff
changeset
|
280 bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const { |
342 | 281 return _next->contains_card(region_id, card_index); |
282 } | |
283 | |
284 #if 0 | |
285 void verify_is_cleared(); | |
286 void print(); | |
287 #endif | |
288 }; | |
289 | |
290 | |
291 class SparsePRTIter: public /* RSHashTable:: */RSHashTableIter { | |
292 public: | |
293 SparsePRTIter(size_t heap_bot_card_ind) : | |
294 /* RSHashTable:: */RSHashTableIter(heap_bot_card_ind) | |
295 {} | |
296 | |
297 void init(const SparsePRT* sprt) { | |
617
0db4adb6e914
6810698: G1: two small bugs in the sparse remembered sets
tonyp
parents:
549
diff
changeset
|
298 RSHashTableIter::init(sprt->cur()); |
342 | 299 } |
300 bool has_next(size_t& card_index) { | |
301 return RSHashTableIter::has_next(card_index); | |
302 } | |
303 }; |