570 MIN2(cur_committed.end(), _guard_region.start());
571 if(new_start_aligned < new_end_for_commit) {
572 MemRegion new_committed =
573 MemRegion(new_start_aligned, new_end_for_commit);
574 os::commit_memory_or_exit((char*)new_committed.start(),
575 new_committed.byte_size(), !ExecMem,
576 "card table expansion");
577 }
578 result = true;
579 } else if (new_start_aligned > cur_committed.start()) {
580 // Shrink the committed region
581 #if 0 // uncommitting space is currently unsafe because of the interactions
582 // of growing and shrinking regions. One region A can uncommit space
583 // that it owns but which is being used by another region B (maybe).
584 // Region B has not committed the space because it was already
585 // committed by region A.
586 MemRegion uncommit_region = committed_unique_to_self(changed_region,
587 MemRegion(cur_committed.start(), new_start_aligned));
588 if (!uncommit_region.is_empty()) {
589 if (!os::uncommit_memory((char*)uncommit_region.start(),
590 uncommit_region.byte_size())) {
591 // If the uncommit fails, ignore it. Let the
592 // committed table resizing go even though the committed
593 // table will over state the committed space.
594 }
595 }
596 #else
597 assert(!result, "Should be false with current workaround");
598 #endif
599 }
600 assert(_committed[changed_region].end() == cur_committed.end(),
601 "end should not change");
602 return result;
603 }
604
605 void PSCardTable::resize_update_committed_table(int changed_region,
606 MemRegion new_region) {
607
608 CardValue* new_start = byte_for(new_region.start());
609 // Set the new start of the committed region
610 HeapWord* new_start_aligned = align_down((HeapWord*)new_start, os::vm_page_size());
|
570 MIN2(cur_committed.end(), _guard_region.start());
571 if(new_start_aligned < new_end_for_commit) {
572 MemRegion new_committed =
573 MemRegion(new_start_aligned, new_end_for_commit);
574 os::commit_memory_or_exit((char*)new_committed.start(),
575 new_committed.byte_size(), !ExecMem,
576 "card table expansion");
577 }
578 result = true;
579 } else if (new_start_aligned > cur_committed.start()) {
580 // Shrink the committed region
581 #if 0 // uncommitting space is currently unsafe because of the interactions
582 // of growing and shrinking regions. One region A can uncommit space
583 // that it owns but which is being used by another region B (maybe).
584 // Region B has not committed the space because it was already
585 // committed by region A.
586 MemRegion uncommit_region = committed_unique_to_self(changed_region,
587 MemRegion(cur_committed.start(), new_start_aligned));
588 if (!uncommit_region.is_empty()) {
589 if (!os::uncommit_memory((char*)uncommit_region.start(),
590 uncommit_region.byte_size(),
591 !ExecMem)) {
592 // If the uncommit fails, ignore it. Let the
593 // committed table resizing go even though the committed
594 // table will over state the committed space.
595 }
596 }
597 #else
598 assert(!result, "Should be false with current workaround");
599 #endif
600 }
601 assert(_committed[changed_region].end() == cur_committed.end(),
602 "end should not change");
603 return result;
604 }
605
606 void PSCardTable::resize_update_committed_table(int changed_region,
607 MemRegion new_region) {
608
609 CardValue* new_start = byte_for(new_region.start());
610 // Set the new start of the committed region
611 HeapWord* new_start_aligned = align_down((HeapWord*)new_start, os::vm_page_size());
|