# HG changeset patch # User jrose # Date 1253775464 25200 # Node ID 753cf9794df9f99b6767866f4cc75ee0ca3b2dc9 # Parent 54b3b351d6f9a6b722a08953fb9ef2cda66f0620 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 diff -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/code/nmethod.cpp Wed Sep 23 23:57:44 2009 -0700 @@ -1558,13 +1558,12 @@ // 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 @@ // 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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/code/nmethod.hpp --- a/src/share/vm/code/nmethod.hpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/code/nmethod.hpp Wed Sep 23 23:57:44 2009 -0700 @@ -490,7 +490,8 @@ 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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp Wed Sep 23 23:57:44 2009 -0700 @@ -47,13 +47,10 @@ 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 @@ 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 @@ 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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Sep 23 23:57:44 2009 -0700 @@ -2852,7 +2852,7 @@ 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 @@ // 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 @@ 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 @@ // 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 @@ // 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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/gc_implementation/shared/markSweep.hpp --- a/src/share/vm/gc_implementation/shared/markSweep.hpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/gc_implementation/shared/markSweep.hpp Wed Sep 23 23:57:44 2009 -0700 @@ -64,7 +64,6 @@ 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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/memory/iterator.cpp --- a/src/share/vm/memory/iterator.cpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/memory/iterator.cpp Wed Sep 23 23:57:44 2009 -0700 @@ -68,8 +68,8 @@ } } -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 -r 54b3b351d6f9 -r 753cf9794df9 src/share/vm/memory/iterator.hpp --- a/src/share/vm/memory/iterator.hpp Wed Sep 23 23:56:15 2009 -0700 +++ b/src/share/vm/memory/iterator.hpp Wed Sep 23 23:57:44 2009 -0700 @@ -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 @@ 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 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 @@ 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); }