< prev index next >

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

Print this page
*** 38,10 ***
--- 38,11 ---
    _region_size_bytes_shift(ShenandoahHeapRegion::region_size_bytes_shift()),
    _map_space(space),
    _cset_map(_map_space.base() + ((uintx)heap_base >> _region_size_bytes_shift)),
    _biased_cset_map(_map_space.base()),
    _heap(heap),
+   _has_old_regions(false),
    _garbage(0),
    _used(0),
    _region_count(0),
    _current_index(0) {
  

*** 81,15 ***
  
  void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
    assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
    assert(Thread::current()->is_VM_thread(), "Must be VMThread");
    assert(!is_in(r), "Already in collection set");
    _cset_map[r->index()] = 1;
    _region_count++;
    _garbage += r->garbage();
    _used += r->used();
- 
    // Update the region status too. State transition would be checked internally.
    r->make_cset();
  }
  
  void ShenandoahCollectionSet::clear() {
--- 82,17 ---
  
  void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
    assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
    assert(Thread::current()->is_VM_thread(), "Must be VMThread");
    assert(!is_in(r), "Already in collection set");
+   assert(!r->is_humongous(), "Only add regular regions to the collection set");
+ 
    _cset_map[r->index()] = 1;
    _region_count++;
+   _has_old_regions |= r->is_old();
    _garbage += r->garbage();
    _used += r->used();
    // Update the region status too. State transition would be checked internally.
    r->make_cset();
  }
  
  void ShenandoahCollectionSet::clear() {

*** 105,10 ***
--- 108,12 ---
    _garbage = 0;
    _used = 0;
  
    _region_count = 0;
    _current_index = 0;
+ 
+   _has_old_regions = false;
  }
  
  ShenandoahHeapRegion* ShenandoahCollectionSet::claim_next() {
    // This code is optimized for the case when collection set contains only
    // a few regions. In this case, it is more constructive to check for is_in
< prev index next >