789 // Do oop for ThreadShadow |
789 // Do oop for ThreadShadow |
790 f->do_oop((oop*)&_pending_exception); |
790 f->do_oop((oop*)&_pending_exception); |
791 handle_area()->oops_do(f); |
791 handle_area()->oops_do(f); |
792 } |
792 } |
793 |
793 |
794 void Thread::nmethods_do(CodeBlobClosure* cf) { |
|
795 // no nmethods in a generic thread... |
|
796 } |
|
797 |
|
798 void Thread::metadata_handles_do(void f(Metadata*)) { |
794 void Thread::metadata_handles_do(void f(Metadata*)) { |
799 // Only walk the Handles in Thread. |
795 // Only walk the Handles in Thread. |
800 if (metadata_handles() != NULL) { |
796 if (metadata_handles() != NULL) { |
801 for (int i = 0; i< metadata_handles()->length(); i++) { |
797 for (int i = 0; i< metadata_handles()->length(); i++) { |
802 f(metadata_handles()->at(i)); |
798 f(metadata_handles()->at(i)); |
2825 jvmti_thread_state()->oops_do(f); |
2821 jvmti_thread_state()->oops_do(f); |
2826 } |
2822 } |
2827 } |
2823 } |
2828 |
2824 |
2829 void JavaThread::nmethods_do(CodeBlobClosure* cf) { |
2825 void JavaThread::nmethods_do(CodeBlobClosure* cf) { |
2830 Thread::nmethods_do(cf); // (super method is a no-op) |
|
2831 |
|
2832 assert((!has_last_Java_frame() && java_call_counter() == 0) || |
2826 assert((!has_last_Java_frame() && java_call_counter() == 0) || |
2833 (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); |
2827 (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); |
2834 |
2828 |
2835 if (has_last_Java_frame()) { |
2829 if (has_last_Java_frame()) { |
2836 // Traverse the execution stack |
2830 // Traverse the execution stack |
3299 // Create sweeper thread |
3293 // Create sweeper thread |
3300 CodeCacheSweeperThread::CodeCacheSweeperThread() |
3294 CodeCacheSweeperThread::CodeCacheSweeperThread() |
3301 : JavaThread(&sweeper_thread_entry) { |
3295 : JavaThread(&sweeper_thread_entry) { |
3302 _scanned_nmethod = NULL; |
3296 _scanned_nmethod = NULL; |
3303 } |
3297 } |
|
3298 |
3304 void CodeCacheSweeperThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { |
3299 void CodeCacheSweeperThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { |
3305 JavaThread::oops_do(f, cld_f, cf); |
3300 JavaThread::oops_do(f, cld_f, cf); |
|
3301 if (_scanned_nmethod != NULL && cf != NULL) { |
|
3302 // Safepoints can occur when the sweeper is scanning an nmethod so |
|
3303 // process it here to make sure it isn't unloaded in the middle of |
|
3304 // a scan. |
|
3305 cf->do_code_blob(_scanned_nmethod); |
|
3306 } |
|
3307 } |
|
3308 |
|
3309 void CodeCacheSweeperThread::nmethods_do(CodeBlobClosure* cf) { |
|
3310 JavaThread::nmethods_do(cf); |
3306 if (_scanned_nmethod != NULL && cf != NULL) { |
3311 if (_scanned_nmethod != NULL && cf != NULL) { |
3307 // Safepoints can occur when the sweeper is scanning an nmethod so |
3312 // Safepoints can occur when the sweeper is scanning an nmethod so |
3308 // process it here to make sure it isn't unloaded in the middle of |
3313 // process it here to make sure it isn't unloaded in the middle of |
3309 // a scan. |
3314 // a scan. |
3310 cf->do_code_blob(_scanned_nmethod); |
3315 cf->do_code_blob(_scanned_nmethod); |
4346 } |
4351 } |
4347 #endif // INCLUDE_ALL_GCS |
4352 #endif // INCLUDE_ALL_GCS |
4348 |
4353 |
4349 void Threads::nmethods_do(CodeBlobClosure* cf) { |
4354 void Threads::nmethods_do(CodeBlobClosure* cf) { |
4350 ALL_JAVA_THREADS(p) { |
4355 ALL_JAVA_THREADS(p) { |
4351 p->nmethods_do(cf); |
4356 // This is used by the code cache sweeper to mark nmethods that are active |
4352 } |
4357 // on the stack of a Java thread. Ignore the sweeper thread itself to avoid |
4353 VMThread::vm_thread()->nmethods_do(cf); |
4358 // marking CodeCacheSweeperThread::_scanned_nmethod as active. |
|
4359 if(!p->is_Code_cache_sweeper_thread()) { |
|
4360 p->nmethods_do(cf); |
|
4361 } |
|
4362 } |
4354 } |
4363 } |
4355 |
4364 |
4356 void Threads::metadata_do(void f(Metadata*)) { |
4365 void Threads::metadata_do(void f(Metadata*)) { |
4357 ALL_JAVA_THREADS(p) { |
4366 ALL_JAVA_THREADS(p) { |
4358 p->metadata_do(f); |
4367 p->metadata_do(f); |