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

8275908: Record null_check traps for calls and array_check traps in the interpreter #6541

Closed

Conversation

simonis
Copy link
Member

@simonis simonis commented Nov 24, 2021

null_checks occurring at invoke bytecodes are currently not recorded by the profiler. This leads to unnecessary uncommon traps, deoptimizations and recompilations for exceptions which already occurred before the compilation (i.e. are "hot"). This change fixes the problem in the interpreter.

array_checks are currently recorded as class_checks in the interpreter and therefore not recognized by the compiler. This again leads to uncommon traps, deoptimizations and recompilations. This change unifies the handling of array_checks in the interpreter and compiler and prevents unnecessary recompilation.

The test is a stripped down version of a test which was developed for JDK-8273563: Improve performance of implicit exceptions with -XX:-OmitStackTraceInFastThrow (still under review). It introduces an extension to the Whitebox API to expose the decompile, deopt and trap counters which is also required for testing JDK-8273563. I think (and hope) it will also be helpful for others in the future.


Progress

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

Issue

  • JDK-8275908: Record null_check traps for calls and array_check traps in the interpreter

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6541

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 24, 2021

👋 Welcome back simonis! 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 label Nov 24, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 24, 2021

@simonis 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 Nov 24, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 24, 2021

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Otherwise, it looks good to me! But would be good to get a second review for it.

Nice test!

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Nice change! Looks good to me besides what was already said.

src/hotspot/share/opto/graphKit.cpp Outdated Show resolved Hide resolved
…ava test. Includes minor fixes requested by Martin and Christian
@simonis
Copy link
Member Author

@simonis simonis commented Nov 25, 2021

@TheRealMDoerr, @chhagedorn thanks a lot for the quick reviews.

I hope I could address all your concerns and suggestions with my latest push.

@chhagedorn: I'm especially happy that you like the tests. As all too often the effort for a good test is much higher than for the fix itself :)

Copy link
Member

@chhagedorn chhagedorn left a comment

Thanks for doing the changes, they look good to me!

@chhagedorn: I'm especially happy that you like the tests. As all too often the effort for a good test is much higher than for the fix itself :)

Yes, I couldn't agree more to that. It's sometimes underestimated how much time that is needed to come up with a good test. So, I always appreciate the extra effort :)

@openjdk
Copy link

@openjdk openjdk bot commented Nov 26, 2021

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

8275908: Record null_check traps for calls and array_check traps in the interpreter

Reviewed-by: chagedorn, mdoerr

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

  • 040b2c5: 8277139: Improve code readability in PredecessorValidator (c1_IR.cpp)
  • 3e798dd: 8275330: C2: assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
  • 99e4bda: 8277417: C1 LIR instruction for load-klass
  • 00a6238: 8277508: need to check has_predicated_vectors before calling scalable_predicate_reg_slots
  • 3383c0d: 8277659: [TESTBUG] Microbenchmark ThreadOnSpinWaitProducerConsumer.java hangs
  • 7e54d06: 8277165: jdeps --multi-release --print-module-deps fails if module-info.class in different versioned directories
  • eb4d886: 8277504: Use String.stripTrailing instead of hand-crafted method in SwingUtilities2
  • 9879920: 8277825: Remove unused ReferenceProcessorPhaseTimes::_sub_phases_total_time_ms
  • f788834: 8277786: G1: Rename log2_card_region_per_heap_region used in G1CardSet
  • 3034ae8: 8277631: ZGC: CriticalMetaspaceAllocation asserts
  • ... and 15 more: https://git.openjdk.java.net/jdk/compare/d085c2b8a790a5ddfbb01a0ea4edd4051cfb704b...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 label Nov 26, 2021
@simonis
Copy link
Member Author

@simonis simonis commented Nov 26, 2021

Thanks for the approval @chhagedorn .

I found that the new Decompile.java test failed on linux/x86_32. The reason for this is that 32-bit builds don't include JVMCI and without JMVCI the bimorphic inlining trap is called just bimorphic (in contrast to bimorphic_or_optimized_type_check for JVMCI builds`).

The fix is trivial and I hope your approval is also valid for the latest version :)

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Right, non-JVMCI platforms need this fix (also PPC and s390). LGTM, now. We'll retest it.

Copy link
Member

@chhagedorn chhagedorn left a comment

Good catch! Looks good.

@simonis
Copy link
Member Author

@simonis simonis commented Nov 26, 2021

/integrate

@simonis
Copy link
Member Author

@simonis simonis commented Nov 26, 2021

Thanks @chhagedorn, @TheRealMDoerr !

@openjdk
Copy link

@openjdk openjdk bot commented Nov 26, 2021

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

  • 3d810ad: 8277411: C2 fast_unlock intrinsic on AArch64 has unnecessary ownership check
  • ce0234b: 8277860: PPC: Remove duplicate info != NULL check
  • 040b2c5: 8277139: Improve code readability in PredecessorValidator (c1_IR.cpp)
  • 3e798dd: 8275330: C2: assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
  • 99e4bda: 8277417: C1 LIR instruction for load-klass
  • 00a6238: 8277508: need to check has_predicated_vectors before calling scalable_predicate_reg_slots
  • 3383c0d: 8277659: [TESTBUG] Microbenchmark ThreadOnSpinWaitProducerConsumer.java hangs
  • 7e54d06: 8277165: jdeps --multi-release --print-module-deps fails if module-info.class in different versioned directories
  • eb4d886: 8277504: Use String.stripTrailing instead of hand-crafted method in SwingUtilities2
  • 9879920: 8277825: Remove unused ReferenceProcessorPhaseTimes::_sub_phases_total_time_ms
  • ... and 17 more: https://git.openjdk.java.net/jdk/compare/d085c2b8a790a5ddfbb01a0ea4edd4051cfb704b...master

Your commit was automatically rebased without conflicts.

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

@openjdk openjdk bot commented Nov 26, 2021

@simonis Pushed as commit 40fef23.

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

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Nov 27, 2021

The new tests are not written correctly and are causing failures in our tier3 CI runs.

If you set an explicit GC on the @run line then you have to ensure no GC option is passed in when running jtreg, else you get two GC's requested and the test fails to run.

https://bugs.openjdk.java.net/browse/JDK-8277878

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