333
334 if (region->is_empty()) {
335 free_regions++;
336 free += ShenandoahHeapRegion::region_size_bytes();
337 } else if (region->is_regular()) {
338 if (!region->has_live()) {
339 // We can recycle it right away and put it in the free set.
340 immediate_regions++;
341 immediate_garbage += region->garbage();
342 region->make_trash();
343 } else {
344 // This is our candidate for later consideration.
345 candidates[cand_idx]._region = region;
346 candidates[cand_idx]._garbage = region->garbage();
347 cand_idx++;
348 }
349 } else if (region->is_humongous_start()) {
350 // Reclaim humongous regions here, and count them as the immediate garbage
351 #ifdef ASSERT
352 bool reg_live = region->has_live();
353 bool bm_live = heap->is_marked_complete(oop(region->bottom() + BrooksPointer::word_size()));
354 assert(reg_live == bm_live,
355 "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: " SIZE_FORMAT,
356 BOOL_TO_STR(reg_live), BOOL_TO_STR(bm_live), region->get_live_data_words());
357 #endif
358 if (!region->has_live()) {
359 size_t reclaimed = heap->trash_humongous_region_at(region);
360 immediate_regions += reclaimed;
361 immediate_garbage += reclaimed * ShenandoahHeapRegion::region_size_bytes();
362 }
363 }
364 }
365
366 // Step 2. Process the remaining candidates, if any.
367
368 if (cand_idx > 0) {
369 choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage, free);
370 }
371
372 // Step 3. Look back at collection set, and see if it's worth it to collect,
373 // given the amount of immediately reclaimable garbage.
|
333
334 if (region->is_empty()) {
335 free_regions++;
336 free += ShenandoahHeapRegion::region_size_bytes();
337 } else if (region->is_regular()) {
338 if (!region->has_live()) {
339 // We can recycle it right away and put it in the free set.
340 immediate_regions++;
341 immediate_garbage += region->garbage();
342 region->make_trash();
343 } else {
344 // This is our candidate for later consideration.
345 candidates[cand_idx]._region = region;
346 candidates[cand_idx]._garbage = region->garbage();
347 cand_idx++;
348 }
349 } else if (region->is_humongous_start()) {
350 // Reclaim humongous regions here, and count them as the immediate garbage
351 #ifdef ASSERT
352 bool reg_live = region->has_live();
353 bool bm_live = heap->is_marked(oop(region->bottom() + BrooksPointer::word_size()));
354 assert(reg_live == bm_live,
355 "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: " SIZE_FORMAT,
356 BOOL_TO_STR(reg_live), BOOL_TO_STR(bm_live), region->get_live_data_words());
357 #endif
358 if (!region->has_live()) {
359 size_t reclaimed = heap->trash_humongous_region_at(region);
360 immediate_regions += reclaimed;
361 immediate_garbage += reclaimed * ShenandoahHeapRegion::region_size_bytes();
362 }
363 }
364 }
365
366 // Step 2. Process the remaining candidates, if any.
367
368 if (cand_idx > 0) {
369 choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage, free);
370 }
371
372 // Step 3. Look back at collection set, and see if it's worth it to collect,
373 // given the amount of immediately reclaimable garbage.
|