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

8255233: InterpreterRuntime::at_unwind should be a JRT_LEAF #828

Closed
wants to merge 4 commits into from

Conversation

fisk
Copy link
Contributor

@fisk fisk commented Oct 23, 2020

InterpreterRuntime::at_unwind is called at the very beginning of remove_activation(), to notify concurrent stack processing that a frame is about to be unwound. It is currently a JRT_ENTRY, because it needs a last_Java_frame to see what frame is about to get unwound.

However, there are special return paths used by JVMTI pop frame, that checks if the caller frame is deoptimized, then calls a special path that removes the top activation, assuming that does not enter the deopt handler. The new JRT_ENTRY makes that reasoning invalid.

Therefore, we need this to be a JRT_LEAF, that sets a last Java frame, to make everyone happy. This patch performs that change.

I have run tier 1-5 testing, and manually tested:

while true; do make test JTREG="RETAIN=all" TEST=open/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002 TEST_OPTS_JAVA_OPTIONS="-XX:+UseZGC -Xmx2g -XX:ZCollectionInterval=0.0001 -XX:ZFragmentationLimit=0.01 -XX:+VerifyOops -XX:+ZVerifyViews" ; done

Before the fix it crashes ~1/15 runs with a bad oop. After the fix, it doesn't crash. I have run it more times than my tmux buffer fits (for a day), and it does not fail any more with this fix.

Unfortunately, my testing on AArch64 has been stalled for a day, so I have sent out this PR without the testing of those bits being finished. I won't push until I get the results back, of course. But I am expecting that to be fine, as there is nothing special going on there and it compiles. Will post a comment when the complete results have arrived.


Progress

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

Testing

Linux x32 Linux x64 Windows x64 macOS x64
Build ✔️ (1/1 passed) ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) (1/9 failed) ✔️ (9/9 passed)

Failed test task

Issue

  • JDK-8255233: InterpreterRuntime::at_unwind should be a JRT_LEAF

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/828/head:pull/828
$ git checkout pull/828

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2020

👋 Welcome back eosterlund! 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 Oct 23, 2020
@openjdk
Copy link

openjdk bot commented Oct 23, 2020

@fisk 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 hotspot-dev@openjdk.org label Oct 23, 2020
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2020

Webrevs

@fisk
Copy link
Contributor Author

fisk commented Oct 26, 2020

The delayed AArch64 test results are in: looking good as expected. However the github bot complained about x86 32 bit needing a cast, so hopefully fixed that now. I guess we will see what the bot has to say. Thank you bot for finding that.

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.

LGTM.

@openjdk
Copy link

openjdk bot commented Oct 26, 2020

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

8255233: InterpreterRuntime::at_unwind should be a JRT_LEAF

Reviewed-by: coleenp, dholmes

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

  • 591e7e2: 8255378: [Vector API] Remove redundant vector length check after JDK-8254814 and JDK-8255210
  • 2c9dfc7: 8255234: ZGC: Bulk allocate forwarding data structures
  • b7d483c: 8255245: C1: Fix output of -XX:+PrintCFGToFile to open it with visualizer
  • 5e0a8cd: 8255488: Re-enable some problem listed tests
  • 3f8bd92: 8233556: [TESTBUG] JPopupMenu tests fail on MacOS
  • 4acf634: 8171998: javax/swing/JMenu/4692443/bug4692443.java fails on Windows
  • a804c6a: 8254871: Remove unnecessary string copy in NetworkInterface.c
  • acd0e25: 8255254: Split os::reserve_memory and os::map_memory_to_file interfaces
  • dc85a3f: 8015602: [macosx] Test javax/swing/SpringLayout/4726194/bug4726194.java fails on MacOSX
  • 1d245c6: 8252117: com/sun/jdi/BadHandshakeTest.java failed with "ConnectException: Connection refused: connect"
  • ... and 67 more: https://git.openjdk.java.net/jdk/compare/4634dbef6d554b6f091dd7893e266682b267757f...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 26, 2020
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Seems okay.

One minor requested change below.

Thanks,
David

JRT_LEAF(void, InterpreterRuntime::at_unwind(JavaThread* thread))
// JRT_END does an implicit safepoint check, hence we are guaranteed to block
// if this is called during a safepoint
Copy link
Member

Choose a reason for hiding this comment

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

The comments are no longer valid. The implicit safepoint check came from the use of ThreadInVMfromJava as part of the JRT_ENTRY.

Also it is far from obvious that StackWatermarkSet::before_unwind meets all the requirements of a JRT_LEAF method. Please assure me it is. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch. I removed the out of date comments.
Regarding the leafness of the operation: the operations performed in the stack watermark are indeed designed to run in such conditions. When the callbacks are executed, verification code is run, asserting we are not in a state ignored by the GC. It would never work to have code that transitions inside of such callbacks. Today, it merely applies some GC barriers, similar to performing an access API call.
Having said that, despite not transitioning in this code path, I do make the stack walkable when calling this method, so that the barrier can see what the last_Java_frame is, and figure out if action needs to be taken or not. But we do that for other leaf functions as well, and that is fine. The crucial thing is that there are zero transitions, which I can assure you of. In particular, the thread will be _in_java throughout the entire operation.

Thanks for the review!

@fisk
Copy link
Contributor Author

fisk commented Oct 27, 2020

LGTM.

Thanks for the review.

@fisk
Copy link
Contributor Author

fisk commented Oct 28, 2020

/integrate

@openjdk openjdk bot closed this Oct 28, 2020
@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 Oct 28, 2020
@openjdk
Copy link

openjdk bot commented Oct 28, 2020

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

  • bbf0a31: 8255397: x86: coalesce reference and int entry points into vtos bytecodes
  • 3bd5b80: 8243583: Change 'final' error checks to throw ICCE
  • 1f00c3b: 8255527: Shenandoah: Let ShenadoahGCStateResetter disable barriers
  • 3c4fc79: 8255299: Drop explicit zeroing at instantiation of Atomic* objects
  • 6b2d11b: 8255246: AArch64: Implement BigInteger shiftRight and shiftLeft accelerator/intrinsic
  • 591e7e2: 8255378: [Vector API] Remove redundant vector length check after JDK-8254814 and JDK-8255210
  • 2c9dfc7: 8255234: ZGC: Bulk allocate forwarding data structures
  • b7d483c: 8255245: C1: Fix output of -XX:+PrintCFGToFile to open it with visualizer
  • 5e0a8cd: 8255488: Re-enable some problem listed tests
  • 3f8bd92: 8233556: [TESTBUG] JPopupMenu tests fail on MacOS
  • ... and 72 more: https://git.openjdk.java.net/jdk/compare/4634dbef6d554b6f091dd7893e266682b267757f...master

Your commit was automatically rebased without conflicts.

Pushed as commit aaf4f69.

💡 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 hotspot-dev@openjdk.org integrated Pull request has been integrated
3 participants