335 // means moving them into the fully empty regions. |
335 // means moving them into the fully empty regions. |
336 if (from_region->is_empty()) break; |
336 if (from_region->is_empty()) break; |
337 |
337 |
338 // Can move the region, and this is not the humongous region. Humongous |
338 // Can move the region, and this is not the humongous region. Humongous |
339 // moves are special cased here, because their moves are handled separately. |
339 // moves are special cased here, because their moves are handled separately. |
340 if (from_region->is_move_allowed() && !from_region->is_humongous()) break; |
340 if (from_region->is_stw_move_allowed() && !from_region->is_humongous()) break; |
341 |
341 |
342 from_region = _heap_regions.next(); |
342 from_region = _heap_regions.next(); |
343 } |
343 } |
344 |
344 |
345 if (from_region != NULL) { |
345 if (from_region != NULL) { |
346 assert(slice != NULL, "sanity"); |
346 assert(slice != NULL, "sanity"); |
347 assert(!from_region->is_humongous(), "this path cannot handle humongous regions"); |
347 assert(!from_region->is_humongous(), "this path cannot handle humongous regions"); |
348 assert(from_region->is_empty() || from_region->is_move_allowed(), "only regions that can be moved in mark-compact"); |
348 assert(from_region->is_empty() || from_region->is_stw_move_allowed(), "only regions that can be moved in mark-compact"); |
349 slice->add_region(from_region); |
349 slice->add_region(from_region); |
350 } |
350 } |
351 |
351 |
352 return from_region; |
352 return from_region; |
353 } |
353 } |
417 // To-region candidate: record this, and continue scan |
417 // To-region candidate: record this, and continue scan |
418 to_begin = r->region_number(); |
418 to_begin = r->region_number(); |
419 continue; |
419 continue; |
420 } |
420 } |
421 |
421 |
422 if (r->is_humongous_start() && r->is_move_allowed()) { |
422 if (r->is_humongous_start() && r->is_stw_move_allowed()) { |
423 // From-region candidate: movable humongous region |
423 // From-region candidate: movable humongous region |
424 oop old_obj = oop(r->bottom()); |
424 oop old_obj = oop(r->bottom()); |
425 size_t words_size = old_obj->size(); |
425 size_t words_size = old_obj->size(); |
426 size_t num_regions = ShenandoahHeapRegion::required_regions(words_size * HeapWordSize); |
426 size_t num_regions = ShenandoahHeapRegion::required_regions(words_size * HeapWordSize); |
427 |
427 |
759 size_t old_start = r->region_number(); |
759 size_t old_start = r->region_number(); |
760 size_t old_end = old_start + num_regions - 1; |
760 size_t old_end = old_start + num_regions - 1; |
761 size_t new_start = heap->heap_region_index_containing(old_obj->forwardee()); |
761 size_t new_start = heap->heap_region_index_containing(old_obj->forwardee()); |
762 size_t new_end = new_start + num_regions - 1; |
762 size_t new_end = new_start + num_regions - 1; |
763 assert(old_start != new_start, "must be real move"); |
763 assert(old_start != new_start, "must be real move"); |
764 assert (r->is_move_allowed(), "should be movable"); |
764 assert(r->is_stw_move_allowed(), "Region " SIZE_FORMAT " should be movable", r->region_number()); |
765 |
765 |
766 Copy::aligned_conjoint_words(heap->get_region(old_start)->bottom(), |
766 Copy::aligned_conjoint_words(heap->get_region(old_start)->bottom(), |
767 heap->get_region(new_start)->bottom(), |
767 heap->get_region(new_start)->bottom(), |
768 ShenandoahHeapRegion::region_size_words()*num_regions); |
768 ShenandoahHeapRegion::region_size_words()*num_regions); |
769 |
769 |