8377715: Thawing frame can undo deoptimization#30634
Open
pchilano wants to merge 1 commit intoopenjdk:masterfrom
Open
8377715: Thawing frame can undo deoptimization#30634pchilano wants to merge 1 commit intoopenjdk:masterfrom
pchilano wants to merge 1 commit intoopenjdk:masterfrom
Conversation
|
👋 Welcome back pchilanomate! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Contributor
Author
|
/label remove core-libs, hotspot-runtime |
Contributor
Author
|
/label add hotspot |
|
@pchilano The |
|
@pchilano |
|
@pchilano |
Contributor
Author
|
/label remove core-libs |
|
@pchilano |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please review the following fix. When thawing frames in the slow path, the call to
patch()can undo the deoptimization of the caller frame here:jdk/src/hotspot/share/runtime/continuationFreezeThaw.cpp
Lines 2593 to 2597 in 67f590d
The
elsebranch is executed regardless of whether the frame was deoptimized during thaw, under the assumption, as the comment states, that if it was not, the pc written will be same as existing one. The problem with that assumption is that if the frame was already deoptimized before thaw,caller.raw_pc()will not return the deoptimized pc but the original one before deoptimization. This is because when creating the frame object, the actual frame is not yet laid out in the stack and socaller.is_deoptimized_frame()is always false (see comment here).The proposed fix is to only execute the
elsebranch for the case where the caller frame was indeed deoptimized inrecurse_thaw_compiled_frame. I also added extra asserts to verify the return pc saved on the stack after thawing a frame is the correct one.I added a new test that fails without this fix and passes with it. As I explained in the JBS comment, the bug is not that trivial to expose (without using
WhiteBox) because of the post call nop mechanism which still forces deoptimization when returning to the nmethod. The test exercises the monitorenter case where this mechanism is not present. Still, we need to force deoptimization of the top compiled frame during the monitorenter call itself, as the frame needs to be already deoptimized when freezing. So the test relies on theMonitorContendedEnterevent as a blocking point for deoptimizing it. I could have usedWhiteBoxinstead to construct the test and call into the VM to inspect frame state, but I wanted to show that a real issue exists because of this bug.I also run the patch through mach5 tiers 1-7.
Thanks,
Patricio
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30634/head:pull/30634$ git checkout pull/30634Update a local copy of the PR:
$ git checkout pull/30634$ git pull https://git.openjdk.org/jdk.git pull/30634/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30634View PR using the GUI difftool:
$ git pr show -t 30634Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30634.diff
Using Webrev
Link to Webrev Comment