comparison src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @ 7181:2fc0334f613a

7194633: G1: Assertion and guarantee failures in block offset table Summary: Add detailed error messages to assertions and guarantees in G1's block offset table. Reviewed-by: ysr, brutisso
author johnc
date Tue, 27 Nov 2012 14:11:37 -0800
parents da91efe96a93
children 746b070f5022
comparison
equal deleted inserted replaced
7180:f34d701e952e 7181:2fc0334f613a
300 } 300 }
301 guarantee(_array->offset_array(start_card) == N_words, "Wrong value in second card"); 301 guarantee(_array->offset_array(start_card) == N_words, "Wrong value in second card");
302 for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) { 302 for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) {
303 u_char entry = _array->offset_array(c); 303 u_char entry = _array->offset_array(c);
304 if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) { 304 if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) {
305 guarantee(entry > N_words, "Should be in logarithmic region"); 305 guarantee(entry > N_words,
306 err_msg("Should be in logarithmic region - "
307 "entry: " UINT32_FORMAT ", "
308 "_array->offset_array(c): " UINT32_FORMAT ", "
309 "N_words: " UINT32_FORMAT,
310 entry, _array->offset_array(c), N_words));
306 } 311 }
307 size_t backskip = BlockOffsetArray::entry_to_cards_back(entry); 312 size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
308 size_t landing_card = c - backskip; 313 size_t landing_card = c - backskip;
309 guarantee(landing_card >= (start_card - 1), "Inv"); 314 guarantee(landing_card >= (start_card - 1), "Inv");
310 if (landing_card >= start_card) { 315 if (landing_card >= start_card) {
311 guarantee(_array->offset_array(landing_card) <= entry, "monotonicity"); 316 guarantee(_array->offset_array(landing_card) <= entry,
317 err_msg("Monotonicity - landing_card offset: " UINT32_FORMAT ", "
318 "entry: " UINT32_FORMAT,
319 _array->offset_array(landing_card), entry));
312 } else { 320 } else {
313 guarantee(landing_card == start_card - 1, "Tautology"); 321 guarantee(landing_card == start_card - 1, "Tautology");
314 guarantee(_array->offset_array(landing_card) <= N_words, "Offset value"); 322 // Note that N_words is the maximum offset value
323 guarantee(_array->offset_array(landing_card) <= N_words,
324 err_msg("landing card offset: " UINT32_FORMAT ", "
325 "N_words: " UINT32_FORMAT,
326 _array->offset_array(landing_card), N_words));
315 } 327 }
316 } 328 }
317 } 329 }
318 330
319 // The range [blk_start, blk_end) represents a single contiguous block 331 // The range [blk_start, blk_end) represents a single contiguous block
534 546
535 #ifdef ASSERT 547 #ifdef ASSERT
536 // The offset can be 0 if the block starts on a boundary. That 548 // The offset can be 0 if the block starts on a boundary. That
537 // is checked by an assertion above. 549 // is checked by an assertion above.
538 size_t start_index = _array->index_for(blk_start); 550 size_t start_index = _array->index_for(blk_start);
539 HeapWord* boundary = _array->address_for_index(start_index); 551 HeapWord* boundary = _array->address_for_index(start_index);
540 assert((_array->offset_array(orig_index) == 0 && 552 assert((_array->offset_array(orig_index) == 0 &&
541 blk_start == boundary) || 553 blk_start == boundary) ||
542 (_array->offset_array(orig_index) > 0 && 554 (_array->offset_array(orig_index) > 0 &&
543 _array->offset_array(orig_index) <= N_words), 555 _array->offset_array(orig_index) <= N_words),
544 "offset array should have been set"); 556 err_msg("offset array should have been set - "
557 "orig_index offset: " UINT32_FORMAT ", "
558 "blk_start: " PTR_FORMAT ", "
559 "boundary: " PTR_FORMAT,
560 _array->offset_array(orig_index),
561 blk_start, boundary));
545 for (size_t j = orig_index + 1; j <= end_index; j++) { 562 for (size_t j = orig_index + 1; j <= end_index; j++) {
546 assert(_array->offset_array(j) > 0 && 563 assert(_array->offset_array(j) > 0 &&
547 _array->offset_array(j) <= 564 _array->offset_array(j) <=
548 (u_char) (N_words+BlockOffsetArray::N_powers-1), 565 (u_char) (N_words+BlockOffsetArray::N_powers-1),
549 "offset array should have been set"); 566 err_msg("offset array should have been set - "
567 UINT32_FORMAT " not > 0 OR "
568 UINT32_FORMAT " not <= " UINT32_FORMAT,
569 _array->offset_array(j),
570 _array->offset_array(j),
571 (u_char) (N_words+BlockOffsetArray::N_powers-1)));
550 } 572 }
551 #endif 573 #endif
552 } 574 }
553 575
554 bool 576 bool