-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8271202: C1: assert(false) failed: live_in set of first block must be empty #6683
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
8271202: C1: assert(false) failed: live_in set of first block must be empty #6683
Conversation
👋 Welcome back mdoerr! A progress list of the required criteria for merging this PR into |
@TheRealMDoerr The following label will be automatically applied to this pull request:
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. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's quite an expensive search. Wouldn't it be cheaper to bail out where an invalid phi is used? As in LIRGenerator::move_to_phi
? And save on the extra traversal of the whole thing?
Thanks for looking at it! I don't like my lengthy code so much, either. However, I haven't found a better place where we can check this. I don't think |
How uncommon is it? |
It usually never happens with standard configuration. In some cases when JVMTI capability I don't think this PR is ready for integration, but it finds out interesting things which should not happen IMHO. |
I took a deeper look and I added a comment to bug report. The root cause seems to be because of the irreducible loops (and therefore an unusual block traversal order when inserting phis) the phi invalidation logic in try_merge() doesn't invalidate phis that have invalid locals as inputs. I've attached a drawing: Suggested fix:
|
Do you want me to take over this issue? |
I think we should at least fix/find such illegal use in state merging rather than LIR generation, that's far beyond where problem occurs |
TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch%s", | ||
index, new_value == NULL ? " (new_value is NULL)" : "")); | ||
// Check if illegal phi gets used. | ||
SearchUsageClosure search(existing_phi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add something like "FIXME" comment to indicate this is a workaround and we need further investigation to solve it?
To find it you basically need another pass. I don't want to introduce another pass just to find an extremely rare situation. Piggybacking on the LIR generation pass is the most cache-friendly place I can think of. In fact, there is already a related bailout in I also don't think that this is necessarily even fixable. We artificially stretch the local liveness and that with conjunction with irreducible loops can create unmergable states. I think bailing out is appropriate. It is a very rare case. |
Alright, we're tight on time with P3 for 18. I'm going to put out a corresponding PR. |
Issue is fixed by openjdk/jdk18@54b800d. I wonder if we still have a potential problem when an illegal phi gets used. That can still happen (not in the provided |
I have written a checker which detects usage of the illegal phi function. In case of the reproducer provided in the JBS bug ("Reduced.java"), it finds the following and bails out:
I haven't checked why that node uses the illegal phi. That still seems to be a bug. Maybe there's a better solution to the underlying problem, but I hope my checker is useful to analyze bugs and to make C1 more resilient.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6683/head:pull/6683
$ git checkout pull/6683
Update a local copy of the PR:
$ git checkout pull/6683
$ git pull https://git.openjdk.java.net/jdk pull/6683/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6683
View PR using the GUI difftool:
$ git pr show -t 6683
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6683.diff