author | tonyp |
Fri, 15 Oct 2010 17:26:56 -0400 | |
changeset 6981 | ecfe524b1fa7 |
parent 5547 | f4b087cbb361 |
child 6983 | a8c50cedbce9 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4902
diff
changeset
|
2 |
* Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. |
1374 | 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:
4902
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4902
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:
4902
diff
changeset
|
21 |
* questions. |
1374 | 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 |
||
2013
49e915da0905
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
1374
diff
changeset
|
35 |
class SparsePRTEntry: public CHeapObj { |
1374 | 36 |
public: |
37 |
enum SomePublicConstants { |
|
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
38 |
NullEntry = -1, |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
39 |
UnrollFactor = 4 |
1374 | 40 |
}; |
41 |
private: |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
42 |
RegionIdx_t _region_ind; |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
43 |
int _next_index; |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
44 |
CardIdx_t _cards[1]; |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
45 |
// WARNING: Don't put any data members beyond this line. Card array has, in fact, variable length. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
46 |
// It should always be the last data member. |
1374 | 47 |
public: |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
48 |
// Returns the size of the entry, used for entry allocation. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
49 |
static size_t size() { return sizeof(SparsePRTEntry) + sizeof(CardIdx_t) * (cards_num() - 1); } |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
50 |
// Returns the size of the card array. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
51 |
static int cards_num() { |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
52 |
// The number of cards should be a multiple of 4, because that's our current |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
53 |
// unrolling factor. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
54 |
static const int s = MAX2<int>(G1RSetSparseRegionEntries & ~(UnrollFactor - 1), UnrollFactor); |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
55 |
return s; |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
56 |
} |
1374 | 57 |
|
58 |
// Set the region_ind to the given value, and delete all cards. |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
59 |
inline void init(RegionIdx_t region_ind); |
1374 | 60 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
61 |
RegionIdx_t r_ind() const { return _region_ind; } |
1374 | 62 |
bool valid_entry() const { return r_ind() >= 0; } |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
63 |
void set_r_ind(RegionIdx_t rind) { _region_ind = rind; } |
1374 | 64 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
65 |
int next_index() const { return _next_index; } |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
66 |
int* next_index_addr() { return &_next_index; } |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
67 |
void set_next_index(int ni) { _next_index = ni; } |
1374 | 68 |
|
69 |
// Returns "true" iff the entry contains the given card index. |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
70 |
inline bool contains_card(CardIdx_t card_index) const; |
1374 | 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 |
}; |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
83 |
inline AddCardResult add_card(CardIdx_t card_index); |
1374 | 84 |
|
85 |
// Copy the current entry's cards into "cards". |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
86 |
inline void copy_cards(CardIdx_t* cards) const; |
1374 | 87 |
// Copy the current entry's cards into the "_card" array of "e." |
88 |
inline void copy_cards(SparsePRTEntry* e) const; |
|
89 |
||
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
90 |
inline CardIdx_t card(int i) const { return _cards[i]; } |
1374 | 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; |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
108 |
int* _buckets; |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
109 |
int _free_region; |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
110 |
int _free_list; |
1374 | 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." |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
116 |
SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const; |
1374 | 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". |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
123 |
SparsePRTEntry* entry_for_region_ind_create(RegionIdx_t region_ind); |
1374 | 124 |
|
125 |
// Returns the index of the next free entry in "_entries". |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
126 |
int alloc_entry(); |
1374 | 127 |
// Declares the entry "fi" to be free. (It must have already been |
128 |
// deleted from any bucket lists. |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
129 |
void free_entry(int fi); |
1374 | 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. |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
141 |
bool add_card(RegionIdx_t region_id, CardIdx_t card_index); |
1374 | 142 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
143 |
bool get_cards(RegionIdx_t region_id, CardIdx_t* cards); |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
144 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
145 |
bool delete_entry(RegionIdx_t region_id); |
1374 | 146 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
147 |
bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const; |
1374 | 148 |
|
149 |
void add_entry(SparsePRTEntry* e); |
|
150 |
||
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
151 |
SparsePRTEntry* get_entry(RegionIdx_t region_id); |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
152 |
|
1374 | 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 |
||
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
161 |
SparsePRTEntry* entry(int i) const { return (SparsePRTEntry*)((char*)_entries + SparsePRTEntry::size() * i); } |
1374 | 162 |
|
163 |
void print(); |
|
164 |
}; |
|
165 |
||
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
166 |
// ValueObj because will be embedded in HRRS iterator. |
2013
49e915da0905
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
1374
diff
changeset
|
167 |
class RSHashTableIter VALUE_OBJ_CLASS_SPEC { |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
168 |
int _tbl_ind; // [-1, 0.._rsht->_capacity) |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
169 |
int _bl_ind; // [-1, 0.._rsht->_capacity) |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
170 |
short _card_ind; // [0..SparsePRTEntry::cards_num()) |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
171 |
RSHashTable* _rsht; |
1374 | 172 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
173 |
// If the bucket list pointed to by _bl_ind contains a card, sets |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
174 |
// _bl_ind to the index of that entry, and returns the card. |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
175 |
// Otherwise, returns SparseEntry::NullEntry. |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
176 |
CardIdx_t find_first_card_in_list(); |
1374 | 177 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
178 |
// Computes the proper card index for the card whose offset in the |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
179 |
// current region (as indicated by _bl_ind) is "ci". |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
180 |
// This is subject to errors when there is iteration concurrent with |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
181 |
// modification, but these errors should be benign. |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
182 |
size_t compute_card_ind(CardIdx_t ci); |
1374 | 183 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
184 |
public: |
6981
ecfe524b1fa7
6992189: G1: inconsistent base used in sparse rem set iterator
tonyp
parents:
5547
diff
changeset
|
185 |
RSHashTableIter() : |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
186 |
_tbl_ind(RSHashTable::NullEntry), |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
187 |
_bl_ind(RSHashTable::NullEntry), |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
188 |
_card_ind((SparsePRTEntry::cards_num() - 1)), |
6981
ecfe524b1fa7
6992189: G1: inconsistent base used in sparse rem set iterator
tonyp
parents:
5547
diff
changeset
|
189 |
_rsht(NULL) {} |
1374 | 190 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
191 |
void init(RSHashTable* rsht) { |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
192 |
_rsht = rsht; |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
193 |
_tbl_ind = -1; // So that first increment gets to 0. |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
194 |
_bl_ind = RSHashTable::NullEntry; |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
195 |
_card_ind = (SparsePRTEntry::cards_num() - 1); |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
196 |
} |
1374 | 197 |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
198 |
bool has_next(size_t& card_index); |
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
199 |
}; |
1374 | 200 |
|
201 |
// Concurrent accesss to a SparsePRT must be serialized by some external |
|
202 |
// mutex. |
|
203 |
||
204 |
class SparsePRTIter; |
|
205 |
||
2013
49e915da0905
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
1374
diff
changeset
|
206 |
class SparsePRT VALUE_OBJ_CLASS_SPEC { |
1374 | 207 |
// Iterations are done on the _cur hash table, since they only need to |
208 |
// see entries visible at the start of a collection pause. |
|
209 |
// All other operations are done using the _next hash table. |
|
210 |
RSHashTable* _cur; |
|
211 |
RSHashTable* _next; |
|
212 |
||
213 |
HeapRegion* _hr; |
|
214 |
||
215 |
enum SomeAdditionalPrivateConstants { |
|
216 |
InitialCapacity = 16 |
|
217 |
}; |
|
218 |
||
219 |
void expand(); |
|
220 |
||
221 |
bool _expanded; |
|
222 |
||
223 |
bool expanded() { return _expanded; } |
|
224 |
void set_expanded(bool b) { _expanded = b; } |
|
225 |
||
226 |
SparsePRT* _next_expanded; |
|
227 |
||
228 |
SparsePRT* next_expanded() { return _next_expanded; } |
|
229 |
void set_next_expanded(SparsePRT* nxt) { _next_expanded = nxt; } |
|
230 |
||
231 |
static SparsePRT* _head_expanded_list; |
|
232 |
||
233 |
public: |
|
234 |
SparsePRT(HeapRegion* hr); |
|
235 |
||
236 |
~SparsePRT(); |
|
237 |
||
238 |
size_t occupied() const { return _next->occupied_cards(); } |
|
239 |
size_t mem_size() const; |
|
240 |
||
241 |
// Attempts to ensure that the given card_index in the given region is in |
|
242 |
// the sparse table. If successful (because the card was already |
|
243 |
// present, or because it was successfullly added) returns "true". |
|
244 |
// Otherwise, returns "false" to indicate that the addition would |
|
245 |
// overflow the entry for the region. The caller must transfer these |
|
246 |
// entries to a larger-capacity representation. |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
247 |
bool add_card(RegionIdx_t region_id, CardIdx_t card_index); |
1374 | 248 |
|
249 |
// If the table hold an entry for "region_ind", Copies its |
|
250 |
// cards into "cards", which must be an array of length at least |
|
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
251 |
// "SparePRTEntry::cards_num()", and returns "true"; otherwise, |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
252 |
// returns "false". |
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
253 |
bool get_cards(RegionIdx_t region_ind, CardIdx_t* cards); |
1374 | 254 |
|
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
255 |
// Return the pointer to the entry associated with the given region. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
256 |
SparsePRTEntry* get_entry(RegionIdx_t region_ind); |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4100
diff
changeset
|
257 |
|
1374 | 258 |
// If there is an entry for "region_ind", removes it and return "true"; |
259 |
// otherwise returns "false." |
|
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
260 |
bool delete_entry(RegionIdx_t region_ind); |
1374 | 261 |
|
262 |
// Clear the table, and reinitialize to initial capacity. |
|
263 |
void clear(); |
|
264 |
||
265 |
// Ensure that "_cur" and "_next" point to the same table. |
|
266 |
void cleanup(); |
|
267 |
||
268 |
// Clean up all tables on the expanded list. Called single threaded. |
|
269 |
static void cleanup_all(); |
|
2143
61babb9fbd6f
6810698: G1: two small bugs in the sparse remembered sets
tonyp
parents:
2013
diff
changeset
|
270 |
RSHashTable* cur() const { return _cur; } |
1374 | 271 |
|
272 |
void init_iterator(SparsePRTIter* sprt_iter); |
|
273 |
||
274 |
static void add_to_expanded_list(SparsePRT* sprt); |
|
275 |
static SparsePRT* get_from_expanded_list(); |
|
276 |
||
2996
1097030e5ec3
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
2154
diff
changeset
|
277 |
bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const { |
1374 | 278 |
return _next->contains_card(region_id, card_index); |
279 |
} |
|
280 |
}; |
|
281 |
||
282 |
||
6981
ecfe524b1fa7
6992189: G1: inconsistent base used in sparse rem set iterator
tonyp
parents:
5547
diff
changeset
|
283 |
class SparsePRTIter: public RSHashTableIter { |
1374 | 284 |
public: |
6981
ecfe524b1fa7
6992189: G1: inconsistent base used in sparse rem set iterator
tonyp
parents:
5547
diff
changeset
|
285 |
SparsePRTIter() : RSHashTableIter() { } |
1374 | 286 |
|
287 |
void init(const SparsePRT* sprt) { |
|
2143
61babb9fbd6f
6810698: G1: two small bugs in the sparse remembered sets
tonyp
parents:
2013
diff
changeset
|
288 |
RSHashTableIter::init(sprt->cur()); |
1374 | 289 |
} |
290 |
bool has_next(size_t& card_index) { |
|
291 |
return RSHashTableIter::has_next(card_index); |
|
292 |
} |
|
293 |
}; |