Mercurial > hg > graal-jvmci-8
diff src/share/vm/runtime/thread.cpp @ 3696:dc7902820c9b
Make NMethodSweeper work on any JavaThread
author | Gilles Duboscq <gilles.m.duboscq@gmail.com> |
---|---|
date | Thu, 24 Nov 2011 17:24:43 +0100 |
parents | 0e8a2a629afb |
children | 04b9a2566eec |
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp Thu Nov 24 14:09:18 2011 +0100 +++ b/src/share/vm/runtime/thread.cpp Thu Nov 24 17:24:43 2011 +0100 @@ -1292,6 +1292,7 @@ _do_not_unlock_if_synchronized = false; _cached_monitor_info = NULL; _parker = Parker::Allocate(this) ; + _scanned_nmethod = NULL; #ifndef PRODUCT _jmp_ring_index = 0; @@ -2558,6 +2559,13 @@ if (jvmti_thread_state() != NULL) { jvmti_thread_state()->oops_do(f); } + + 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); + } } void JavaThread::nmethods_do(CodeBlobClosure* cf) { @@ -2948,23 +2956,12 @@ _task = NULL; _queue = queue; _counters = counters; - _scanned_nmethod = NULL; #ifndef PRODUCT _ideal_graph_printer = NULL; #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 ======== // The Threads class links together all active threads, and provides