3399 // initializing the Java level thread object. Hence, the correct state must |
3399 // initializing the Java level thread object. Hence, the correct state must |
3400 // be set in order for the Safepoint code to deal with it correctly. |
3400 // be set in order for the Safepoint code to deal with it correctly. |
3401 thread->set_thread_state(_thread_in_vm); |
3401 thread->set_thread_state(_thread_in_vm); |
3402 // Must do this before initialize_thread_local_storage |
3402 // Must do this before initialize_thread_local_storage |
3403 thread->record_stack_base_and_size(); |
3403 thread->record_stack_base_and_size(); |
|
3404 |
3404 thread->initialize_thread_local_storage(); |
3405 thread->initialize_thread_local_storage(); |
3405 |
3406 |
3406 if (!os::create_attached_thread(thread)) { |
3407 if (!os::create_attached_thread(thread)) { |
3407 delete thread; |
3408 delete thread; |
3408 return JNI_ERR; |
3409 return JNI_ERR; |
3409 } |
3410 } |
|
3411 // Enable stack overflow checks |
|
3412 thread->create_stack_guard_pages(); |
|
3413 |
3410 thread->initialize_tlab(); |
3414 thread->initialize_tlab(); |
3411 |
3415 |
3412 // Crucial that we do not have a safepoint check for this thread, since it has |
3416 // Crucial that we do not have a safepoint check for this thread, since it has |
3413 // not been added to the Thread list yet. |
3417 // not been added to the Thread list yet. |
3414 { Threads_lock->lock_without_safepoint_check(); |
3418 { Threads_lock->lock_without_safepoint_check(); |
3449 |
3453 |
3450 // mark the thread as no longer attaching |
3454 // mark the thread as no longer attaching |
3451 // this uses a fence to push the change through so we don't have |
3455 // this uses a fence to push the change through so we don't have |
3452 // to regrab the threads_lock |
3456 // to regrab the threads_lock |
3453 thread->set_attached(); |
3457 thread->set_attached(); |
3454 |
|
3455 // Enable stack overflow checks |
|
3456 thread->create_stack_guard_pages(); |
|
3457 |
3458 |
3458 // Set java thread status. |
3459 // Set java thread status. |
3459 java_lang_Thread::set_thread_status(thread->threadObj(), |
3460 java_lang_Thread::set_thread_status(thread->threadObj(), |
3460 java_lang_Thread::RUNNABLE); |
3461 java_lang_Thread::RUNNABLE); |
3461 |
3462 |