< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp

Print this page
rev 50076 : Fold Partial GC into Traversal GC

*** 26,66 **** #include "gc/shared/markBitMap.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "memory/iterator.inline.hpp" #include "oops/oop.inline.hpp" ! template <class T, bool STRING_DEDUP, bool DEGEN> ! void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, ShenandoahStrDedupQueue* dq) { T o = RawAccess<>::oop_load(p); if (!CompressedOops::is_null(o)) { oop obj = CompressedOops::decode_not_null(o); if (DEGEN) { oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); if (!oopDesc::unsafe_equals(obj, forw)) { // Update reference. RawAccess<OOP_NOT_NULL>::oop_store(p, forw); } obj = forw; } else if (_heap->in_collection_set(obj)) { oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); if (oopDesc::unsafe_equals(obj, forw)) { ! bool evacuated = false; ! forw = _heap->evacuate_object(obj, thread, evacuated); } ! assert(! oopDesc::unsafe_equals(obj, forw) || _heap->cancelled_concgc() || _heap->is_degenerated_gc_in_progress(), "must be evacuated"); // Update reference. ! _heap->atomic_compare_exchange_oop(forw, p, obj); obj = forw; } ! if (!_heap->is_marked_next(obj) && _heap->mark_next(obj)) { bool succeeded = queue->push(ShenandoahMarkTask(obj)); assert(succeeded, "must succeed to push to task queue"); if (STRING_DEDUP && ShenandoahStringDedup::is_candidate(obj) && !_heap->cancelled_concgc()) { assert(ShenandoahStringDedup::is_enabled(), "Must be enabled"); --- 26,84 ---- #include "gc/shared/markBitMap.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" + #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "memory/iterator.inline.hpp" #include "oops/oop.inline.hpp" ! template <class T, bool STRING_DEDUP, bool DEGEN, bool UPDATE_MATRIX> ! void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, oop base_obj, ShenandoahStrDedupQueue* dq) { T o = RawAccess<>::oop_load(p); if (!CompressedOops::is_null(o)) { oop obj = CompressedOops::decode_not_null(o); + bool update_matrix = true; if (DEGEN) { oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); if (!oopDesc::unsafe_equals(obj, forw)) { // Update reference. RawAccess<OOP_NOT_NULL>::oop_store(p, forw); } obj = forw; } else if (_heap->in_collection_set(obj)) { oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); if (oopDesc::unsafe_equals(obj, forw)) { ! forw = _heap->evacuate_object(obj, thread); } ! // tty->print_cr("NORMAL visit: "PTR_FORMAT", obj: "PTR_FORMAT" to "PTR_FORMAT, p2i(p), p2i(obj), p2i(forw)); ! assert(! oopDesc::unsafe_equals(obj, forw) || _heap->cancelled_concgc(), "must be evacuated"); // Update reference. ! oop previous = _heap->atomic_compare_exchange_oop(forw, p, obj); ! if (UPDATE_MATRIX && !oopDesc::unsafe_equals(previous, obj)) { ! update_matrix = false; ! } obj = forw; } ! if (UPDATE_MATRIX && update_matrix) { ! shenandoah_assert_not_forwarded_except(p, obj, _heap->cancelled_concgc()); ! const void* src; ! if (!_heap->is_in_reserved(p)) { ! src = (const void*)(HeapWord*) obj; ! } else { ! src = p; ! } ! if (src != NULL) { ! _matrix->set_connected(src, obj); ! } ! } ! ! if (_traversal_set->is_in((HeapWord*) obj) && !_heap->is_marked_next(obj) && _heap->mark_next(obj)) { bool succeeded = queue->push(ShenandoahMarkTask(obj)); assert(succeeded, "must succeed to push to task queue"); if (STRING_DEDUP && ShenandoahStringDedup::is_candidate(obj) && !_heap->cancelled_concgc()) { assert(ShenandoahStringDedup::is_enabled(), "Must be enabled");
< prev index next >