提交 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,
// 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) {
......
......@@ -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;
......
......@@ -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.
......
......@@ -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");
}
......
......@@ -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); }
};
......
......@@ -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) {
......
......@@ -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); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册