In G1RootProcessor::process_java_roots there is this comment:
// We need to make make sure that the "strong" nmethods are processed first
// using the strong closure. Only after that we process the weakly reachable
// nmethods.
// We need to strictly separate the strong and weak nmethod processing because
// any processing claims that nmethod, i.e. will not be iterated again.
// Which means if an nmethod is processed first and claimed, the strong processing
// will not happen, and the oops reachable by that nmethod will not be marked
// properly.
//
// That is why we process strong nmethods first, synchronize all threads via a
// barrier, and only then allow weak processing. To minimize the wait time at
// that barrier we do the strong nmethod processing first, and immediately after-
// wards indicate that that thread is done. Hopefully other root processing after
// nmethod processing is enough so there is no need to wait.
//
// This is only required in the concurrent start pause with class unloading enabled.
After JDK-8230706 the process is quite different and this comment only confusing the reader.