diff --git a/make/aix/makefiles/mapfile-vers-debug b/make/aix/makefiles/mapfile-vers-debug index 8f28690b4b3fbec162a8cf63d27ab13c477514c9..9d1d947f2119f7765103b032a9ef3b7565a1267e 100644 --- a/make/aix/makefiles/mapfile-vers-debug +++ b/make/aix/makefiles/mapfile-vers-debug @@ -39,6 +39,7 @@ SUNWprivate_1.1 { JVM_ArrayCopy; JVM_AssertionStatusDirectives; JVM_Available; + JVM_BeforeHalt; JVM_Bind; JVM_ClassDepth; JVM_ClassLoaderDepth; diff --git a/make/aix/makefiles/mapfile-vers-product b/make/aix/makefiles/mapfile-vers-product index adcb3fc6da1b57ae4c9495db305cbbd4c73c63f9..a54644dcb4240c4af9bac9c498f050ba4ecda78a 100644 --- a/make/aix/makefiles/mapfile-vers-product +++ b/make/aix/makefiles/mapfile-vers-product @@ -39,6 +39,7 @@ SUNWprivate_1.1 { JVM_ArrayCopy; JVM_AssertionStatusDirectives; JVM_Available; + JVM_BeforeHalt; JVM_Bind; JVM_ClassDepth; JVM_ClassLoaderDepth; diff --git a/make/bsd/makefiles/mapfile-vers-debug b/make/bsd/makefiles/mapfile-vers-debug index 5e4a6a52ac859909476b5fc034f56f3419ef4afe..49a70edcba7a1a3a55c4ec7659b03d53b29c71f2 100644 --- a/make/bsd/makefiles/mapfile-vers-debug +++ b/make/bsd/makefiles/mapfile-vers-debug @@ -37,6 +37,7 @@ _JVM_ArrayCopy _JVM_AssertionStatusDirectives _JVM_Available + _JVM_BeforeHalt _JVM_Bind _JVM_ClassDepth _JVM_ClassLoaderDepth diff --git a/make/bsd/makefiles/mapfile-vers-product b/make/bsd/makefiles/mapfile-vers-product index b8a83d630952be7c8d35e04465f7cc7a0fc13aef..5027467136d153ee192a35d60035c65b6b68c9bf 100644 --- a/make/bsd/makefiles/mapfile-vers-product +++ b/make/bsd/makefiles/mapfile-vers-product @@ -37,6 +37,7 @@ _JVM_ArrayCopy _JVM_AssertionStatusDirectives _JVM_Available + _JVM_BeforeHalt _JVM_Bind _JVM_ClassDepth _JVM_ClassLoaderDepth diff --git a/make/linux/makefiles/mapfile-vers-debug b/make/linux/makefiles/mapfile-vers-debug index f16822b2016641295b4e7c6cc2b78ebc01a20585..d9ca7f79a5e83344d2abe498b2d5e2efd440176d 100644 --- a/make/linux/makefiles/mapfile-vers-debug +++ b/make/linux/makefiles/mapfile-vers-debug @@ -39,6 +39,7 @@ SUNWprivate_1.1 { JVM_ArrayCopy; JVM_AssertionStatusDirectives; JVM_Available; + JVM_BeforeHalt; JVM_Bind; JVM_ClassDepth; JVM_ClassLoaderDepth; diff --git a/make/linux/makefiles/mapfile-vers-product b/make/linux/makefiles/mapfile-vers-product index f96c86b4b6c9f3ec2919a68814cd7bb848c66d1e..9b04f72816f284fe5ce1c3ef8370112835015afb 100644 --- a/make/linux/makefiles/mapfile-vers-product +++ b/make/linux/makefiles/mapfile-vers-product @@ -39,6 +39,7 @@ SUNWprivate_1.1 { JVM_ArrayCopy; JVM_AssertionStatusDirectives; JVM_Available; + JVM_BeforeHalt; JVM_Bind; JVM_ClassDepth; JVM_ClassLoaderDepth; diff --git a/make/solaris/makefiles/mapfile-vers b/make/solaris/makefiles/mapfile-vers index d76be6ccc99c7c4d0eadbf7b27edb3fbecafe638..f368471698bff7347b363f2b5bc124f887cbe36d 100644 --- a/make/solaris/makefiles/mapfile-vers +++ b/make/solaris/makefiles/mapfile-vers @@ -39,6 +39,7 @@ SUNWprivate_1.1 { JVM_ArrayCopy; JVM_AssertionStatusDirectives; JVM_Available; + JVM_BeforeHalt; JVM_Bind; JVM_ClassDepth; JVM_ClassLoaderDepth; diff --git a/src/share/vm/prims/jvm.cpp b/src/share/vm/prims/jvm.cpp index e60463191f4389d3b972395eb78ae63688a0b2e0..bc3ff540dcff4f815ba815de86d60b0ccdc8dd93 100644 --- a/src/share/vm/prims/jvm.cpp +++ b/src/share/vm/prims/jvm.cpp @@ -443,6 +443,16 @@ JVM_ENTRY_NO_ENV(void, JVM_Exit(jint code)) JVM_END +JVM_ENTRY_NO_ENV(void, JVM_BeforeHalt()) + JVMWrapper("JVM_BeforeHalt"); + EventShutdown event; + if (event.should_commit()) { + event.set_reason("Shutdown requested from Java"); + event.commit(); + } +JVM_END + + JVM_ENTRY_NO_ENV(void, JVM_Halt(jint code)) before_exit(thread); vm_exit(code); diff --git a/src/share/vm/prims/jvm.h b/src/share/vm/prims/jvm.h index 2c64341b78e7b0d31306af6f563d50e6323c68f2..d8f8e873a8b221e45674a624b9907c0855f42d61 100644 --- a/src/share/vm/prims/jvm.h +++ b/src/share/vm/prims/jvm.h @@ -158,6 +158,9 @@ JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset, JNIEXPORT void JNICALL JVM_Exit(jint code); +JNIEXPORT void JNICALL +JVM_BeforeHalt(); + JNIEXPORT void JNICALL JVM_Halt(jint code); diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 0c4e14828f3231797ca60a814b811bc9ff627515..42fc468410b977562770223a35728e1aa818d55d 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -4012,6 +4012,12 @@ bool Threads::destroy_vm() { Mutex::_as_suspend_equivalent_flag); } + EventShutdown e; + if (e.should_commit()) { + e.set_reason("No remaining non-daemon Java threads"); + e.commit(); + } + // Hang forever on exit if we are reporting an error. if (ShowMessageBoxOnError && is_error_reported()) { os::infinite_sleep();