< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp

Print this page




 413   assert_heaplock_owned_by_current_thread();
 414   clear();
 415 
 416   for (size_t idx = 0; idx < _heap->num_regions(); idx++) {
 417     ShenandoahHeapRegion* region = _heap->get_region(idx);
 418     if (region->is_alloc_allowed() || region->is_trash()) {
 419       assert(!region->is_cset(), "Shouldn't be adding those to the free set");
 420 
 421       // Do not add regions that would surely fail allocation
 422       if (has_no_alloc_capacity(region)) continue;
 423 
 424       _capacity += alloc_capacity(region);
 425       assert(_used <= _capacity, "must not use more than we have");
 426 
 427       assert(!is_mutator_free(idx), "We are about to add it, it shouldn't be there already");
 428       _mutator_free_bitmap.set_bit(idx);
 429     }
 430   }
 431 
 432   // Evac reserve: reserve trailing space for evacuations
 433   size_t to_reserve = _heap->max_capacity() / 100 * ShenandoahEvacReserve;
 434   size_t reserved = 0;
 435 
 436   for (size_t idx = _heap->num_regions() - 1; idx > 0; idx--) {
 437     if (reserved >= to_reserve) break;
 438 
 439     ShenandoahHeapRegion* region = _heap->get_region(idx);
 440     if (_mutator_free_bitmap.at(idx) && is_empty_or_trash(region)) {
 441       _mutator_free_bitmap.clear_bit(idx);
 442       _collector_free_bitmap.set_bit(idx);
 443       size_t ac = alloc_capacity(region);
 444       _capacity -= ac;
 445       reserved += ac;
 446     }
 447   }
 448 
 449   recompute_bounds();
 450   assert_bounds();
 451 }
 452 
 453 void ShenandoahFreeSet::log_status() {




 413   assert_heaplock_owned_by_current_thread();
 414   clear();
 415 
 416   for (size_t idx = 0; idx < _heap->num_regions(); idx++) {
 417     ShenandoahHeapRegion* region = _heap->get_region(idx);
 418     if (region->is_alloc_allowed() || region->is_trash()) {
 419       assert(!region->is_cset(), "Shouldn't be adding those to the free set");
 420 
 421       // Do not add regions that would surely fail allocation
 422       if (has_no_alloc_capacity(region)) continue;
 423 
 424       _capacity += alloc_capacity(region);
 425       assert(_used <= _capacity, "must not use more than we have");
 426 
 427       assert(!is_mutator_free(idx), "We are about to add it, it shouldn't be there already");
 428       _mutator_free_bitmap.set_bit(idx);
 429     }
 430   }
 431 
 432   // Evac reserve: reserve trailing space for evacuations
 433   size_t to_reserve = ShenandoahEvacReserve * _heap->capacity() / 100;
 434   size_t reserved = 0;
 435 
 436   for (size_t idx = _heap->num_regions() - 1; idx > 0; idx--) {
 437     if (reserved >= to_reserve) break;
 438 
 439     ShenandoahHeapRegion* region = _heap->get_region(idx);
 440     if (_mutator_free_bitmap.at(idx) && is_empty_or_trash(region)) {
 441       _mutator_free_bitmap.clear_bit(idx);
 442       _collector_free_bitmap.set_bit(idx);
 443       size_t ac = alloc_capacity(region);
 444       _capacity -= ac;
 445       reserved += ac;
 446     }
 447   }
 448 
 449   recompute_bounds();
 450   assert_bounds();
 451 }
 452 
 453 void ShenandoahFreeSet::log_status() {


< prev index next >