69 #include "runtime/fieldDescriptor.inline.hpp"
70 #include "runtime/handles.inline.hpp"
71 #include "runtime/interfaceSupport.inline.hpp"
72 #include "runtime/java.hpp"
73 #include "runtime/javaCalls.hpp"
74 #include "runtime/jfieldIDWorkaround.hpp"
75 #include "runtime/jniHandles.inline.hpp"
76 #include "runtime/orderAccess.hpp"
77 #include "runtime/reflection.hpp"
78 #include "runtime/safepointVerifiers.hpp"
79 #include "runtime/sharedRuntime.hpp"
80 #include "runtime/signature.hpp"
81 #include "runtime/thread.inline.hpp"
82 #include "runtime/vm_operations.hpp"
83 #include "services/memTracker.hpp"
84 #include "services/runtimeService.hpp"
85 #include "utilities/defaultStream.hpp"
86 #include "utilities/dtrace.hpp"
87 #include "utilities/events.hpp"
88 #include "utilities/histogram.hpp"
89 #include "utilities/internalVMTests.hpp"
90 #include "utilities/macros.hpp"
91 #include "utilities/vmError.hpp"
92 #if INCLUDE_JVMCI
93 #include "jvmci/jvmciCompiler.hpp"
94 #include "jvmci/jvmciRuntime.hpp"
95 #endif
96
97 static jint CurrentVersion = JNI_VERSION_10;
98
99 #ifdef _WIN32
100 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
101 #endif
102
103 // The DT_RETURN_MARK macros create a scoped object to fire the dtrace
104 // '-return' probe regardless of the return path is taken out of the function.
105 // Methods that have multiple return paths use this to avoid having to
106 // instrument each return path. Methods that use CHECK or THROW must use this
107 // since those macros can cause an immedate uninstrumented return.
108 //
109 // In order to get the return value, a reference to the variable containing
3960 #endif
3961
3962 // Tracks the time application was running before GC
3963 RuntimeService::record_application_start();
3964
3965 // Notify JVMTI
3966 if (JvmtiExport::should_post_thread_life()) {
3967 JvmtiExport::post_thread_start(thread);
3968 }
3969
3970 post_thread_start_event(thread);
3971
3972 #ifndef PRODUCT
3973 // Check if we should compile all classes on bootclasspath
3974 if (CompileTheWorld) ClassLoader::compile_the_world();
3975 if (ReplayCompiles) ciReplay::replay(thread);
3976
3977 // Some platforms (like Win*) need a wrapper around these test
3978 // functions in order to properly handle error conditions.
3979 VMError::test_error_handler();
3980 if (ExecuteInternalVMTests) {
3981 InternalVMTests::run();
3982 }
3983 #endif
3984
3985 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
3986 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
3987 } else {
3988 // If create_vm exits because of a pending exception, exit with that
3989 // exception. In the future when we figure out how to reclaim memory,
3990 // we may be able to exit with JNI_ERR and allow the calling application
3991 // to continue.
3992 if (Universe::is_fully_initialized()) {
3993 // otherwise no pending exception possible - VM will already have aborted
3994 JavaThread* THREAD = JavaThread::current();
3995 if (HAS_PENDING_EXCEPTION) {
3996 HandleMark hm;
3997 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
3998 }
3999 }
4000
4001 if (can_try_again) {
4002 // reset safe_to_recreate_vm to 1 so that retrial would be possible
|
69 #include "runtime/fieldDescriptor.inline.hpp"
70 #include "runtime/handles.inline.hpp"
71 #include "runtime/interfaceSupport.inline.hpp"
72 #include "runtime/java.hpp"
73 #include "runtime/javaCalls.hpp"
74 #include "runtime/jfieldIDWorkaround.hpp"
75 #include "runtime/jniHandles.inline.hpp"
76 #include "runtime/orderAccess.hpp"
77 #include "runtime/reflection.hpp"
78 #include "runtime/safepointVerifiers.hpp"
79 #include "runtime/sharedRuntime.hpp"
80 #include "runtime/signature.hpp"
81 #include "runtime/thread.inline.hpp"
82 #include "runtime/vm_operations.hpp"
83 #include "services/memTracker.hpp"
84 #include "services/runtimeService.hpp"
85 #include "utilities/defaultStream.hpp"
86 #include "utilities/dtrace.hpp"
87 #include "utilities/events.hpp"
88 #include "utilities/histogram.hpp"
89 #include "utilities/macros.hpp"
90 #include "utilities/vmError.hpp"
91 #if INCLUDE_JVMCI
92 #include "jvmci/jvmciCompiler.hpp"
93 #include "jvmci/jvmciRuntime.hpp"
94 #endif
95
96 static jint CurrentVersion = JNI_VERSION_10;
97
98 #ifdef _WIN32
99 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
100 #endif
101
102 // The DT_RETURN_MARK macros create a scoped object to fire the dtrace
103 // '-return' probe regardless of the return path is taken out of the function.
104 // Methods that have multiple return paths use this to avoid having to
105 // instrument each return path. Methods that use CHECK or THROW must use this
106 // since those macros can cause an immedate uninstrumented return.
107 //
108 // In order to get the return value, a reference to the variable containing
3959 #endif
3960
3961 // Tracks the time application was running before GC
3962 RuntimeService::record_application_start();
3963
3964 // Notify JVMTI
3965 if (JvmtiExport::should_post_thread_life()) {
3966 JvmtiExport::post_thread_start(thread);
3967 }
3968
3969 post_thread_start_event(thread);
3970
3971 #ifndef PRODUCT
3972 // Check if we should compile all classes on bootclasspath
3973 if (CompileTheWorld) ClassLoader::compile_the_world();
3974 if (ReplayCompiles) ciReplay::replay(thread);
3975
3976 // Some platforms (like Win*) need a wrapper around these test
3977 // functions in order to properly handle error conditions.
3978 VMError::test_error_handler();
3979 #endif
3980
3981 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
3982 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
3983 } else {
3984 // If create_vm exits because of a pending exception, exit with that
3985 // exception. In the future when we figure out how to reclaim memory,
3986 // we may be able to exit with JNI_ERR and allow the calling application
3987 // to continue.
3988 if (Universe::is_fully_initialized()) {
3989 // otherwise no pending exception possible - VM will already have aborted
3990 JavaThread* THREAD = JavaThread::current();
3991 if (HAS_PENDING_EXCEPTION) {
3992 HandleMark hm;
3993 vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
3994 }
3995 }
3996
3997 if (can_try_again) {
3998 // reset safe_to_recreate_vm to 1 so that retrial would be possible
|