RFR: JDK-8303166: Disable RTTI for Hotspot when building with MSVC

Chris Plummer cjplummer at openjdk.org
Fri Feb 24 19:44:06 UTC 2023


On Fri, 24 Feb 2023 15:36:16 GMT, Justin King <jcking at openjdk.org> wrote:

> Disable RTTI `-GR-` for Hotspot when building with MSVC. This drops the size of `jvm.dll` by roughly 1 MB. Hotspot does not rely on RTTI and it is disabled for both GCC/Clang and Open XL C/C++ already. This change disables it for MSVC, ensuring we do not accidently rely on RTTI for Windows-specific code while also decreasing the resulting binary size.
> 
> Cheers to @alexmenkov for finding the tricky root cause of why disabling RTTI was causing a subset of serviceability agent tests to fail.

src/hotspot/share/runtime/notificationThread.hpp line 48:

> 46:   // we do not override any virtual methods and RTTI is disabled, MSVC may emit a single vtable for
> 47:   // JavaThread and NotificationThread. This results in the vtable symbols for both classes pointing
> 48:   // to the same address and Serviceability Agent thinking all JavaThread are NotificationThread. So

Suggestion:

  // to the same address, and Serviceability Agent thinking all JavaThreads are NotificationThreads. So

-------------

PR: https://git.openjdk.org/jdk/pull/12743



More information about the build-dev mailing list