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

8008243: Zero: Implement fast bytecodes #1938

Closed

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Jan 4, 2021

This work improves Zero performance considerably, without complicating the interpreter all that much. This work is based on much earlier patch by @rkennke, then edited by @jerboaa, and finally polished by me here :)

SPECjvm benchmarks improve across the board, with lowest improvement on Derby (+6%) and largest on Compress (+50%). Given that Zero is used to implement the JVM on emerging platforms that are still rather slow themselves, it makes sense to make Zero quantifiably faster. Even 10% improvement means more than 2 hours a day worth of CPU time.

Additional testing:

  • Linux x86_64 Zero fastdebug bootcycle-images
  • Linux x86_64 Zero fastdebug tier1
  • Linux x86_64 Zero fastdebug fuzzer tests (no failures = no new behaviors introduced)

Progress

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

Issue

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1938

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 4, 2021

👋 Welcome back shade! 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 bot commented Jan 4, 2021

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

  • hotspot-runtime

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-runtime hotspot-runtime-dev@openjdk.org label Jan 4, 2021
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 1, 2021

@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!

@shipilev
Copy link
Member Author

shipilev commented Feb 4, 2021

Hold on, bot, we are not done yet.

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 4, 2021

@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!

@shipilev
Copy link
Member Author

shipilev commented Mar 4, 2021

Not now, bot.

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 21, 2021

@shipilev 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!

@shipilev
Copy link
Member Author

Not yet, bot.

@bridgekeeper
Copy link

bridgekeeper bot commented May 19, 2021

@shipilev 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!

@shipilev
Copy link
Member Author

Not now, bot.

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 16, 2021

@shipilev 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!

@shipilev
Copy link
Member Author

Not now, bot. This is a draft PR.

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 20, 2021

@shipilev 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!

@shipilev
Copy link
Member Author

Not now, bot. This is a draft PR.

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 18, 2021

@shipilev 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 Sep 15, 2021

@shipilev 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 Sep 15, 2021
@shipilev
Copy link
Member Author

This should wait for tier1 stabilization for Zero. But otherwise it is still on track.

/open

@openjdk openjdk bot reopened this Sep 16, 2021
@openjdk
Copy link

openjdk bot commented Sep 16, 2021

@shipilev @HostUserDetails{id=1858943, username='shipilev', fullName='null'} this pull request is now open

@shipilev shipilev force-pushed the JDK-8008243-zero-fast-bytecodes branch from c052e9b to db93f88 Compare September 17, 2021 11:05
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 14, 2021

@shipilev 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!

@shipilev shipilev force-pushed the JDK-8008243-zero-fast-bytecodes branch from db93f88 to ffd9768 Compare October 18, 2021 10:14
@shipilev shipilev force-pushed the JDK-8008243-zero-fast-bytecodes branch from 62f8a57 to 4e485b0 Compare October 18, 2021 14:34
@shipilev shipilev marked this pull request as ready for review October 18, 2021 14:41
@shipilev shipilev changed the title 8008243: Zero: implement fast bytecodes 8008243: Zero: Implement fast bytecodes Oct 18, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 18, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 18, 2021

Webrevs

Copy link
Contributor

@rkennke rkennke left a comment

Choose a reason for hiding this comment

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

Nice work! Looks good to me! Thank you!

@openjdk
Copy link

openjdk bot commented Oct 19, 2021

@shipilev 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:

8008243: Zero: Implement fast bytecodes

Reviewed-by: rkennke, coleenp

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 49 new commits pushed to the master branch:

  • 02f7900: 8276932: G1: Annotate methods with override explicitly in g1CollectedHeap.hpp
  • fdcd16a: 8277048: Tiny improvements to the specification text for java.util.Properties.load
  • b231f5b: 8276921: G1: Remove redundant failed evacuation regions calculation in RemoveSelfForwardPtrHRClosure
  • ca2efb7: 8274687: JDWP deadlocks if some Java thread reaches wait in blockOnDebuggerSuspend
  • 296780c: 8276983: Small fixes to DumpAllocStat::print_stats
  • 8c5f030: 8276453: Undefined behavior in C1 LIR_OprDesc causes SEGV in fastdebug build
  • 176d21d: 8276824: refactor Thread::is_JavaThread_protected
  • 74f3e69: 8277071: [BACKOUT] JDK-8276743 Make openjdk build Zip Archive generation "reproducible"
  • b85500e: 8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File
  • 0d2980c: 8258192: Obsolete the CriticalJNINatives flag
  • ... and 39 more: https://git.openjdk.java.net/jdk/compare/0f463a7bf73791eda9404882ff63daf9040399bb...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this 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 Pull request is ready to be integrated label Oct 19, 2021
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

Looks good! We've had this request for so long now so thank you for doing it!

@shipilev
Copy link
Member Author

shipilev commented Nov 4, 2021

I realized that there are feature flags (RewriteBytecodes) that govern such translation. New patch implements that handling, thus giving us an escape hatch if the translation is incorrect. Since field accesses are hot and checking the flag within the interpreter slows it down measurably, I opted to specialize BytecodeInterpreter a bit more.

@shipilev
Copy link
Member Author

shipilev commented Nov 8, 2021

I realized that there are feature flags (RewriteBytecodes) that govern such translation. New patch implements that handling, thus giving us an escape hatch if the translation is incorrect. Since field accesses are hot and checking the flag within the interpreter slows it down measurably, I opted to specialize BytecodeInterpreter a bit more.

@coleenp, @rkennke -- can I ask you to take another look at this?

Copy link
Contributor

@rkennke rkennke left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks!

@shipilev
Copy link
Member Author

Re-ran Fuzzer in both -XX:+RewriteBytecodes and -XX:-RewriteBytecodes, still looks fine.

/integrate

@openjdk
Copy link

openjdk bot commented Nov 16, 2021

Going to push as commit e436200.
Since your change was applied there have been 59 commits pushed to the master branch:

  • bd92674: 8276184: Exclude lambda proxy class from the CDS archive if its caller class is excluded
  • a59c9b2: 8271515: Integration of JEP 417: Vector API (Third Incubator)
  • 9326eb1: 8276095: ciReplay: replay failure due to incomplete ciMethodData information
  • 7a87041: 8275385: Change nested classes in jdk.jdi to static nested classes
  • db0c8d5: 8274232: Cleanup unnecessary null comparison before instanceof check in jdk.jdi
  • 1830b8d: 8275056: Virtualize G1CardSet containers over heap region
  • fe45835: 8274856: Failing jpackage tests with fastdebug/release build
  • 9046077: 8276084: Linux DEB Bundler: release number in outputted .deb file should be optional
  • 7fc344d: 8277028: Use service type documentation as fallback for @provides
  • 35a831d: 8272170: Missing memory barrier when checking active state for regions
  • ... and 49 more: https://git.openjdk.java.net/jdk/compare/0f463a7bf73791eda9404882ff63daf9040399bb...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 16, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 16, 2021
@openjdk
Copy link

openjdk bot commented Nov 16, 2021

@shipilev Pushed as commit e436200.

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

@DamonFool
Copy link
Member

A regression was found here: #6479
Please review.
Thanks.

@shipilev shipilev deleted the JDK-8008243-zero-fast-bytecodes branch November 22, 2021 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
4 participants