< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 51882 : imported patch 8211176-eager-object-monitor-init


3588   extern void JDK_Version_init();
3589 
3590   // Preinitialize version info.
3591   VM_Version::early_initialize();
3592 
3593   // Check version
3594   if (!is_supported_jni_version(args->version)) return JNI_EVERSION;
3595 
3596   // Initialize library-based TLS
3597   ThreadLocalStorage::init();
3598 
3599   // Initialize the output stream module
3600   ostream_init();
3601 
3602   // Process java launcher properties.
3603   Arguments::process_sun_java_launcher_properties(args);
3604 
3605   // Initialize the os module
3606   os::init();
3607 



3608   // Record VM creation timing statistics
3609   TraceVmCreationTime create_vm_timer;
3610   create_vm_timer.start();
3611 
3612   // Initialize system properties.
3613   Arguments::init_system_properties();
3614 
3615   // So that JDK version can be used as a discriminator when parsing arguments
3616   JDK_Version_init();
3617 
3618   // Update/Initialize System properties after JDK version number is known
3619   Arguments::init_version_specific_system_properties();
3620 
3621   // Make sure to initialize log configuration *before* parsing arguments
3622   LogConfiguration::initialize(create_vm_timer.begin_time());
3623 
3624   // Parse arguments
3625   // Note: this internally calls os::init_container_support()
3626   jint parse_result = Arguments::parse(args);
3627   if (parse_result != JNI_OK) return parse_result;


3704   JavaThread* main_thread = new JavaThread();
3705   main_thread->set_thread_state(_thread_in_vm);
3706   main_thread->initialize_thread_current();
3707   // must do this before set_active_handles
3708   main_thread->record_stack_base_and_size();
3709   main_thread->set_active_handles(JNIHandleBlock::allocate_block());
3710 
3711   if (!main_thread->set_as_starting_thread()) {
3712     vm_shutdown_during_initialization(
3713                                       "Failed necessary internal allocation. Out of swap space");
3714     main_thread->smr_delete();
3715     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3716     return JNI_ENOMEM;
3717   }
3718 
3719   // Enable guard page *after* os::create_main_thread(), otherwise it would
3720   // crash Linux VM, see notes in os_linux.cpp.
3721   main_thread->create_stack_guard_pages();
3722 
3723   // Initialize Java-Level synchronization subsystem
3724   ObjectMonitor::Initialize();
3725 
3726   // Initialize global modules
3727   jint status = init_globals();
3728   if (status != JNI_OK) {
3729     main_thread->smr_delete();
3730     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3731     return status;
3732   }
3733 
3734   JFR_ONLY(Jfr::on_vm_init();)
3735 
3736   // Should be done after the heap is fully created
3737   main_thread->cache_global_variables();
3738 
3739   HandleMark hm;
3740 
3741   { MutexLocker mu(Threads_lock);
3742     Threads::add(main_thread);
3743   }
3744 




3588   extern void JDK_Version_init();
3589 
3590   // Preinitialize version info.
3591   VM_Version::early_initialize();
3592 
3593   // Check version
3594   if (!is_supported_jni_version(args->version)) return JNI_EVERSION;
3595 
3596   // Initialize library-based TLS
3597   ThreadLocalStorage::init();
3598 
3599   // Initialize the output stream module
3600   ostream_init();
3601 
3602   // Process java launcher properties.
3603   Arguments::process_sun_java_launcher_properties(args);
3604 
3605   // Initialize the os module
3606   os::init();
3607 
3608   // Initialize the ObjectMonitor module
3609   ObjectMonitor::init();
3610 
3611   // Record VM creation timing statistics
3612   TraceVmCreationTime create_vm_timer;
3613   create_vm_timer.start();
3614 
3615   // Initialize system properties.
3616   Arguments::init_system_properties();
3617 
3618   // So that JDK version can be used as a discriminator when parsing arguments
3619   JDK_Version_init();
3620 
3621   // Update/Initialize System properties after JDK version number is known
3622   Arguments::init_version_specific_system_properties();
3623 
3624   // Make sure to initialize log configuration *before* parsing arguments
3625   LogConfiguration::initialize(create_vm_timer.begin_time());
3626 
3627   // Parse arguments
3628   // Note: this internally calls os::init_container_support()
3629   jint parse_result = Arguments::parse(args);
3630   if (parse_result != JNI_OK) return parse_result;


3707   JavaThread* main_thread = new JavaThread();
3708   main_thread->set_thread_state(_thread_in_vm);
3709   main_thread->initialize_thread_current();
3710   // must do this before set_active_handles
3711   main_thread->record_stack_base_and_size();
3712   main_thread->set_active_handles(JNIHandleBlock::allocate_block());
3713 
3714   if (!main_thread->set_as_starting_thread()) {
3715     vm_shutdown_during_initialization(
3716                                       "Failed necessary internal allocation. Out of swap space");
3717     main_thread->smr_delete();
3718     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3719     return JNI_ENOMEM;
3720   }
3721 
3722   // Enable guard page *after* os::create_main_thread(), otherwise it would
3723   // crash Linux VM, see notes in os_linux.cpp.
3724   main_thread->create_stack_guard_pages();
3725 
3726   // Initialize Java-Level synchronization subsystem
3727   ObjectMonitor::init_2();
3728 
3729   // Initialize global modules
3730   jint status = init_globals();
3731   if (status != JNI_OK) {
3732     main_thread->smr_delete();
3733     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
3734     return status;
3735   }
3736 
3737   JFR_ONLY(Jfr::on_vm_init();)
3738 
3739   // Should be done after the heap is fully created
3740   main_thread->cache_global_variables();
3741 
3742   HandleMark hm;
3743 
3744   { MutexLocker mu(Threads_lock);
3745     Threads::add(main_thread);
3746   }
3747 


< prev index next >