Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
3693:60d31b1fada5 | 3696:dc7902820c9b |
---|---|
1290 _blocked_on_compilation = false; | 1290 _blocked_on_compilation = false; |
1291 _jni_active_critical = 0; | 1291 _jni_active_critical = 0; |
1292 _do_not_unlock_if_synchronized = false; | 1292 _do_not_unlock_if_synchronized = false; |
1293 _cached_monitor_info = NULL; | 1293 _cached_monitor_info = NULL; |
1294 _parker = Parker::Allocate(this) ; | 1294 _parker = Parker::Allocate(this) ; |
1295 _scanned_nmethod = NULL; | |
1295 | 1296 |
1296 #ifndef PRODUCT | 1297 #ifndef PRODUCT |
1297 _jmp_ring_index = 0; | 1298 _jmp_ring_index = 0; |
1298 for (int ji = 0 ; ji < jump_ring_buffer_size ; ji++ ) { | 1299 for (int ji = 0 ; ji < jump_ring_buffer_size ; ji++ ) { |
1299 record_jump(NULL, NULL, NULL, 0); | 1300 record_jump(NULL, NULL, NULL, 0); |
2556 f->do_oop((oop*) &_pending_async_exception); | 2557 f->do_oop((oop*) &_pending_async_exception); |
2557 | 2558 |
2558 if (jvmti_thread_state() != NULL) { | 2559 if (jvmti_thread_state() != NULL) { |
2559 jvmti_thread_state()->oops_do(f); | 2560 jvmti_thread_state()->oops_do(f); |
2560 } | 2561 } |
2562 | |
2563 if (_scanned_nmethod != NULL && cf != NULL) { | |
2564 // Safepoints can occur when the sweeper is scanning an nmethod so | |
2565 // process it here to make sure it isn't unloaded in the middle of | |
2566 // a scan. | |
2567 cf->do_code_blob(_scanned_nmethod); | |
2568 } | |
2561 } | 2569 } |
2562 | 2570 |
2563 void JavaThread::nmethods_do(CodeBlobClosure* cf) { | 2571 void JavaThread::nmethods_do(CodeBlobClosure* cf) { |
2564 Thread::nmethods_do(cf); // (super method is a no-op) | 2572 Thread::nmethods_do(cf); // (super method is a no-op) |
2565 | 2573 |
2946 : JavaThread(&compiler_thread_entry) { | 2954 : JavaThread(&compiler_thread_entry) { |
2947 _log = NULL; | 2955 _log = NULL; |
2948 _task = NULL; | 2956 _task = NULL; |
2949 _queue = queue; | 2957 _queue = queue; |
2950 _counters = counters; | 2958 _counters = counters; |
2951 _scanned_nmethod = NULL; | |
2952 | 2959 |
2953 #ifndef PRODUCT | 2960 #ifndef PRODUCT |
2954 _ideal_graph_printer = NULL; | 2961 _ideal_graph_printer = NULL; |
2955 #endif | 2962 #endif |
2956 } | |
2957 | |
2958 void CompilerThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { | |
2959 JavaThread::oops_do(f, cf); | |
2960 if (_scanned_nmethod != NULL && cf != NULL) { | |
2961 // Safepoints can occur when the sweeper is scanning an nmethod so | |
2962 // process it here to make sure it isn't unloaded in the middle of | |
2963 // a scan. | |
2964 cf->do_code_blob(_scanned_nmethod); | |
2965 } | |
2966 } | 2963 } |
2967 | 2964 |
2968 // ======= Threads ======== | 2965 // ======= Threads ======== |
2969 | 2966 |
2970 // The Threads class links together all active threads, and provides | 2967 // The Threads class links together all active threads, and provides |