Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8265411: Avoid unnecessary Method::init_intrinsic_id calls #3564

Conversation

iklam
Copy link
Member

@iklam iklam commented Apr 19, 2021

check_methods_for_intrinsics() in classFileParser.cpp calls Method::klass_id_for_intrinsics() to see if a class has intrinsic methods. However, the latter returns any class whose name is included in vmSymbols. This causes many unnecessary calls to Method::init_intrinsic_id().

To fix this, we precompute the classes that are known to have intrinsics using constexpr. See vmIntrinsics::class_has_intrinsics.

After the fix, when running java -Xshare:off -version, the number of classes initialized for intrinsics is reduced from 130 to 30.

Testing: mach5 tiers 1~4 passed.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8265411: Avoid unnecessary Method::init_intrinsic_id calls

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3564/head:pull/3564
$ git checkout pull/3564

Update a local copy of the PR:
$ git checkout pull/3564
$ git pull https://git.openjdk.java.net/jdk pull/3564/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3564

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3564.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 19, 2021

👋 Welcome back iklam! 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
Copy link

@openjdk openjdk bot commented Apr 19, 2021

@iklam The following label will be automatically applied to this pull request:

  • hotspot

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

@openjdk openjdk bot added the hotspot label Apr 19, 2021
@iklam iklam marked this pull request as ready for review Apr 19, 2021
@iklam iklam closed this Apr 19, 2021
@iklam iklam reopened this Apr 19, 2021
@openjdk openjdk bot added the rfr label Apr 19, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 19, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Ioi,

That all appears fine to me.

Is there any startup impact?

Thanks,
David

@openjdk
Copy link

@openjdk openjdk bot commented Apr 20, 2021

@iklam This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8265411: Avoid unnecessary Method::init_intrinsic_id calls

Reviewed-by: dholmes, minqi

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 20, 2021
@iklam
Copy link
Member Author

@iklam iklam commented Apr 20, 2021

Hi Ioi,

That all appears fine to me.

Is there any startup impact?

Thanks,
David

Hi David, when CDS is turned off, I can see a small improvement in start-up, due to the reduction in intrinsic ID lookup:

$ perf stat -r 100 bin/java -Xshare:off -Xint -version

OLD: 191,632,128 cycles 0.074624 sec
NEW: 191,387,603 cycles 0.073704 sec

With CDS enabled, the intrinsic ID lookup is done during archive dump time, so this PR makes no difference.

Also, the lookup table itself is generated during C++ compilation, so it has no runtime impact:

	.section	.rodata
	.type	_ZL18_intrinsics_lookup, @object
_ZL18_intrinsics_lookup:
	.byte	0
	.byte	0
	.byte	1
	.byte	1
        ....

yminqi
yminqi approved these changes Apr 20, 2021
Copy link
Contributor

@yminqi yminqi left a comment

LGTM, thanks for fixing this!

@yminqi
Copy link
Contributor

@yminqi yminqi commented Apr 20, 2021

BTW, the the fix works for the problem: adding symbols to vmSymbols.hpp caused debug build failed due to this bug.

@iklam
Copy link
Member Author

@iklam iklam commented Apr 21, 2021

Thanks @dholmes-ora and @yminqi for the review!
/integrate

@openjdk openjdk bot closed this Apr 21, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 21, 2021

@iklam Since your change was applied there have been 15 commits pushed to the master branch:

  • a22ad03: 8264983: Add gtest for JDK-8264008
  • 91b08b7: 8261779: JCK test api/javax_crypto/EncryptedPrivateKeyInfo/Ctor4.html is failing with assertion error when assertions enabled
  • 2fcd920: 8261183: Follow on to Make lists of normal filenames
  • 40ef00c: 8258457: testlibrary_tests/ctw/JarDirTest.java fails with InvalidPathException on windows
  • 3f0da35: 8261392: Exclude testlibrary_tests/ctw/JarDirTest.java
  • 8d0faaf: 8257001: Improve Http Client Support
  • 9bf055d: 8259633: compiler/graalunit/CoreTest.java fails with NPE after JDK-8244543
  • ddc56d1: 8259428: AlgorithmId.getEncodedParams() should return copy
  • ae33d2a: 8258247: Couple of issues in fix for JDK-8249906
  • 2003e91: 8244543: Enhanced handling of abstract classes
  • ... and 5 more: https://git.openjdk.java.net/jdk/compare/d61345984d56cc46161ffea097afbd899081f3cf...master

Your commit was automatically rebased without conflicts.

Pushed as commit 739769c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot integrated
4 participants