< prev index next >

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

Print this page
rev 53044 : Concurrent stringtable processing

*** 22,34 **** --- 22,38 ---- */ #include "precompiled.hpp" #include "memory/allocation.hpp" + #include "classfile/stringTable.hpp" + #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/memAllocator.hpp" + #include "gc/shared/oopStorage.hpp" + #include "gc/shared/oopStorageParState.inline.hpp" #include "gc/shared/parallelCleaning.hpp" #include "gc/shared/plab.hpp" #include "gc/shenandoah/brooksPointer.hpp" #include "gc/shenandoah/shenandoahAllocTracker.hpp"
*** 876,897 **** --- 880,936 ---- _heap->evacuate_object(p, _thread); } } }; + class ShenandoahUnlinkAndUpdateStringTableClosure : public OopClosure { + private: + ShenandoahHeap* const _heap; + ShenandoahMarkingContext* const _ctx; + Thread* const _thread; + + template <typename T> + inline void do_oop_work(T* p) { + T o = RawAccess<>::oop_load(p); + if (!CompressedOops::is_null(o)) { + oop obj = CompressedOops::decode_not_null(o); + if (_ctx->is_marked(obj)) { + if (_heap->in_collection_set(obj)) { + oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); + if (oopDesc::equals_raw(resolved, obj)) { + resolved = _heap->evacuate_object(obj, _thread); + } + RawAccess<IS_NOT_NULL>::oop_store(p, resolved); + } + } else { + RawAccess<>::oop_store(p, (oop) NULL); + } + } + } + public: + ShenandoahUnlinkAndUpdateStringTableClosure() : + _heap(ShenandoahHeap::heap()), + _ctx(ShenandoahHeap::heap()->complete_marking_context()), + _thread(Thread::current()) {} + virtual void do_oop(oop* p) { do_oop_work(p); } + virtual void do_oop(narrowOop* p) { do_oop_work(p); } + }; + class ShenandoahEvacuationTask : public AbstractGangTask { private: ShenandoahHeap* const _sh; ShenandoahCollectionSet* const _cs; + OopStorage::ParState<true /* concurrent */, false /* is_const */> _string_table; bool _concurrent; public: ShenandoahEvacuationTask(ShenandoahHeap* sh, ShenandoahCollectionSet* cs, bool concurrent) : AbstractGangTask("Parallel Evacuation Task"), _sh(sh), _cs(cs), + _string_table(StringTable::weak_storage()), _concurrent(concurrent) {} void work(uint worker_id) { if (_concurrent) {
*** 906,915 **** --- 945,957 ---- } } private: void do_work() { + ShenandoahUnlinkAndUpdateStringTableClosure stcl; + _string_table.oops_do(&stcl); + ShenandoahConcurrentEvacuateRegionObjectClosure cl(_sh); ShenandoahHeapRegion* r; while ((r =_cs->claim_next()) != NULL) { assert(r->has_live(), "all-garbage regions are reclaimed early"); _sh->marked_object_iterate(r, &cl);
*** 1441,1450 **** --- 1483,1493 ---- if (ShenandoahVerify) { verifier()->verify_before_evacuation(); } + set_refcleaning_in_progress(true); set_evacuation_in_progress(true); // From here on, we need to update references. set_has_forwarded_objects(true); evacuate_and_update_roots();
*** 1478,1487 **** --- 1521,1531 ---- void ShenandoahHeap::op_final_evac() { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at safepoint"); set_evacuation_in_progress(false); + set_refcleaning_in_progress(false); retire_and_reset_gclabs(); if (ShenandoahVerify) { verifier()->verify_after_evacuation();
*** 1895,1904 **** --- 1939,1952 ---- void ShenandoahHeap::set_has_forwarded_objects(bool cond) { set_gc_state_mask(HAS_FORWARDED, cond); } + void ShenandoahHeap::set_refcleaning_in_progress(bool in_progress) { + set_gc_state_mask(REFCLEANING, in_progress); + } + void ShenandoahHeap::set_process_references(bool pr) { _process_references.set_cond(pr); } void ShenandoahHeap::set_unload_classes(bool uc) {
*** 2062,2071 **** --- 2110,2120 ---- void ShenandoahHeap::op_init_updaterefs() { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "must be at safepoint"); set_evacuation_in_progress(false); + set_refcleaning_in_progress(false); retire_and_reset_gclabs(); if (ShenandoahVerify) { verifier()->verify_before_updaterefs();
< prev index next >