Skip to content

Commit eab1e62

Browse files
committed
8297487: G1 Remark: no need to keep alive oop constants of nmethods on stack
Reviewed-by: tschatzl, ayang, eosterlund
1 parent c8a8388 commit eab1e62

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,30 +1779,17 @@ class G1CMSATBBufferClosure : public SATBBufferClosure {
17791779

17801780
class G1RemarkThreadsClosure : public ThreadClosure {
17811781
G1SATBMarkQueueSet& _qset;
1782-
G1CMOopClosure _cm_cl;
1783-
MarkingCodeBlobClosure _code_cl;
17841782
uintx _claim_token;
17851783

17861784
public:
17871785
G1RemarkThreadsClosure(G1CollectedHeap* g1h, G1CMTask* task) :
17881786
_qset(G1BarrierSet::satb_mark_queue_set()),
1789-
_cm_cl(g1h, task),
1790-
_code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations, true /* keepalive nmethods */),
17911787
_claim_token(Threads::thread_claim_token()) {}
17921788

17931789
void do_thread(Thread* thread) {
17941790
if (thread->claim_threads_do(true, _claim_token)) {
17951791
// Transfer any partial buffer to the qset for completed buffer processing.
17961792
_qset.flush_queue(G1ThreadLocalData::satb_mark_queue(thread));
1797-
if (thread->is_Java_thread()) {
1798-
// In theory it should not be necessary to explicitly walk the nmethods to find roots for concurrent marking
1799-
// however the liveness of oops reachable from nmethods have very complex lifecycles:
1800-
// * Alive if on the stack of an executing method
1801-
// * Weakly reachable otherwise
1802-
// Some objects reachable from nmethods, such as the class loader (or klass_holder) of the receiver should be
1803-
// live by the SATB invariant but other oops recorded in nmethods may behave differently.
1804-
JavaThread::cast(thread)->nmethods_do(&_code_cl);
1805-
}
18061793
}
18071794
}
18081795
};

src/hotspot/share/gc/shared/barrierSet.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ static BarrierSetNMethod* select_barrier_set_nmethod(BarrierSetNMethod* barrier_
5757
// The GC needs nmethod entry barriers to do concurrent GC
5858
return barrier_set_nmethod;
5959
} else {
60-
// The GC needs nmethod entry barriers to deal with continuations
61-
// and code cache unloading
60+
// The GC needs nmethod entry barriers for code cache unloading (recently
61+
// used heuristics) and, if it's a SATB GC, to keep alive constant objects
62+
// of nmethods because they are weakly referenced.
6263
return new BarrierSetNMethod();
6364
}
6465
}

0 commit comments

Comments
 (0)