-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8358781: C2 fails with assert "bad profile data type" when TypeProfileCasts is disabled #26640
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
Conversation
|
👋 Welcome back snatarajan! A progress list of the required criteria for merging this PR into |
|
@sarannat 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: 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 125 new commits pushed to the
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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mhaessig, @dafedafe, @vnkozlov) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
mhaessig
left a comment
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.
Thank you for working on this, @sarannat! The fix seems reasonable to me since GraphKit::maybe_cast_profiled_receiver has a similar exception.
However, you are missing a regression test or a noreg-* label in JBS. However, in this case, I think a small regression test is warranted.
dafedafe
left a comment
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.
|
@mhaessig and @dafedafe : Thank you for the review. I have now added a test case. |
mhaessig
left a comment
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.
Thank you for adding the test. Apart from my question, this looks good to me.
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| for (int i = 0; i < 100_000; i++) { |
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.
Do you really need 100'000 iterations to get it to compile or can you reduce it a bit?
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.
I have reduced this to 100 after I checked that the (new) test fails without the current fix.
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.
Excellent, thank you!
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.
You can also use -XX:CompileThresholdScaling=f (specify f as 0.1, for example) flag to trigger compilation early to make sure 100 is enough.
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.
Thank you for the suggestion. The test works without this addition. However, I have added
-XX:CompileThresholdScaling=0.01 to be on safe side.
vnkozlov
left a comment
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.
Looks good.
|
Thank you for the review. Please sponsor |
|
/integrate |
|
/sponsor |
|
Going to push as commit 2b756ab.
Your commit was automatically rebased without conflicts. |
Issue
An error,
assert(data->is_ReceiverTypeData()) failed: bad profile data type, is encountered during C2 compilation due to bad profile data. This occurs when the code is compiled withTypeProfileCastsoption disabled.Analysis
The assertion failure occurs in
record_profiled_receiver_for_speculationthat analyzes the profiling information in the method data to determine whether a null value has been observed in theinstanceofoperation. This information is encoded in theBitDataduring profiling. When the method identifies that a null has been seen, it proceeds to inspect the associatedReceiverTypeDatato see if the type check is always performed against null. However, in this scenario, the incoming profiling data is of typeBitDatarather thanReceiverTypeData, leading to the assertion failure.The profiling information for null seen for operations
aastore,instanceof, andcheckcastis recorded by the methodprofile_null_seen(insrc/hotspot/cpu/x86/templateTable_x86.cpp). On investigating this method, it can be observed that the method data pointer is not updated forVirtualCallData(which is a subclass ofReceiverTypeData) when theTypeProfileCastsoption is disabled.Solution
My proposal is to inspect the
ReceiverTypeDatain functionrecord_profiled_receiver_for_speculationonly ifTypeProfileCastsis enabled (this is based on the fact that the relevant method data pointer is not updated whenTypeProfileCastsis disabled).Question to reviewers
Do you think this is a reasonable fix ?
Testing
GitHub Actions
tier1 to tier3 on windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26640/head:pull/26640$ git checkout pull/26640Update a local copy of the PR:
$ git checkout pull/26640$ git pull https://git.openjdk.org/jdk.git pull/26640/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26640View PR using the GUI difftool:
$ git pr show -t 26640Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26640.diff
Using Webrev
Link to Webrev Comment