109 // instead of starting at a given base address. 110 int find_covering_region_containing(HeapWord* addr); 111 112 // Resize one of the regions covered by the remembered set. 113 virtual void resize_covered_region(MemRegion new_region); 114 115 // Returns the leftmost end of a committed region corresponding to a 116 // covered region before covered region "ind", or else "NULL" if "ind" is 117 // the first covered region. 118 HeapWord* largest_prev_committed_end(int ind) const; 119 120 // Returns the part of the region mr that doesn't intersect with 121 // any committed region other than self. Used to prevent uncommitting 122 // regions that are also committed by other regions. Also protects 123 // against uncommitting the guard region. 124 MemRegion committed_unique_to_self(int self, MemRegion mr) const; 125 126 // Mapping from address to card marking array entry 127 jbyte* byte_for(const void* p) const { 128 assert(_whole_heap.contains(p), 129 err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " 130 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 131 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); 132 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; 133 assert(result >= _byte_map && result < _byte_map + _byte_map_size, 134 "out of bounds accessor for card marking array"); 135 return result; 136 } 137 138 // The card table byte one after the card marking array 139 // entry for argument address. Typically used for higher bounds 140 // for loops iterating through the card table. 141 jbyte* byte_after(const void* p) const { 142 return byte_for(p) + 1; 143 } 144 145 protected: 146 // Dirty the bytes corresponding to "mr" (not all of which must be 147 // covered.) 148 void dirty_MemRegion(MemRegion mr); 149 150 // Clear (to clean_card) the bytes entirely contained within "mr" (not 151 // all of which must be covered.) 277 // If reset is "true", then sets those card table entries to the given 278 // value. 279 MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset, 280 int reset_val); 281 282 // Provide read-only access to the card table array. 283 const jbyte* byte_for_const(const void* p) const { 284 return byte_for(p); 285 } 286 const jbyte* byte_after_const(const void* p) const { 287 return byte_after(p); 288 } 289 290 // Mapping from card marking array entry to address of first word 291 HeapWord* addr_for(const jbyte* p) const { 292 assert(p >= _byte_map && p < _byte_map + _byte_map_size, 293 "out of bounds access to card marking array"); 294 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); 295 HeapWord* result = (HeapWord*) (delta << card_shift); 296 assert(_whole_heap.contains(result), 297 err_msg("Returning result = " PTR_FORMAT " out of bounds of " 298 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 299 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); 300 return result; 301 } 302 303 // Mapping from address to card marking array index. 304 size_t index_for(void* p) { 305 assert(_whole_heap.contains(p), 306 err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " 307 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 308 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); 309 return byte_for(p) - _byte_map; 310 } 311 312 const jbyte* byte_for_index(const size_t card_index) const { 313 return _byte_map + card_index; 314 } 315 316 // Print a description of the memory for the barrier set 317 virtual void print_on(outputStream* st) const; 318 319 void verify(); 320 void verify_guard(); 321 322 // val_equals -> it will check that all cards covered by mr equal val 323 // !val_equals -> it will check that all cards covered by mr do not equal val 324 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; 325 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; 326 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; 327 }; 328 | 109 // instead of starting at a given base address. 110 int find_covering_region_containing(HeapWord* addr); 111 112 // Resize one of the regions covered by the remembered set. 113 virtual void resize_covered_region(MemRegion new_region); 114 115 // Returns the leftmost end of a committed region corresponding to a 116 // covered region before covered region "ind", or else "NULL" if "ind" is 117 // the first covered region. 118 HeapWord* largest_prev_committed_end(int ind) const; 119 120 // Returns the part of the region mr that doesn't intersect with 121 // any committed region other than self. Used to prevent uncommitting 122 // regions that are also committed by other regions. Also protects 123 // against uncommitting the guard region. 124 MemRegion committed_unique_to_self(int self, MemRegion mr) const; 125 126 // Mapping from address to card marking array entry 127 jbyte* byte_for(const void* p) const { 128 assert(_whole_heap.contains(p), 129 "Attempt to access p = " PTR_FORMAT " out of bounds of " 130 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 131 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())); 132 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; 133 assert(result >= _byte_map && result < _byte_map + _byte_map_size, 134 "out of bounds accessor for card marking array"); 135 return result; 136 } 137 138 // The card table byte one after the card marking array 139 // entry for argument address. Typically used for higher bounds 140 // for loops iterating through the card table. 141 jbyte* byte_after(const void* p) const { 142 return byte_for(p) + 1; 143 } 144 145 protected: 146 // Dirty the bytes corresponding to "mr" (not all of which must be 147 // covered.) 148 void dirty_MemRegion(MemRegion mr); 149 150 // Clear (to clean_card) the bytes entirely contained within "mr" (not 151 // all of which must be covered.) 277 // If reset is "true", then sets those card table entries to the given 278 // value. 279 MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset, 280 int reset_val); 281 282 // Provide read-only access to the card table array. 283 const jbyte* byte_for_const(const void* p) const { 284 return byte_for(p); 285 } 286 const jbyte* byte_after_const(const void* p) const { 287 return byte_after(p); 288 } 289 290 // Mapping from card marking array entry to address of first word 291 HeapWord* addr_for(const jbyte* p) const { 292 assert(p >= _byte_map && p < _byte_map + _byte_map_size, 293 "out of bounds access to card marking array"); 294 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); 295 HeapWord* result = (HeapWord*) (delta << card_shift); 296 assert(_whole_heap.contains(result), 297 "Returning result = " PTR_FORMAT " out of bounds of " 298 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 299 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())); 300 return result; 301 } 302 303 // Mapping from address to card marking array index. 304 size_t index_for(void* p) { 305 assert(_whole_heap.contains(p), 306 "Attempt to access p = " PTR_FORMAT " out of bounds of " 307 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", 308 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())); 309 return byte_for(p) - _byte_map; 310 } 311 312 const jbyte* byte_for_index(const size_t card_index) const { 313 return _byte_map + card_index; 314 } 315 316 // Print a description of the memory for the barrier set 317 virtual void print_on(outputStream* st) const; 318 319 void verify(); 320 void verify_guard(); 321 322 // val_equals -> it will check that all cards covered by mr equal val 323 // !val_equals -> it will check that all cards covered by mr do not equal val 324 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; 325 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; 326 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; 327 }; 328 |