--- old/src/share/vm/runtime/thread.cpp Thu May 12 16:30:52 2011 +++ new/src/share/vm/runtime/thread.cpp Thu May 12 16:30:52 2011 @@ -2942,6 +2942,7 @@ _queue = queue; _counters = counters; _buffer_blob = NULL; + _scanned_nmethod = NULL; #ifndef PRODUCT _ideal_graph_printer = NULL; @@ -2948,6 +2949,15 @@ #endif } +void CompilerThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { + JavaThread::oops_do(f, cf); + if (_scanned_nmethod != NULL && cf != NULL) { + // Safepoints can occur when the sweeper is scanning an nmethod so + // process it here to make sure it isn't unloaded in the middle of + // a scan. + cf->do_code_blob(_scanned_nmethod); + } +} // ======= Threads ========