< prev index next >

src/share/vm/runtime/thread.cpp

Print this page




3575   }
3576 
3577   // Initialize Threads state
3578   _thread_list = NULL;
3579   _number_of_threads = 0;
3580   _number_of_non_daemon_threads = 0;
3581 
3582   // Initialize global data structures and create system classes in heap
3583   vm_init_globals();
3584 
3585 #if INCLUDE_JVMCI
3586   if (JVMCICounterSize > 0) {
3587     JavaThread::_jvmci_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal);
3588     memset(JavaThread::_jvmci_old_thread_counters, 0, sizeof(jlong) * JVMCICounterSize);
3589   } else {
3590     JavaThread::_jvmci_old_thread_counters = NULL;
3591   }
3592 #endif // INCLUDE_JVMCI
3593 
3594   // Attach the main thread to this os thread
3595   JavaThread* main_thread = new JavaThread();

3596   main_thread->set_thread_state(_thread_in_vm);
3597   main_thread->initialize_thread_current();
3598   // must do this before set_active_handles
3599   main_thread->record_stack_base_and_size();
3600   main_thread->set_active_handles(JNIHandleBlock::allocate_block());
3601 
3602   if (!main_thread->set_as_starting_thread()) {
3603     vm_shutdown_during_initialization(
3604                                       "Failed necessary internal allocation. Out of swap space");
3605     delete main_thread;
3606     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3607     return JNI_ENOMEM;
3608   }
3609 
3610   // Enable guard page *after* os::create_main_thread(), otherwise it would
3611   // crash Linux VM, see notes in os_linux.cpp.
3612   main_thread->create_stack_guard_pages();
3613 
3614   // Initialize Java-Level synchronization subsystem
3615   ObjectMonitor::Initialize();




3575   }
3576 
3577   // Initialize Threads state
3578   _thread_list = NULL;
3579   _number_of_threads = 0;
3580   _number_of_non_daemon_threads = 0;
3581 
3582   // Initialize global data structures and create system classes in heap
3583   vm_init_globals();
3584 
3585 #if INCLUDE_JVMCI
3586   if (JVMCICounterSize > 0) {
3587     JavaThread::_jvmci_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal);
3588     memset(JavaThread::_jvmci_old_thread_counters, 0, sizeof(jlong) * JVMCICounterSize);
3589   } else {
3590     JavaThread::_jvmci_old_thread_counters = NULL;
3591   }
3592 #endif // INCLUDE_JVMCI
3593 
3594   // Attach the main thread to this os thread
3595   JavaThread* main_thread = new JavaThread(true);
3596   main_thread->set_done_attaching_via_jni();
3597   main_thread->set_thread_state(_thread_in_vm);
3598   main_thread->initialize_thread_current();
3599   // must do this before set_active_handles
3600   main_thread->record_stack_base_and_size();
3601   main_thread->set_active_handles(JNIHandleBlock::allocate_block());
3602 
3603   if (!main_thread->set_as_starting_thread()) {
3604     vm_shutdown_during_initialization(
3605                                       "Failed necessary internal allocation. Out of swap space");
3606     delete main_thread;
3607     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3608     return JNI_ENOMEM;
3609   }
3610 
3611   // Enable guard page *after* os::create_main_thread(), otherwise it would
3612   // crash Linux VM, see notes in os_linux.cpp.
3613   main_thread->create_stack_guard_pages();
3614 
3615   // Initialize Java-Level synchronization subsystem
3616   ObjectMonitor::Initialize();


< prev index next >