diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 1fdd0143adf80..e99dc3efc1541 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -535,7 +535,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced -fno-exceptions \ -qalias=noansi -qstrict -qtls=default -qnortti -qnoeh -qignerrno -qstackprotect" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:strictStrings -MP" + TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:strictStrings -MP -GR-" TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:strictStrings -Zc:wchar_t-" fi diff --git a/src/hotspot/share/runtime/notificationThread.hpp b/src/hotspot/share/runtime/notificationThread.hpp index 17977e9353950..e6b66594463c4 100644 --- a/src/hotspot/share/runtime/notificationThread.hpp +++ b/src/hotspot/share/runtime/notificationThread.hpp @@ -37,11 +37,17 @@ class NotificationThread : public JavaThread { private: static void notification_thread_entry(JavaThread* thread, TRAPS); - NotificationThread(ThreadFunction entry_point) : JavaThread(entry_point) {}; + NotificationThread(ThreadFunction entry_point) : JavaThread(entry_point) {} public: static void initialize(); + // Serviceability Agent relies on being able to identify types based on their vtable address. If + // we do not override any virtual methods and RTTI is disabled, MSVC may emit a single vtable for + // JavaThread and NotificationThread. This results in the vtable symbols for both classes pointing + // to the same address, and Serviceability Agent thinking all JavaThreads are NotificationThreads. So + // while this method is not directly used anywhere, it must exist. + bool is_Notification_thread() const override { return true; } }; #endif // SHARE_RUNTIME_NOTIFICATIONTHREAD_HPP diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index b057413910ded..ed31b85acf812 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -327,6 +327,7 @@ class Thread: public ThreadShadow { virtual bool is_Named_thread() const { return false; } virtual bool is_Worker_thread() const { return false; } virtual bool is_JfrSampler_thread() const { return false; } + virtual bool is_Notification_thread() const { return false; } // Can this thread make Java upcalls virtual bool can_call_java() const { return false; }