138
139 // Resize one of the regions covered by the remembered set.
140 void resize_covered_region(MemRegion new_region);
141
142 // Returns the leftmost end of a committed region corresponding to a
143 // covered region before covered region "ind", or else "NULL" if "ind" is
144 // the first covered region.
145 HeapWord* largest_prev_committed_end(int ind) const;
146
147 // Returns the part of the region mr that doesn't intersect with
148 // any committed region other than self. Used to prevent uncommitting
149 // regions that are also committed by other regions. Also protects
150 // against uncommitting the guard region.
151 MemRegion committed_unique_to_self(int self, MemRegion mr) const;
152
153 // Mapping from address to card marking array entry
154 jbyte* byte_for(const void* p) const {
155 assert(_whole_heap.contains(p),
156 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
157 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
158 p, _whole_heap.start(), _whole_heap.end()));
159 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
160 assert(result >= _byte_map && result < _byte_map + _byte_map_size,
161 "out of bounds accessor for card marking array");
162 return result;
163 }
164
165 // The card table byte one after the card marking array
166 // entry for argument address. Typically used for higher bounds
167 // for loops iterating through the card table.
168 jbyte* byte_after(const void* p) const {
169 return byte_for(p) + 1;
170 }
171
172 // Iterate over the portion of the card-table which covers the given
173 // region mr in the given space and apply cl to any dirty sub-regions
174 // of mr. Dirty cards are _not_ cleared by the iterator method itself,
175 // but closures may arrange to do so on their own should they so wish.
176 void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl);
177
178 // A variant of the above that will operate in a parallel mode if
414 MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset,
415 int reset_val);
416
417 // Provide read-only access to the card table array.
418 const jbyte* byte_for_const(const void* p) const {
419 return byte_for(p);
420 }
421 const jbyte* byte_after_const(const void* p) const {
422 return byte_after(p);
423 }
424
425 // Mapping from card marking array entry to address of first word
426 HeapWord* addr_for(const jbyte* p) const {
427 assert(p >= _byte_map && p < _byte_map + _byte_map_size,
428 "out of bounds access to card marking array");
429 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
430 HeapWord* result = (HeapWord*) (delta << card_shift);
431 assert(_whole_heap.contains(result),
432 err_msg("Returning result = "PTR_FORMAT" out of bounds of "
433 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
434 result, _whole_heap.start(), _whole_heap.end()));
435 return result;
436 }
437
438 // Mapping from address to card marking array index.
439 size_t index_for(void* p) {
440 assert(_whole_heap.contains(p),
441 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
442 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
443 p, _whole_heap.start(), _whole_heap.end()));
444 return byte_for(p) - _byte_map;
445 }
446
447 const jbyte* byte_for_index(const size_t card_index) const {
448 return _byte_map + card_index;
449 }
450
451 // Print a description of the memory for the barrier set
452 virtual void print_on(outputStream* st) const;
453
454 void verify();
455 void verify_guard();
456
457 // val_equals -> it will check that all cards covered by mr equal val
458 // !val_equals -> it will check that all cards covered by mr do not equal val
459 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
460 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
461 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
462
463 static size_t par_chunk_heapword_alignment() {
|
138
139 // Resize one of the regions covered by the remembered set.
140 void resize_covered_region(MemRegion new_region);
141
142 // Returns the leftmost end of a committed region corresponding to a
143 // covered region before covered region "ind", or else "NULL" if "ind" is
144 // the first covered region.
145 HeapWord* largest_prev_committed_end(int ind) const;
146
147 // Returns the part of the region mr that doesn't intersect with
148 // any committed region other than self. Used to prevent uncommitting
149 // regions that are also committed by other regions. Also protects
150 // against uncommitting the guard region.
151 MemRegion committed_unique_to_self(int self, MemRegion mr) const;
152
153 // Mapping from address to card marking array entry
154 jbyte* byte_for(const void* p) const {
155 assert(_whole_heap.contains(p),
156 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
157 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
158 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
159 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
160 assert(result >= _byte_map && result < _byte_map + _byte_map_size,
161 "out of bounds accessor for card marking array");
162 return result;
163 }
164
165 // The card table byte one after the card marking array
166 // entry for argument address. Typically used for higher bounds
167 // for loops iterating through the card table.
168 jbyte* byte_after(const void* p) const {
169 return byte_for(p) + 1;
170 }
171
172 // Iterate over the portion of the card-table which covers the given
173 // region mr in the given space and apply cl to any dirty sub-regions
174 // of mr. Dirty cards are _not_ cleared by the iterator method itself,
175 // but closures may arrange to do so on their own should they so wish.
176 void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl);
177
178 // A variant of the above that will operate in a parallel mode if
414 MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset,
415 int reset_val);
416
417 // Provide read-only access to the card table array.
418 const jbyte* byte_for_const(const void* p) const {
419 return byte_for(p);
420 }
421 const jbyte* byte_after_const(const void* p) const {
422 return byte_after(p);
423 }
424
425 // Mapping from card marking array entry to address of first word
426 HeapWord* addr_for(const jbyte* p) const {
427 assert(p >= _byte_map && p < _byte_map + _byte_map_size,
428 "out of bounds access to card marking array");
429 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
430 HeapWord* result = (HeapWord*) (delta << card_shift);
431 assert(_whole_heap.contains(result),
432 err_msg("Returning result = "PTR_FORMAT" out of bounds of "
433 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
434 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
435 return result;
436 }
437
438 // Mapping from address to card marking array index.
439 size_t index_for(void* p) {
440 assert(_whole_heap.contains(p),
441 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
442 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
443 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
444 return byte_for(p) - _byte_map;
445 }
446
447 const jbyte* byte_for_index(const size_t card_index) const {
448 return _byte_map + card_index;
449 }
450
451 // Print a description of the memory for the barrier set
452 virtual void print_on(outputStream* st) const;
453
454 void verify();
455 void verify_guard();
456
457 // val_equals -> it will check that all cards covered by mr equal val
458 // !val_equals -> it will check that all cards covered by mr do not equal val
459 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
460 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
461 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
462
463 static size_t par_chunk_heapword_alignment() {
|