Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp @ 20273:9441d22e429a
8047820: G1 Block offset table does not need to support generic Space classes
Reviewed-by: tschatzl, stefank
author | mgerdin |
---|---|
date | Wed, 25 Jun 2014 16:53:13 +0200 |
parents | 78bbf4d43a14 |
children | 6701abbc4441 |
comparison
equal
deleted
inserted
replaced
20272:e635a728f9da | 20273:9441d22e429a |
---|---|
50 // that compilers might normally perform in the case of non-G1 | 50 // that compilers might normally perform in the case of non-G1 |
51 // collectors needs to be carefully investigated prior to any such | 51 // collectors needs to be carefully investigated prior to any such |
52 // consolidation. | 52 // consolidation. |
53 | 53 |
54 // Forward declarations | 54 // Forward declarations |
55 class ContiguousSpace; | |
56 class G1BlockOffsetSharedArray; | 55 class G1BlockOffsetSharedArray; |
56 class G1OffsetTableContigSpace; | |
57 | 57 |
58 class G1BlockOffsetTable VALUE_OBJ_CLASS_SPEC { | 58 class G1BlockOffsetTable VALUE_OBJ_CLASS_SPEC { |
59 friend class VMStructs; | 59 friend class VMStructs; |
60 protected: | 60 protected: |
61 // These members describe the region covered by the table. | 61 // These members describe the region covered by the table. |
155 u_char offset_array(size_t index) const { | 155 u_char offset_array(size_t index) const { |
156 check_index(index, "index out of range"); | 156 check_index(index, "index out of range"); |
157 return _offset_array[index]; | 157 return _offset_array[index]; |
158 } | 158 } |
159 | 159 |
160 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset); | |
161 | |
160 void set_offset_array(size_t index, u_char offset) { | 162 void set_offset_array(size_t index, u_char offset) { |
161 check_index(index, "index out of range"); | 163 check_index(index, "index out of range"); |
162 check_offset(offset, "offset too large"); | 164 check_offset(offset, "offset too large"); |
163 _offset_array[index] = offset; | 165 _offset_array[index] = offset; |
164 } | 166 } |
166 void set_offset_array(size_t index, HeapWord* high, HeapWord* low) { | 168 void set_offset_array(size_t index, HeapWord* high, HeapWord* low) { |
167 check_index(index, "index out of range"); | 169 check_index(index, "index out of range"); |
168 assert(high >= low, "addresses out of order"); | 170 assert(high >= low, "addresses out of order"); |
169 check_offset(pointer_delta(high, low), "offset too large"); | 171 check_offset(pointer_delta(high, low), "offset too large"); |
170 _offset_array[index] = (u_char) pointer_delta(high, low); | 172 _offset_array[index] = (u_char) pointer_delta(high, low); |
171 } | |
172 | |
173 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { | |
174 check_index(index_for(right - 1), "right address out of range"); | |
175 assert(left < right, "Heap addresses out of order"); | |
176 size_t num_cards = pointer_delta(right, left) >> LogN_words; | |
177 if (UseMemSetInBOT) { | |
178 memset(&_offset_array[index_for(left)], offset, num_cards); | |
179 } else { | |
180 size_t i = index_for(left); | |
181 const size_t end = i + num_cards; | |
182 for (; i < end; i++) { | |
183 _offset_array[i] = offset; | |
184 } | |
185 } | |
186 } | 173 } |
187 | 174 |
188 void set_offset_array(size_t left, size_t right, u_char offset) { | 175 void set_offset_array(size_t left, size_t right, u_char offset) { |
189 check_index(right, "right index out of range"); | 176 check_index(right, "right index out of range"); |
190 assert(left <= right, "indexes out of order"); | 177 assert(left <= right, "indexes out of order"); |
279 // This is the array, which can be shared by several BlockOffsetArray's | 266 // This is the array, which can be shared by several BlockOffsetArray's |
280 // servicing different | 267 // servicing different |
281 G1BlockOffsetSharedArray* _array; | 268 G1BlockOffsetSharedArray* _array; |
282 | 269 |
283 // The space that owns this subregion. | 270 // The space that owns this subregion. |
284 Space* _sp; | 271 G1OffsetTableContigSpace* _gsp; |
285 | |
286 // If "_sp" is a contiguous space, the field below is the view of "_sp" | |
287 // as a contiguous space, else NULL. | |
288 ContiguousSpace* _csp; | |
289 | 272 |
290 // If true, array entries are initialized to 0; otherwise, they are | 273 // If true, array entries are initialized to 0; otherwise, they are |
291 // initialized to point backwards to the beginning of the covered region. | 274 // initialized to point backwards to the beginning of the covered region. |
292 bool _init_to_zero; | 275 bool _init_to_zero; |
293 | 276 |
308 // A helper function for BOT adjustment/verification work | 291 // A helper function for BOT adjustment/verification work |
309 void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, Action action); | 292 void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, Action action); |
310 | 293 |
311 protected: | 294 protected: |
312 | 295 |
313 ContiguousSpace* csp() const { return _csp; } | 296 G1OffsetTableContigSpace* gsp() const { return _gsp; } |
297 | |
298 inline size_t block_size(const HeapWord* p) const; | |
314 | 299 |
315 // Returns the address of a block whose start is at most "addr". | 300 // Returns the address of a block whose start is at most "addr". |
316 // If "has_max_index" is true, "assumes "max_index" is the last valid one | 301 // If "has_max_index" is true, "assumes "max_index" is the last valid one |
317 // in the array. | 302 // in the array. |
318 inline HeapWord* block_at_or_preceding(const void* addr, | 303 inline HeapWord* block_at_or_preceding(const void* addr, |
361 | 346 |
362 // Note: this ought to be part of the constructor, but that would require | 347 // Note: this ought to be part of the constructor, but that would require |
363 // "this" to be passed as a parameter to a member constructor for | 348 // "this" to be passed as a parameter to a member constructor for |
364 // the containing concrete subtype of Space. | 349 // the containing concrete subtype of Space. |
365 // This would be legal C++, but MS VC++ doesn't allow it. | 350 // This would be legal C++, but MS VC++ doesn't allow it. |
366 void set_space(Space* sp); | 351 void set_space(G1OffsetTableContigSpace* sp); |
367 | 352 |
368 // Resets the covered region to the given "mr". | 353 // Resets the covered region to the given "mr". |
369 void set_region(MemRegion mr); | 354 void set_region(MemRegion mr); |
370 | 355 |
371 // Resets the covered region to one with the same _bottom as before but | 356 // Resets the covered region to one with the same _bottom as before but |