src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
changeset 55385 2c47220ce9bb
parent 55230 9775d05d69c8
child 55395 9c6d907cefac
equal deleted inserted replaced
55384:31d026474e77 55385:2c47220ce9bb
  1692         // collection set un-evacuated. Restart evacuation from the beginning to
  1692         // collection set un-evacuated. Restart evacuation from the beginning to
  1693         // capture all objects. For all the objects that are already evacuated,
  1693         // capture all objects. For all the objects that are already evacuated,
  1694         // it would be a simple check, which is supposed to be fast. This is also
  1694         // it would be a simple check, which is supposed to be fast. This is also
  1695         // safe to do even without degeneration, as CSet iterator is at beginning
  1695         // safe to do even without degeneration, as CSet iterator is at beginning
  1696         // in preparation for evacuation anyway.
  1696         // in preparation for evacuation anyway.
  1697         collection_set()->clear_current_index();
  1697         //
       
  1698         // Before doing that, we need to make sure we never had any cset-pinned
       
  1699         // regions. This may happen if allocation failure happened when evacuating
       
  1700         // the about-to-be-pinned object, oom-evac protocol left the object in
       
  1701         // the collection set, and then the pin reached the cset region. If we continue
       
  1702         // the cycle here, we would trash the cset and alive objects in it. To avoid
       
  1703         // it, we fail degeneration right away and slide into Full GC to recover.
       
  1704 
       
  1705         {
       
  1706           collection_set()->clear_current_index();
       
  1707 
       
  1708           ShenandoahHeapRegion* r;
       
  1709           while ((r = collection_set()->next()) != NULL) {
       
  1710             if (r->is_pinned()) {
       
  1711               cancel_gc(GCCause::_shenandoah_upgrade_to_full_gc);
       
  1712               op_degenerated_fail();
       
  1713               return;
       
  1714             }
       
  1715           }
       
  1716 
       
  1717           collection_set()->clear_current_index();
       
  1718         }
  1698 
  1719 
  1699         op_stw_evac();
  1720         op_stw_evac();
  1700         if (cancelled_gc()) {
  1721         if (cancelled_gc()) {
  1701           op_degenerated_fail();
  1722           op_degenerated_fail();
  1702           return;
  1723           return;