Skip to content

Commit 2009dc2

Browse files
committedFeb 20, 2023
8302462: [REDO] 8297487: G1 Remark: no need to keep alive oop constants of nmethods on stack
Reviewed-by: tschatzl, ayang
1 parent 7abe269 commit 2009dc2

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed
 

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

+1-14
Original file line numberDiff line numberDiff line change
@@ -1777,27 +1777,14 @@ class G1CMSATBBufferClosure : public SATBBufferClosure {
17771777

17781778
class G1RemarkThreadsClosure : public ThreadClosure {
17791779
G1SATBMarkQueueSet& _qset;
1780-
G1CMOopClosure _cm_cl;
1781-
MarkingCodeBlobClosure _code_cl;
17821780

17831781
public:
17841782
G1RemarkThreadsClosure(G1CollectedHeap* g1h, G1CMTask* task) :
1785-
_qset(G1BarrierSet::satb_mark_queue_set()),
1786-
_cm_cl(g1h, task),
1787-
_code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations, true /* keepalive nmethods */) {}
1783+
_qset(G1BarrierSet::satb_mark_queue_set()) {}
17881784

17891785
void do_thread(Thread* thread) {
17901786
// Transfer any partial buffer to the qset for completed buffer processing.
17911787
_qset.flush_queue(G1ThreadLocalData::satb_mark_queue(thread));
1792-
if (thread->is_Java_thread()) {
1793-
// In theory it should not be necessary to explicitly walk the nmethods to find roots for concurrent marking
1794-
// however the liveness of oops reachable from nmethods have very complex lifecycles:
1795-
// * Alive if on the stack of an executing method
1796-
// * Weakly reachable otherwise
1797-
// Some objects reachable from nmethods, such as the class loader (or klass_holder) of the receiver should be
1798-
// live by the SATB invariant but other oops recorded in nmethods may behave differently.
1799-
JavaThread::cast(thread)->nmethods_do(&_code_cl);
1800-
}
18011788
}
18021789
};
18031790

‎src/hotspot/share/gc/shared/barrierSetNMethod.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ bool BarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) {
9999

100100
// If the nmethod is the only thing pointing to the oops, and we are using a
101101
// SATB GC, then it is important that this code marks them live.
102+
// Also, with concurrent GC, it is possible that frames in continuation stack
103+
// chunks are not visited if they are allocated after concurrent GC started.
102104
OopKeepAliveClosure cl;
103105
nm->oops_do(&cl);
104106

0 commit comments

Comments
 (0)
Please sign in to comment.