--- a/src/hotspot/share/gc/g1/g1RemSet.cpp Tue Feb 19 12:56:02 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp Tue Feb 19 12:56:02 2019 +0100
@@ -409,6 +409,10 @@
void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) {
EventGCPhaseParallel event;
+ // We pass a weak code blobs closure to the remembered set scanning because we want to avoid
+ // treating the nmethods visited to act as roots for concurrent marking.
+ // We only want to make sure that the oops in the nmethods are adjusted with regard to the
+ // objects copied by the current evacuation.
r->strong_code_roots_do(_pss->closures()->weak_codeblobs());
event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::CodeRoots));
}