提交 0a43c8bc 编写于 作者: J jrose

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
上级 025956fe
...@@ -1558,13 +1558,12 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, ...@@ -1558,13 +1558,12 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive,
// the (strong) marking phase, and then again when walking // the (strong) marking phase, and then again when walking
// the code cache contents during the weak roots processing // the code cache contents during the weak roots processing
// phase. The two uses are distinguished by means of the // phase. The two uses are distinguished by means of the
// do_nmethods() method in the closure "f" below -- which // 'do_strong_roots_only' flag, which is true in the first
// answers "yes" in the first case, and "no" in the second
// case. We want to walk the weak roots in the nmethod // case. We want to walk the weak roots in the nmethod
// only in the second case. 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 // are the oops in the ExceptionCache and the InlineCache
// oops. // 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 // make sure the oops ready to receive visitors
assert(!is_zombie() && !is_unloaded(), assert(!is_zombie() && !is_unloaded(),
"should not call follow on zombie or unloaded nmethod"); "should not call follow on zombie or unloaded nmethod");
...@@ -1582,7 +1581,7 @@ void nmethod::oops_do(OopClosure* f) { ...@@ -1582,7 +1581,7 @@ void nmethod::oops_do(OopClosure* f) {
// Compiled code // Compiled code
f->do_oop((oop*) &_method); f->do_oop((oop*) &_method);
if (!f->do_nmethods()) { if (!do_strong_roots_only) {
// weak roots processing phase -- update ExceptionCache oops // weak roots processing phase -- update ExceptionCache oops
ExceptionCache* ec = exception_cache(); ExceptionCache* ec = exception_cache();
while(ec != NULL) { while(ec != NULL) {
......
...@@ -490,7 +490,8 @@ class nmethod : public CodeBlob { ...@@ -490,7 +490,8 @@ class nmethod : public CodeBlob {
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map,
OopClosure* f); 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(); bool detect_scavenge_root_oops();
void verify_scavenge_root_oops() PRODUCT_RETURN; void verify_scavenge_root_oops() PRODUCT_RETURN;
......
...@@ -47,13 +47,10 @@ class MarkRefsIntoClosure: public OopsInGenClosure { ...@@ -47,13 +47,10 @@ class MarkRefsIntoClosure: public OopsInGenClosure {
private: private:
const MemRegion _span; const MemRegion _span;
CMSBitMap* _bitMap; CMSBitMap* _bitMap;
const bool _should_do_nmethods;
protected: protected:
DO_OOP_WORK_DEFN DO_OOP_WORK_DEFN
public: public:
MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap, MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
bool should_do_nmethods);
bool should_do_nmethods() { return _should_do_nmethods; }
virtual void do_oop(oop* p); virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p); virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } inline void do_oop_nv(oop* p) { MarkRefsIntoClosure::do_oop_work(p); }
...@@ -71,13 +68,11 @@ class MarkRefsIntoVerifyClosure: public OopsInGenClosure { ...@@ -71,13 +68,11 @@ class MarkRefsIntoVerifyClosure: public OopsInGenClosure {
const MemRegion _span; const MemRegion _span;
CMSBitMap* _verification_bm; CMSBitMap* _verification_bm;
CMSBitMap* _cms_bm; CMSBitMap* _cms_bm;
const bool _should_do_nmethods;
protected: protected:
DO_OOP_WORK_DEFN DO_OOP_WORK_DEFN
public: public:
MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm, MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm,
CMSBitMap* cms_bm, bool should_do_nmethods); CMSBitMap* cms_bm);
bool should_do_nmethods() { return _should_do_nmethods; }
virtual void do_oop(oop* p); virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p); virtual void do_oop(narrowOop* p);
inline void do_oop_nv(oop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } inline void do_oop_nv(oop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); }
...@@ -268,7 +263,6 @@ class Par_MarkRefsIntoAndScanClosure: public OopsInGenClosure { ...@@ -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(oop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); }
inline void do_oop_nv(narrowOop* 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; } bool do_header() { return true; }
virtual const bool do_nmethods() const { return true; }
// When ScanMarkedObjectsAgainClosure is used, // When ScanMarkedObjectsAgainClosure is used,
// it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(), // it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(),
// and this delegation is used. // and this delegation is used.
......
...@@ -2852,7 +2852,7 @@ void CMSCollector::verify_after_remark_work_1() { ...@@ -2852,7 +2852,7 @@ void CMSCollector::verify_after_remark_work_1() {
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
// Mark from roots one level into CMS // 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->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
gch->gen_process_strong_roots(_cmsGen->level(), gch->gen_process_strong_roots(_cmsGen->level(),
...@@ -2904,7 +2904,7 @@ void CMSCollector::verify_after_remark_work_2() { ...@@ -2904,7 +2904,7 @@ void CMSCollector::verify_after_remark_work_2() {
// Mark from roots one level into CMS // Mark from roots one level into CMS
MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(), MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(),
markBitMap(), true /* nmethods */); markBitMap());
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
gch->gen_process_strong_roots(_cmsGen->level(), gch->gen_process_strong_roots(_cmsGen->level(),
true, // younger gens are roots true, // younger gens are roots
...@@ -3490,8 +3490,10 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) { ...@@ -3490,8 +3490,10 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
FalseClosure falseClosure; FalseClosure falseClosure;
// In the case of a synchronous collection, we will elide the // In the case of a synchronous collection, we will elide the
// remark step, so it's important to catch all the nmethod oops // remark step, so it's important to catch all the nmethod oops
// in this step; hence the last argument to the constrcutor below. // in this step.
MarkRefsIntoClosure notOlder(_span, &_markBitMap, !asynch /* nmethods */); // 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(); GenCollectedHeap* gch = GenCollectedHeap::heap();
verify_work_stacks_empty(); verify_work_stacks_empty();
...@@ -6441,10 +6443,9 @@ void CMSMarkStack::expand() { ...@@ -6441,10 +6443,9 @@ void CMSMarkStack::expand() {
// generation then this will lose younger_gen cards! // generation then this will lose younger_gen cards!
MarkRefsIntoClosure::MarkRefsIntoClosure( MarkRefsIntoClosure::MarkRefsIntoClosure(
MemRegion span, CMSBitMap* bitMap, bool should_do_nmethods): MemRegion span, CMSBitMap* bitMap):
_span(span), _span(span),
_bitMap(bitMap), _bitMap(bitMap)
_should_do_nmethods(should_do_nmethods)
{ {
assert(_ref_processor == NULL, "deliberately left NULL"); assert(_ref_processor == NULL, "deliberately left NULL");
assert(_bitMap->covers(_span), "_bitMap/_span mismatch"); assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
...@@ -6465,12 +6466,11 @@ void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_wor ...@@ -6465,12 +6466,11 @@ void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_wor
// A variant of the above, used for CMS marking verification. // A variant of the above, used for CMS marking verification.
MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure( MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm, MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm):
bool should_do_nmethods):
_span(span), _span(span),
_verification_bm(verification_bm), _verification_bm(verification_bm),
_cms_bm(cms_bm), _cms_bm(cms_bm)
_should_do_nmethods(should_do_nmethods) { {
assert(_ref_processor == NULL, "deliberately left NULL"); assert(_ref_processor == NULL, "deliberately left NULL");
assert(_verification_bm->covers(_span), "_verification_bm/_span mismatch"); assert(_verification_bm->covers(_span), "_verification_bm/_span mismatch");
} }
......
...@@ -64,7 +64,6 @@ class MarkSweep : AllStatic { ...@@ -64,7 +64,6 @@ class MarkSweep : AllStatic {
public: public:
virtual void do_oop(oop* p); virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* 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 const bool should_remember_mdo() const { return true; }
virtual void remember_mdo(DataLayout* p) { MarkSweep::revisit_mdo(p); } virtual void remember_mdo(DataLayout* p) { MarkSweep::revisit_mdo(p); }
}; };
......
...@@ -68,8 +68,8 @@ void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) { ...@@ -68,8 +68,8 @@ void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) {
} }
} }
void CodeBlobToOopClosure::do_newly_marked_nmethod(CodeBlob* cb) { void CodeBlobToOopClosure::do_newly_marked_nmethod(nmethod* nm) {
cb->oops_do(_cl); nm->oops_do(_cl, /*do_strong_roots_only=*/ true);
} }
void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) { void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
// The following classes are C++ `closures` for iterating over objects, roots and spaces // The following classes are C++ `closures` for iterating over objects, roots and spaces
class CodeBlob; class CodeBlob;
class nmethod;
class ReferenceProcessor; class ReferenceProcessor;
class DataLayout; class DataLayout;
...@@ -70,9 +71,6 @@ class OopClosure : public Closure { ...@@ -70,9 +71,6 @@ class OopClosure : public Closure {
virtual const bool should_remember_mdo() const { return false; } virtual const bool should_remember_mdo() const { return false; }
virtual void remember_mdo(DataLayout* v) { /* do nothing */ } 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 // The methods below control how object iterations invoking this closure
// should be performed: // should be performed:
...@@ -190,7 +188,7 @@ class CodeBlobClosure : public Closure { ...@@ -190,7 +188,7 @@ class CodeBlobClosure : public Closure {
class MarkingCodeBlobClosure : public CodeBlobClosure { class MarkingCodeBlobClosure : public CodeBlobClosure {
public: public:
// Called for each code blob, but at most once per unique blob. // 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); virtual void do_code_blob(CodeBlob* cb);
// = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); } // = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); }
...@@ -213,7 +211,7 @@ class CodeBlobToOopClosure: public MarkingCodeBlobClosure { ...@@ -213,7 +211,7 @@ class CodeBlobToOopClosure: public MarkingCodeBlobClosure {
OopClosure* _cl; OopClosure* _cl;
bool _do_marking; bool _do_marking;
public: public:
virtual void do_newly_marked_nmethod(CodeBlob* cb); virtual void do_newly_marked_nmethod(nmethod* cb);
// = { cb->oops_do(_cl); } // = { cb->oops_do(_cl); }
virtual void do_code_blob(CodeBlob* cb); virtual void do_code_blob(CodeBlob* cb);
// = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); } // = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册