5618 assert(index == -1, "invariant");
5619 }
5620
5621 assert( (cur->is_young() && cur->young_index_in_cset() > -1) ||
5622 (!cur->is_young() && cur->young_index_in_cset() == -1),
5623 "invariant" );
5624
5625 if (!cur->evacuation_failed()) {
5626 MemRegion used_mr = cur->used_region();
5627
5628 // And the region is empty.
5629 assert(!used_mr.is_empty(), "Should not have empty regions in a CS.");
5630 pre_used += cur->used();
5631 free_region(cur, &local_free_list, false /* par */, true /* locked */);
5632 } else {
5633 cur->uninstall_surv_rate_group();
5634 if (cur->is_young()) {
5635 cur->set_young_index_in_cset(-1);
5636 }
5637 cur->set_evacuation_failed(false);
5638 // The region is now considered to be old.
5639 cur->set_old();
5640 // Do some allocation statistics accounting. Regions that failed evacuation
5641 // are always made old, so there is no need to update anything in the young
5642 // gen statistics, but we need to update old gen statistics.
5643 size_t used_words = cur->marked_bytes() / HeapWordSize;
5644 _old_evac_stats.add_failure_used_and_waste(used_words, HeapRegion::GrainWords - used_words);
5645 _old_set.add(cur);
5646 evacuation_info.increment_collectionset_used_after(cur->used());
5647 }
5648 cur = next;
5649 }
5650
5651 evacuation_info.set_regions_freed(local_free_list.length());
5652 policy->record_max_rs_lengths(rs_lengths);
5653 policy->cset_regions_freed();
5654
5655 double end_sec = os::elapsedTime();
5656 double elapsed_ms = (end_sec - start_sec) * 1000.0;
5657
|
5618 assert(index == -1, "invariant");
5619 }
5620
5621 assert( (cur->is_young() && cur->young_index_in_cset() > -1) ||
5622 (!cur->is_young() && cur->young_index_in_cset() == -1),
5623 "invariant" );
5624
5625 if (!cur->evacuation_failed()) {
5626 MemRegion used_mr = cur->used_region();
5627
5628 // And the region is empty.
5629 assert(!used_mr.is_empty(), "Should not have empty regions in a CS.");
5630 pre_used += cur->used();
5631 free_region(cur, &local_free_list, false /* par */, true /* locked */);
5632 } else {
5633 cur->uninstall_surv_rate_group();
5634 if (cur->is_young()) {
5635 cur->set_young_index_in_cset(-1);
5636 }
5637 cur->set_evacuation_failed(false);
5638 // When moving a young gen region to old gen, we "allocate" that whole region
5639 // there. This is in addition to any already evacuated objects. Notify the
5640 // policy about that.
5641 // Old gen regions do not cause an additional allocation: both the objects
5642 // still in the region and the ones already moved are accounted for elsewhere.
5643 if (cur->is_young()) {
5644 policy->add_last_old_allocated_bytes(HeapRegion::GrainBytes);
5645 }
5646 // The region is now considered to be old.
5647 cur->set_old();
5648 // Do some allocation statistics accounting. Regions that failed evacuation
5649 // are always made old, so there is no need to update anything in the young
5650 // gen statistics, but we need to update old gen statistics.
5651 size_t used_words = cur->marked_bytes() / HeapWordSize;
5652 _old_evac_stats.add_failure_used_and_waste(used_words, HeapRegion::GrainWords - used_words);
5653 _old_set.add(cur);
5654 evacuation_info.increment_collectionset_used_after(cur->used());
5655 }
5656 cur = next;
5657 }
5658
5659 evacuation_info.set_regions_freed(local_free_list.length());
5660 policy->record_max_rs_lengths(rs_lengths);
5661 policy->cset_regions_freed();
5662
5663 double end_sec = os::elapsedTime();
5664 double elapsed_ms = (end_sec - start_sec) * 1000.0;
5665
|