< prev index next >

src/hotspot/share/prims/jni.cpp

Print this page




3932    * situations, the 'canTryAgain' flag is set to false, which atomically
3933    * sets safe_to_recreate_vm to 1, such that any new call to
3934    * JNI_CreateJavaVM will immediately fail using the above logic.
3935    */
3936   bool can_try_again = true;
3937 
3938   result = Threads::create_vm((JavaVMInitArgs*) args, &can_try_again);
3939   if (result == JNI_OK) {
3940     JavaThread *thread = JavaThread::current();
3941     assert(!thread->has_pending_exception(), "should have returned not OK");
3942     /* thread is thread_in_vm here */
3943     *vm = (JavaVM *)(&main_vm);
3944     *(JNIEnv**)penv = thread->jni_environment();
3945 
3946 #if INCLUDE_JVMCI
3947     if (EnableJVMCI) {
3948       if (UseJVMCICompiler) {
3949         // JVMCI is initialized on a CompilerThread
3950         if (BootstrapJVMCI) {
3951           JavaThread* THREAD = thread;
3952           JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
3953           compiler->bootstrap(THREAD);
3954           if (HAS_PENDING_EXCEPTION) {
3955             HandleMark hm;
3956             vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
3957           }
3958         }
3959       }
3960     }
3961 #endif
3962 
3963     // Tracks the time application was running before GC
3964     RuntimeService::record_application_start();
3965 
3966     // Notify JVMTI
3967     if (JvmtiExport::should_post_thread_life()) {
3968        JvmtiExport::post_thread_start(thread);
3969     }
3970 
3971     EventThreadStart event;
3972     if (event.should_commit()) {




3932    * situations, the 'canTryAgain' flag is set to false, which atomically
3933    * sets safe_to_recreate_vm to 1, such that any new call to
3934    * JNI_CreateJavaVM will immediately fail using the above logic.
3935    */
3936   bool can_try_again = true;
3937 
3938   result = Threads::create_vm((JavaVMInitArgs*) args, &can_try_again);
3939   if (result == JNI_OK) {
3940     JavaThread *thread = JavaThread::current();
3941     assert(!thread->has_pending_exception(), "should have returned not OK");
3942     /* thread is thread_in_vm here */
3943     *vm = (JavaVM *)(&main_vm);
3944     *(JNIEnv**)penv = thread->jni_environment();
3945 
3946 #if INCLUDE_JVMCI
3947     if (EnableJVMCI) {
3948       if (UseJVMCICompiler) {
3949         // JVMCI is initialized on a CompilerThread
3950         if (BootstrapJVMCI) {
3951           JavaThread* THREAD = thread;
3952           JVMCICompiler* compiler = JVMCICompiler::instance(true, CATCH);
3953           compiler->bootstrap(THREAD);
3954           if (HAS_PENDING_EXCEPTION) {
3955             HandleMark hm;
3956             vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
3957           }
3958         }
3959       }
3960     }
3961 #endif
3962 
3963     // Tracks the time application was running before GC
3964     RuntimeService::record_application_start();
3965 
3966     // Notify JVMTI
3967     if (JvmtiExport::should_post_thread_life()) {
3968        JvmtiExport::post_thread_start(thread);
3969     }
3970 
3971     EventThreadStart event;
3972     if (event.should_commit()) {


< prev index next >