< prev index next >

src/share/vm/prims/jni.cpp

Print this page




3971    * sets safe_to_recreate_vm to 1, such that any new call to
3972    * JNI_CreateJavaVM will immediately fail using the above logic.
3973    */
3974   bool can_try_again = true;
3975 
3976   result = Threads::create_vm((JavaVMInitArgs*) args, &can_try_again);
3977   if (result == JNI_OK) {
3978     JavaThread *thread = JavaThread::current();
3979     assert(!thread->has_pending_exception(), "should have returned not OK");
3980     /* thread is thread_in_vm here */
3981     *vm = (JavaVM *)(&main_vm);
3982     *(JNIEnv**)penv = thread->jni_environment();
3983 
3984 #if INCLUDE_JVMCI
3985     if (EnableJVMCI) {
3986       if (UseJVMCICompiler) {
3987         // JVMCI is initialized on a CompilerThread
3988         if (BootstrapJVMCI) {
3989           JavaThread* THREAD = thread;
3990           JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
3991           compiler->bootstrap();




3992         }
3993       }
3994     }
3995 #endif
3996 
3997     // Tracks the time application was running before GC
3998     RuntimeService::record_application_start();
3999 
4000     // Notify JVMTI
4001     if (JvmtiExport::should_post_thread_life()) {
4002        JvmtiExport::post_thread_start(thread);
4003     }
4004 
4005     EventThreadStart event;
4006     if (event.should_commit()) {
4007       event.set_thread(THREAD_TRACE_ID(thread));
4008       event.commit();
4009     }
4010 
4011 #ifndef PRODUCT




3971    * sets safe_to_recreate_vm to 1, such that any new call to
3972    * JNI_CreateJavaVM will immediately fail using the above logic.
3973    */
3974   bool can_try_again = true;
3975 
3976   result = Threads::create_vm((JavaVMInitArgs*) args, &can_try_again);
3977   if (result == JNI_OK) {
3978     JavaThread *thread = JavaThread::current();
3979     assert(!thread->has_pending_exception(), "should have returned not OK");
3980     /* thread is thread_in_vm here */
3981     *vm = (JavaVM *)(&main_vm);
3982     *(JNIEnv**)penv = thread->jni_environment();
3983 
3984 #if INCLUDE_JVMCI
3985     if (EnableJVMCI) {
3986       if (UseJVMCICompiler) {
3987         // JVMCI is initialized on a CompilerThread
3988         if (BootstrapJVMCI) {
3989           JavaThread* THREAD = thread;
3990           JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
3991           compiler->bootstrap(THREAD);
3992           if (HAS_PENDING_EXCEPTION) {
3993             HandleMark hm;
3994             vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
3995           }
3996         }
3997       }
3998     }
3999 #endif
4000 
4001     // Tracks the time application was running before GC
4002     RuntimeService::record_application_start();
4003 
4004     // Notify JVMTI
4005     if (JvmtiExport::should_post_thread_life()) {
4006        JvmtiExport::post_thread_start(thread);
4007     }
4008 
4009     EventThreadStart event;
4010     if (event.should_commit()) {
4011       event.set_thread(THREAD_TRACE_ID(thread));
4012       event.commit();
4013     }
4014 
4015 #ifndef PRODUCT


< prev index next >