--- old/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp 2017-09-06 11:31:59.842533882 -0400 +++ new/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp 2017-09-06 11:31:59.583322105 -0400 @@ -1553,9 +1553,6 @@ assert(_collectorState != Idling || _modUnionTable.isAllClear(), "_modUnionTable should be clear if the baton was not passed"); _modUnionTable.clear_all(); - assert(_collectorState != Idling || _ct->klass_rem_set()->mod_union_is_clear(), - "mod union for klasses should be clear if the baton was passed"); - _ct->klass_rem_set()->clear_mod_union(); // We must adjust the allocation statistics being maintained // in the free list space. We do so by reading and clearing @@ -2020,14 +2017,6 @@ bool duringMarking = _collectorState >= Marking && _collectorState < Sweeping; - // The young collections clear the modified oops state, which tells if - // there are any modified oops in the class. The remark phase also needs - // that information. Tell the young collection to save the union of all - // modified klasses. - if (duringMarking) { - _ct->klass_rem_set()->set_accumulate_modified_oops(true); - } - bool registerClosure = duringMarking; _cmsGen->gc_prologue_work(full, registerClosure, &_modUnionClosurePar); @@ -2101,8 +2090,6 @@ assert(haveFreelistLocks(), "must have freelist locks"); assert_lock_strong(bitMapLock()); - _ct->klass_rem_set()->set_accumulate_modified_oops(false); - _cmsGen->gc_epilogue_work(full); if (_collectorState == AbortablePreclean || _collectorState == Precleaning) { @@ -2380,21 +2367,6 @@ } } -class VerifyKlassOopsKlassClosure : public KlassClosure { - class VerifyKlassOopsClosure : public OopClosure { - CMSBitMap* _bitmap; - public: - VerifyKlassOopsClosure(CMSBitMap* bitmap) : _bitmap(bitmap) { } - void do_oop(oop* p) { guarantee(*p == NULL || _bitmap->isMarked((HeapWord*) *p), "Should be marked"); } - void do_oop(narrowOop* p) { ShouldNotReachHere(); } - } _oop_closure; - public: - VerifyKlassOopsKlassClosure(CMSBitMap* bitmap) : _oop_closure(bitmap) {} - void do_klass(Klass* k) { - k->oops_do(&_oop_closure); - } -}; - void CMSCollector::verify_after_remark_work_2() { ResourceMark rm; HandleMark hm; @@ -2437,9 +2409,6 @@ assert(verification_mark_stack()->isEmpty(), "Should have been drained"); verify_work_stacks_empty(); - VerifyKlassOopsKlassClosure verify_klass_oops(verification_mark_bm()); - ClassLoaderDataGraph::classes_do(&verify_klass_oops); - // Marking completed -- now verify that each bit marked in // verification_mark_bm() is also marked in markBitMap(); flag all // errors by printing corresponding objects. @@ -2911,8 +2880,6 @@ " or no bits are set in the gc_prologue before the start of the next " "subsequent marking phase."); - assert(_ct->klass_rem_set()->mod_union_is_clear(), "Must be"); - // Save the end of the used_region of the constituent generations // to be used to limit the extent of sweep in each generation. save_sweep_limits(); @@ -3848,8 +3815,6 @@ } } - preclean_klasses(&mrias_cl, _cmsGen->freelistLock()); - curNumCards = preclean_card_table(_cmsGen, &smoac_cl); cumNumCards += curNumCards; log_trace(gc)(" (cardTable: " SIZE_FORMAT " cards, re-scanned " SIZE_FORMAT " cards, " SIZE_FORMAT " iterations)", @@ -4067,34 +4032,6 @@ return cumNumDirtyCards; } -class PrecleanKlassClosure : public KlassClosure { - KlassToOopClosure _cm_klass_closure; - public: - PrecleanKlassClosure(OopClosure* oop_closure) : _cm_klass_closure(oop_closure) {} - void do_klass(Klass* k) { - if (k->has_accumulated_modified_oops()) { - k->clear_accumulated_modified_oops(); - - _cm_klass_closure.do_klass(k); - } - } -}; - -// The freelist lock is needed to prevent asserts, is it really needed? -void CMSCollector::preclean_klasses(MarkRefsIntoAndScanClosure* cl, Mutex* freelistLock) { - - cl->set_freelistLock(freelistLock); - - CMSTokenSyncWithLocks ts(true, freelistLock, bitMapLock()); - - // SSS: Add equivalent to ScanMarkedObjectsAgainCarefullyClosure::do_yield_check and should_abort_preclean? - // SSS: We should probably check if precleaning should be aborted, at suitable intervals? - PrecleanKlassClosure preclean_klass_closure(cl); - ClassLoaderDataGraph::classes_do(&preclean_klass_closure); - - verify_work_stacks_empty(); - verify_overflow_empty(); -} void CMSCollector::checkpointRootsFinal() { assert(_collectorState == FinalMarking, "incorrect state transition?"); @@ -4250,8 +4187,6 @@ // Call isAllClear() under bitMapLock assert(_modUnionTable.isAllClear(), "Should be clear by end of the final marking"); - assert(_ct->klass_rem_set()->mod_union_is_clear(), - "Should be clear by end of the final marking"); } void CMSParInitialMarkTask::work(uint worker_id) { @@ -4332,28 +4267,6 @@ void do_work_steal(int i, ParMarkRefsIntoAndScanClosure* cl, int* seed); }; -class RemarkKlassClosure : public KlassClosure { - KlassToOopClosure _cm_klass_closure; - public: - RemarkKlassClosure(OopClosure* oop_closure) : _cm_klass_closure(oop_closure) {} - void do_klass(Klass* k) { - // Check if we have modified any oops in the Klass during the concurrent marking. - if (k->has_accumulated_modified_oops()) { - k->clear_accumulated_modified_oops(); - - // We could have transfered the current modified marks to the accumulated marks, - // like we do with the Card Table to Mod Union Table. But it's not really necessary. - } else if (k->has_modified_oops()) { - // Don't clear anything, this info is needed by the next young collection. - } else { - // No modified oops in the Klass. - return; - } - - // The klass has modified fields, need to scan the klass. - _cm_klass_closure.do_klass(k); - } -}; void CMSParMarkTask::work_on_young_gen_roots(OopsInGenClosure* cl) { ParNewGeneration* young_gen = _collector->_young_gen; @@ -4439,19 +4352,6 @@ log_trace(gc, task)("Finished unhandled CLD scanning work in %dth thread: %3.3f sec", worker_id, _timer.seconds()); } - // ---------- dirty klass scanning ---------- - if (worker_id == 0) { // Single threaded at the moment. - _timer.reset(); - _timer.start(); - - // Scan all classes that was dirtied during the concurrent marking phase. - RemarkKlassClosure remark_klass_closure(&par_mrias_cl); - ClassLoaderDataGraph::classes_do(&remark_klass_closure); - - _timer.stop(); - log_trace(gc, task)("Finished dirty klass scanning work in %dth thread: %3.3f sec", worker_id, _timer.seconds()); - } - // We might have added oops to ClassLoaderData::_handles during the // concurrent marking phase. These oops point to newly allocated objects // that are guaranteed to be kept alive. Either by the direct allocation @@ -4980,17 +4880,6 @@ verify_work_stacks_empty(); } - - { - GCTraceTime(Trace, gc, phases) t("Dirty Klass Scan", _gc_timer_cm); - - verify_work_stacks_empty(); - - RemarkKlassClosure remark_klass_closure(&mrias_cl); - ClassLoaderDataGraph::classes_do(&remark_klass_closure); - - verify_work_stacks_empty(); - } // We might have added oops to ClassLoaderData::_handles during the // concurrent marking phase. These oops point to newly allocated objects