451 for (int k = 0; k < _cur_covered_regions; k++) { 452 if (_covered[k].end() == new_region.end()) { 453 assert(changed_region == k, "Changed region is incorrect"); 454 break; 455 } 456 } 457 #endif 458 459 // Commit new or uncommit old pages, if necessary. 460 if (resize_commit_uncommit(changed_region, new_region)) { 461 // Set the new start of the committed region 462 resize_update_committed_table(changed_region, new_region); 463 } 464 465 // Update card table entries 466 resize_update_card_table_entries(changed_region, new_region); 467 468 // Update the covered region 469 resize_update_covered_table(changed_region, new_region); 470 471 if (TraceCardTableModRefBS) { 472 int ind = changed_region; 473 gclog_or_tty->print_cr("CardTableModRefBS::resize_covered_region: "); 474 gclog_or_tty->print_cr(" " 475 " _covered[%d].start(): " INTPTR_FORMAT 476 " _covered[%d].last(): " INTPTR_FORMAT, 477 ind, p2i(_covered[ind].start()), 478 ind, p2i(_covered[ind].last())); 479 gclog_or_tty->print_cr(" " 480 " _committed[%d].start(): " INTPTR_FORMAT 481 " _committed[%d].last(): " INTPTR_FORMAT, 482 ind, p2i(_committed[ind].start()), 483 ind, p2i(_committed[ind].last())); 484 gclog_or_tty->print_cr(" " 485 " byte_for(start): " INTPTR_FORMAT 486 " byte_for(last): " INTPTR_FORMAT, 487 p2i(byte_for(_covered[ind].start())), 488 p2i(byte_for(_covered[ind].last()))); 489 gclog_or_tty->print_cr(" " 490 " addr_for(start): " INTPTR_FORMAT 491 " addr_for(last): " INTPTR_FORMAT, 492 p2i(addr_for((jbyte*) _committed[ind].start())), 493 p2i(addr_for((jbyte*) _committed[ind].last()))); 494 } 495 debug_only(verify_guard();) 496 } 497 498 bool CardTableExtension::resize_commit_uncommit(int changed_region, 499 MemRegion new_region) { 500 bool result = false; 501 // Commit new or uncommit old pages, if necessary. 502 MemRegion cur_committed = _committed[changed_region]; 503 assert(_covered[changed_region].end() == new_region.end(), 504 "The ends of the regions are expected to match"); 505 // Extend the start of this _committed region to 506 // to cover the start of any previous _committed region. 507 // This forms overlapping regions, but never interior regions. 508 HeapWord* min_prev_start = lowest_prev_committed_start(changed_region); 509 if (min_prev_start < cur_committed.start()) { 510 // Only really need to set start of "cur_committed" to 511 // the new start (min_prev_start) but assertion checking code 512 // below use cur_committed.end() so make it correct. 513 MemRegion new_committed = 514 MemRegion(min_prev_start, cur_committed.end()); | 451 for (int k = 0; k < _cur_covered_regions; k++) { 452 if (_covered[k].end() == new_region.end()) { 453 assert(changed_region == k, "Changed region is incorrect"); 454 break; 455 } 456 } 457 #endif 458 459 // Commit new or uncommit old pages, if necessary. 460 if (resize_commit_uncommit(changed_region, new_region)) { 461 // Set the new start of the committed region 462 resize_update_committed_table(changed_region, new_region); 463 } 464 465 // Update card table entries 466 resize_update_card_table_entries(changed_region, new_region); 467 468 // Update the covered region 469 resize_update_covered_table(changed_region, new_region); 470 471 int ind = changed_region; 472 log_trace(gc, barrier)("CardTableModRefBS::resize_covered_region: "); 473 log_trace(gc, barrier)(" _covered[%d].start(): " INTPTR_FORMAT " _covered[%d].last(): " INTPTR_FORMAT, 474 ind, p2i(_covered[ind].start()), ind, p2i(_covered[ind].last())); 475 log_trace(gc, barrier)(" _committed[%d].start(): " INTPTR_FORMAT " _committed[%d].last(): " INTPTR_FORMAT, 476 ind, p2i(_committed[ind].start()), ind, p2i(_committed[ind].last())); 477 log_trace(gc, barrier)(" byte_for(start): " INTPTR_FORMAT " byte_for(last): " INTPTR_FORMAT, 478 p2i(byte_for(_covered[ind].start())), p2i(byte_for(_covered[ind].last()))); 479 log_trace(gc, barrier)(" addr_for(start): " INTPTR_FORMAT " addr_for(last): " INTPTR_FORMAT, 480 p2i(addr_for((jbyte*) _committed[ind].start())), p2i(addr_for((jbyte*) _committed[ind].last()))); 481 482 debug_only(verify_guard();) 483 } 484 485 bool CardTableExtension::resize_commit_uncommit(int changed_region, 486 MemRegion new_region) { 487 bool result = false; 488 // Commit new or uncommit old pages, if necessary. 489 MemRegion cur_committed = _committed[changed_region]; 490 assert(_covered[changed_region].end() == new_region.end(), 491 "The ends of the regions are expected to match"); 492 // Extend the start of this _committed region to 493 // to cover the start of any previous _committed region. 494 // This forms overlapping regions, but never interior regions. 495 HeapWord* min_prev_start = lowest_prev_committed_start(changed_region); 496 if (min_prev_start < cur_committed.start()) { 497 // Only really need to set start of "cur_committed" to 498 // the new start (min_prev_start) but assertion checking code 499 // below use cur_committed.end() so make it correct. 500 MemRegion new_committed = 501 MemRegion(min_prev_start, cur_committed.end()); |