comparison src/share/vm/memory/cardTableModRefBS.hpp @ 3359:7d64aa23eb96

7043891: CMS: assert(_whole_heap.contains(p)) failed: out of bounds access to card marking array Summary: Fixed assertion checking code that was attempting to translate addresses past end of space for card-table slot. Also elaborated some assertion checking messages. Reviewed-by: iveresov, jmasa, tonyp
author ysr
date Wed, 11 May 2011 15:47:12 -0700
parents fc2b798ab316
children ea640b5e949a
comparison
equal deleted inserted replaced
3358:97b64f73103b 3359:7d64aa23eb96
148 MemRegion committed_unique_to_self(int self, MemRegion mr) const; 148 MemRegion committed_unique_to_self(int self, MemRegion mr) const;
149 149
150 // Mapping from address to card marking array entry 150 // Mapping from address to card marking array entry
151 jbyte* byte_for(const void* p) const { 151 jbyte* byte_for(const void* p) const {
152 assert(_whole_heap.contains(p), 152 assert(_whole_heap.contains(p),
153 "out of bounds access to card marking array"); 153 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
154 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
155 p, _whole_heap.start(), _whole_heap.end()));
154 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; 156 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
155 assert(result >= _byte_map && result < _byte_map + _byte_map_size, 157 assert(result >= _byte_map && result < _byte_map + _byte_map_size,
156 "out of bounds accessor for card marking array"); 158 "out of bounds accessor for card marking array");
157 return result; 159 return result;
158 } 160 }
449 assert(p >= _byte_map && p < _byte_map + _byte_map_size, 451 assert(p >= _byte_map && p < _byte_map + _byte_map_size,
450 "out of bounds access to card marking array"); 452 "out of bounds access to card marking array");
451 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); 453 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
452 HeapWord* result = (HeapWord*) (delta << card_shift); 454 HeapWord* result = (HeapWord*) (delta << card_shift);
453 assert(_whole_heap.contains(result), 455 assert(_whole_heap.contains(result),
454 "out of bounds accessor from card marking array"); 456 err_msg("Returning result = "PTR_FORMAT" out of bounds of "
457 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
458 result, _whole_heap.start(), _whole_heap.end()));
455 return result; 459 return result;
456 } 460 }
457 461
458 // Mapping from address to card marking array index. 462 // Mapping from address to card marking array index.
459 size_t index_for(void* p) { 463 size_t index_for(void* p) {
460 assert(_whole_heap.contains(p), 464 assert(_whole_heap.contains(p),
461 "out of bounds access to card marking array"); 465 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
466 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
467 p, _whole_heap.start(), _whole_heap.end()));
462 return byte_for(p) - _byte_map; 468 return byte_for(p) - _byte_map;
463 } 469 }
464 470
465 const jbyte* byte_for_index(const size_t card_index) const { 471 const jbyte* byte_for_index(const size_t card_index) const {
466 return _byte_map + card_index; 472 return _byte_map + card_index;