From 0a43c8bc11805356a8f7acb08370fba543254f47 Mon Sep 17 00:00:00 2001 From: jrose Date: Wed, 23 Sep 2009 23:57:44 -0700 Subject: [PATCH] 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods Summary: After mechanically merging changes, some by-hand adjustments are needed. Reviewed-by: ysr --- src/share/vm/code/nmethod.cpp | 7 +++--- src/share/vm/code/nmethod.hpp | 3 ++- .../concurrentMarkSweep/cmsOopClosures.hpp | 10 ++------- .../concurrentMarkSweepGeneration.cpp | 22 +++++++++---------- .../vm/gc_implementation/shared/markSweep.hpp | 1 - src/share/vm/memory/iterator.cpp | 4 ++-- src/share/vm/memory/iterator.hpp | 8 +++---- 7 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp index 81a33470e..7f7ca1175 100644 --- a/src/share/vm/code/nmethod.cpp +++ b/src/share/vm/code/nmethod.cpp @@ -1558,13 +1558,12 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, // the (strong) marking phase, and then again when walking // the code cache contents during the weak roots processing // phase. The two uses are distinguished by means of the -// do_nmethods() method in the closure "f" below -- which -// answers "yes" in the first case, and "no" in the second +// 'do_strong_roots_only' flag, which is true in the first // case. We want to walk the weak roots in the nmethod // only in the second case. The weak roots in the nmethod // are the oops in the ExceptionCache and the InlineCache // oops. -void nmethod::oops_do(OopClosure* f) { +void nmethod::oops_do(OopClosure* f, bool do_strong_roots_only) { // make sure the oops ready to receive visitors assert(!is_zombie() && !is_unloaded(), "should not call follow on zombie or unloaded nmethod"); @@ -1582,7 +1581,7 @@ void nmethod::oops_do(OopClosure* f) { // Compiled code f->do_oop((oop*) &_method); - if (!f->do_nmethods()) { + if (!do_strong_roots_only) { // weak roots processing phase -- update ExceptionCache oops ExceptionCache* ec = exception_cache(); while(ec != NULL) { diff --git a/src/share/vm/code/nmethod.hpp b/src/share/vm/code/nmethod.hpp index 7a269a11a..a24b47e49 100644 --- a/src/share/vm/code/nmethod.hpp +++ b/src/share/vm/code/nmethod.hpp @@ -490,7 +490,8 @@ class nmethod : public CodeBlob { void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f); - void oops_do(OopClosure* f); + virtual void oops_do(OopClosure* f) { oops_do(f, false); } + void oops_do(OopClosure* f, bool do_strong_roots_only); bool detect_scavenge_root_oops(); void verify_scavenge_root_oops() PRODUCT_RETURN; diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp index c02b497d1..789623184 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @@ -47,13 +47,10 @@ class MarkRefsIntoClosure: public OopsInGenClosure { private: const MemRegion _span; CMSBitMap* _bitMap; - const bool _should_do_nmethods; protected: DO_OOP_WORK_DEFN public: - MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap, - bool should_do_nmethods); - bool should_do_nmethods() { return _should_do_nmethods; } + MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); inline void do_oop_nv(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } @@ -71,13 +68,11 @@ class MarkRefsIntoVerifyClosure: public OopsInGenClosure { const MemRegion _span; CMSBitMap* _verification_bm; CMSBitMap* _cms_bm; - const bool _should_do_nmethods; protected: DO_OOP_WORK_DEFN public: MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm, - CMSBitMap* cms_bm, bool should_do_nmethods); - bool should_do_nmethods() { return _should_do_nmethods; } + CMSBitMap* cms_bm); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); inline void do_oop_nv(oop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } @@ -268,7 +263,6 @@ class Par_MarkRefsIntoAndScanClosure: public OopsInGenClosure { inline void do_oop_nv(oop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } inline void do_oop_nv(narrowOop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } bool do_header() { return true; } - virtual const bool do_nmethods() const { return true; } // When ScanMarkedObjectsAgainClosure is used, // it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(), // and this delegation is used. diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index f99192c2f..c3d30c348 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -2852,7 +2852,7 @@ void CMSCollector::verify_after_remark_work_1() { GenCollectedHeap* gch = GenCollectedHeap::heap(); // Mark from roots one level into CMS - MarkRefsIntoClosure notOlder(_span, verification_mark_bm(), true /* nmethods */); + MarkRefsIntoClosure notOlder(_span, verification_mark_bm()); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. gch->gen_process_strong_roots(_cmsGen->level(), @@ -2904,7 +2904,7 @@ void CMSCollector::verify_after_remark_work_2() { // Mark from roots one level into CMS MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(), - markBitMap(), true /* nmethods */); + markBitMap()); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. gch->gen_process_strong_roots(_cmsGen->level(), true, // younger gens are roots @@ -3490,8 +3490,10 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) { FalseClosure falseClosure; // In the case of a synchronous collection, we will elide the // remark step, so it's important to catch all the nmethod oops - // in this step; hence the last argument to the constrcutor below. - MarkRefsIntoClosure notOlder(_span, &_markBitMap, !asynch /* nmethods */); + // in this step. + // The final 'true' flag to gen_process_strong_roots will ensure this. + // If 'async' is true, we can relax the nmethod tracing. + MarkRefsIntoClosure notOlder(_span, &_markBitMap); GenCollectedHeap* gch = GenCollectedHeap::heap(); verify_work_stacks_empty(); @@ -6441,10 +6443,9 @@ void CMSMarkStack::expand() { // generation then this will lose younger_gen cards! MarkRefsIntoClosure::MarkRefsIntoClosure( - MemRegion span, CMSBitMap* bitMap, bool should_do_nmethods): + MemRegion span, CMSBitMap* bitMap): _span(span), - _bitMap(bitMap), - _should_do_nmethods(should_do_nmethods) + _bitMap(bitMap) { assert(_ref_processor == NULL, "deliberately left NULL"); assert(_bitMap->covers(_span), "_bitMap/_span mismatch"); @@ -6465,12 +6466,11 @@ void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_wor // A variant of the above, used for CMS marking verification. MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure( - MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm, - bool should_do_nmethods): + MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm): _span(span), _verification_bm(verification_bm), - _cms_bm(cms_bm), - _should_do_nmethods(should_do_nmethods) { + _cms_bm(cms_bm) +{ assert(_ref_processor == NULL, "deliberately left NULL"); assert(_verification_bm->covers(_span), "_verification_bm/_span mismatch"); } diff --git a/src/share/vm/gc_implementation/shared/markSweep.hpp b/src/share/vm/gc_implementation/shared/markSweep.hpp index 4751247ec..c111b896b 100644 --- a/src/share/vm/gc_implementation/shared/markSweep.hpp +++ b/src/share/vm/gc_implementation/shared/markSweep.hpp @@ -64,7 +64,6 @@ class MarkSweep : AllStatic { public: virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); - virtual const bool do_nmethods() const { return true; } virtual const bool should_remember_mdo() const { return true; } virtual void remember_mdo(DataLayout* p) { MarkSweep::revisit_mdo(p); } }; diff --git a/src/share/vm/memory/iterator.cpp b/src/share/vm/memory/iterator.cpp index 4f5eea257..bbd7700a6 100644 --- a/src/share/vm/memory/iterator.cpp +++ b/src/share/vm/memory/iterator.cpp @@ -68,8 +68,8 @@ void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) { } } -void CodeBlobToOopClosure::do_newly_marked_nmethod(CodeBlob* cb) { - cb->oops_do(_cl); +void CodeBlobToOopClosure::do_newly_marked_nmethod(nmethod* nm) { + nm->oops_do(_cl, /*do_strong_roots_only=*/ true); } void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) { diff --git a/src/share/vm/memory/iterator.hpp b/src/share/vm/memory/iterator.hpp index 1838940bf..c8fe84a9a 100644 --- a/src/share/vm/memory/iterator.hpp +++ b/src/share/vm/memory/iterator.hpp @@ -25,6 +25,7 @@ // The following classes are C++ `closures` for iterating over objects, roots and spaces class CodeBlob; +class nmethod; class ReferenceProcessor; class DataLayout; @@ -70,9 +71,6 @@ class OopClosure : public Closure { virtual const bool should_remember_mdo() const { return false; } virtual void remember_mdo(DataLayout* v) { /* do nothing */ } - // If "true", invoke on nmethods (when scanning compiled frames). - virtual const bool do_nmethods() const { return false; } - // The methods below control how object iterations invoking this closure // should be performed: @@ -190,7 +188,7 @@ class CodeBlobClosure : public Closure { class MarkingCodeBlobClosure : public CodeBlobClosure { public: // Called for each code blob, but at most once per unique blob. - virtual void do_newly_marked_nmethod(CodeBlob* cb) = 0; + virtual void do_newly_marked_nmethod(nmethod* nm) = 0; virtual void do_code_blob(CodeBlob* cb); // = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); } @@ -213,7 +211,7 @@ class CodeBlobToOopClosure: public MarkingCodeBlobClosure { OopClosure* _cl; bool _do_marking; public: - virtual void do_newly_marked_nmethod(CodeBlob* cb); + virtual void do_newly_marked_nmethod(nmethod* cb); // = { cb->oops_do(_cl); } virtual void do_code_blob(CodeBlob* cb); // = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); } -- GitLab