< prev index next >

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

Print this page
rev 57619 : 8237017: Shenandoah: Remove racy assertion


1698   void reset_dead_counter();
1699 };
1700 
1701 ShenandoahEvacUpdateCleanupOopStorageRootsClosure::ShenandoahEvacUpdateCleanupOopStorageRootsClosure() :
1702   _heap(ShenandoahHeap::heap()),
1703   _mark_context(ShenandoahHeap::heap()->marking_context()),
1704   _evac_in_progress(ShenandoahHeap::heap()->is_evacuation_in_progress()),
1705   _thread(Thread::current()),
1706   _dead_counter(0) {
1707 }
1708 
1709 void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(oop* p) {
1710   const oop obj = RawAccess<>::oop_load(p);
1711   if (!CompressedOops::is_null(obj)) {
1712     if (!_mark_context->is_marked(obj)) {
1713       shenandoah_assert_correct(p, obj);
1714       oop old = Atomic::cmpxchg(p, obj, oop(NULL));
1715       if (obj == old) {
1716         _dead_counter ++;
1717       }
1718       assert(*p == NULL, "Must be");
1719     } else if (_evac_in_progress && _heap->in_collection_set(obj)) {
1720       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1721       if (resolved == obj) {
1722         resolved = _heap->evacuate_object(obj, _thread);
1723       }
1724       Atomic::cmpxchg(p, obj, resolved);
1725       assert(_heap->cancelled_gc() ||
1726              _mark_context->is_marked(resolved) && !_heap->in_collection_set(resolved),
1727              "Sanity");
1728     }
1729   }
1730 }
1731 
1732 void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(narrowOop* p) {
1733   ShouldNotReachHere();
1734 }
1735 
1736 size_t ShenandoahEvacUpdateCleanupOopStorageRootsClosure::dead_counter() const {
1737   return _dead_counter;
1738 }




1698   void reset_dead_counter();
1699 };
1700 
1701 ShenandoahEvacUpdateCleanupOopStorageRootsClosure::ShenandoahEvacUpdateCleanupOopStorageRootsClosure() :
1702   _heap(ShenandoahHeap::heap()),
1703   _mark_context(ShenandoahHeap::heap()->marking_context()),
1704   _evac_in_progress(ShenandoahHeap::heap()->is_evacuation_in_progress()),
1705   _thread(Thread::current()),
1706   _dead_counter(0) {
1707 }
1708 
1709 void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(oop* p) {
1710   const oop obj = RawAccess<>::oop_load(p);
1711   if (!CompressedOops::is_null(obj)) {
1712     if (!_mark_context->is_marked(obj)) {
1713       shenandoah_assert_correct(p, obj);
1714       oop old = Atomic::cmpxchg(p, obj, oop(NULL));
1715       if (obj == old) {
1716         _dead_counter ++;
1717       }

1718     } else if (_evac_in_progress && _heap->in_collection_set(obj)) {
1719       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1720       if (resolved == obj) {
1721         resolved = _heap->evacuate_object(obj, _thread);
1722       }
1723       Atomic::cmpxchg(p, obj, resolved);
1724       assert(_heap->cancelled_gc() ||
1725              _mark_context->is_marked(resolved) && !_heap->in_collection_set(resolved),
1726              "Sanity");
1727     }
1728   }
1729 }
1730 
1731 void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(narrowOop* p) {
1732   ShouldNotReachHere();
1733 }
1734 
1735 size_t ShenandoahEvacUpdateCleanupOopStorageRootsClosure::dead_counter() const {
1736   return _dead_counter;
1737 }


< prev index next >