Skip to content

Conversation

@jcking
Copy link
Contributor

@jcking jcking commented Feb 24, 2023

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Warnings

 ⚠️ Patch contains a binary file (src/java.base/share/classes/jdk/internal/icu/impl/data/icudt72b/nfc.nrm)
 ⚠️ Patch contains a binary file (src/java.base/share/classes/jdk/internal/icu/impl/data/icudt72b/nfkc.nrm)
 ⚠️ Patch contains a binary file (src/java.base/share/classes/jdk/internal/icu/impl/data/icudt72b/ubidi.icu)
 ⚠️ Patch contains a binary file (src/java.base/share/classes/jdk/internal/icu/impl/data/icudt72b/uprops.icu)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/javax/swing/doc-files/BoxLayout-1.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/javax/swing/text/doc-files/Document-remove.gif)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_glass_65_dadada_1x400.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_glass_75_dadada_1x400.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-icons_222222_256x240.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-icons_2e83ff_256x240.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-icons_454545_256x240.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-icons_888888_256x240.png)
 ⚠️ Patch contains a binary file (src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script-dir/images/ui-icons_cd0a0a_256x240.png)
 ⚠️ Patch contains a binary file (test/hotspot/jtreg/gc/logging/testcases.jar)
 ⚠️ Patch contains a binary file (test/jdk/java/security/KeyRep/RSA.pre.1.5.key)
 ⚠️ Patch contains a binary file (test/jdk/java/util/zip/ZipFile/crash.jar)
 ⚠️ Patch contains a binary file (test/jdk/java/util/zip/ZipFile/input.jar)
 ⚠️ Patch contains a binary file (test/jdk/java/util/zip/ZipFile/input.zip)
 ⚠️ Patch contains a binary file (test/jdk/java/util/zip/test.zip)
 ⚠️ Patch contains a binary file (test/jdk/javax/management/loading/LibraryLoader/native.jar)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/DE1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/DI1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/DS1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/PR1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/RO1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/RS1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/swing/AbstractButton/5049549/SE1.gif)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK6_Duration.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK6_XMLGregorianCalendar.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK7_Duration.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK7_XMLGregorianCalendar.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK8_Duration.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK8_XMLGregorianCalendar.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK9_Duration.ser)
 ⚠️ Patch contains a binary file (test/jdk/javax/xml/jaxp/datatype/8033980/JDK9_XMLGregorianCalendar.ser)

Issue

  • JDK-8303166: Disable RTTI for Hotspot when building with MSVC (Enhancement - P4) ⚠️ Issue is not open.

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12743/head:pull/12743
$ git checkout pull/12743

Update a local copy of the PR:
$ git checkout pull/12743
$ git pull https://git.openjdk.org/jdk.git pull/12743/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12743

View PR using the GUI difftool:
$ git pr show -t 12743

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12743.diff

Using Webrev

Link to Webrev Comment

@jcking jcking marked this pull request as ready for review February 24, 2023 15:36
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 24, 2023

👋 Welcome back jcking! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 24, 2023
@openjdk
Copy link

openjdk bot commented Feb 24, 2023

@jcking The following labels will be automatically applied to this pull request:

  • build
  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@jcking
Copy link
Contributor Author

jcking commented Feb 24, 2023

/reviewers 2

@openjdk
Copy link

openjdk bot commented Feb 24, 2023

@jcking
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@mlbridge
Copy link

mlbridge bot commented Feb 24, 2023

Webrevs

Copy link

@alexmenkov alexmenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update copyright year in flags-cflags.m4 and notificationThread.hpp

// 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; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding this method, would it be sufficient to explicitly define ~NotificationThread()?
Might require making it non-trivial. The comment would still be needed.

@dholmes-ora
Copy link
Member

The workaround should have been done under JDK-8302817. This issue should have simply disabled RTTI in the build system.

@jcking
Copy link
Contributor Author

jcking commented Feb 26, 2023

The workaround should have been done under JDK-8302817. This issue should have simply disabled RTTI in the build system.

I'll split the RTTI disable to a separate PR Monday, leave this one as the workaround, and rename to the other issue.

@jcking jcking marked this pull request as draft March 24, 2023 23:16
@openjdk openjdk bot removed the rfr Pull request is ready for review label Mar 24, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 23, 2023

@jcking This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk
Copy link

openjdk bot commented Jun 15, 2023

@jcking this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout msvc-rtti
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jun 15, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 10, 2023

@jcking This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 5, 2023

@jcking This pull request has been inactive for more than 16 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Oct 5, 2023
@plummercj
Copy link
Contributor

/label serviceability

@openjdk
Copy link

openjdk bot commented Oct 31, 2024

@plummercj
The serviceability label was successfully added.

@openjdk
Copy link

openjdk bot commented Oct 31, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8303166: Disable RTTI for Hotspot when building with MSVC 8303166: Disable RTTI for Hotspot when building with MSVC Oct 31, 2024
@plummercj
Copy link
Contributor

plummercj commented Oct 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants