8378560: [lworld] Reflective construction of value object triggers assert in C2#2204
8378560: [lworld] Reflective construction of value object triggers assert in C2#2204merykitty wants to merge 4 commits intoopenjdk:lworldfrom
Conversation
|
👋 Welcome back qamai! A progress list of the required criteria for merging this PR into |
|
@merykitty 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 110 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. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
|
The recognition of "may be larval" seems sufficient. Is it okay if it recognizes non-larval calls like invokespecial on private methods as "may be larval"? Would that create potential regressions? |
|
@liach I think it is okay, values are scalarized when they are pushed onto the stack, so when we invoke a call, the arguments are scalarized already. In addition, |
|
As long as this won't create bugs, I think this should be fine. You can add comments on the DMH and Unsafe methods and linkToSpecial in this patch or I can add the comments as a later cleanup. |
|
I think it is better to leave it to a following PR, as it touches unrelated files, and the documentation should also clarify what is undefined behavior, this is my draft. |
chhagedorn
left a comment
There was a problem hiding this comment.
Otherwise, looks good, thanks!
| bool mismatch() const; | ||
|
|
||
| // Generally, a method cannot return a larval object or receive a larval argument. There are some | ||
| // exceptions. |
There was a problem hiding this comment.
Can you also give a description about the exceptions here? Maybe you can also move it to the definition to easier follow the cases outlined.
There was a problem hiding this comment.
Thanks a lot for your review, I have added the description to state the examples at the definition sites.
There was a problem hiding this comment.
Thanks a lot, that is very helpful!
|
Thanks a lot for your review. /integrate |
|
Going to push as commit 3c48db9.
Your commit was automatically rebased without conflicts. |
|
@merykitty Pushed as commit 3c48db9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
Reflective construction of value object triggers assert in C2 because it does not follow the normal object construction pattern and is technically UB because we try to return a larval object from a method. I was told that this is required for the construction of hidden classes, but to me it seems like we put those restrictions on ourselves and shoot ourselves in the foot by using these
Unsafehacks.This PR tries to fix this issue by letting the compiler know of these methods which can return or accept larval objects. Note that this is pretty fragile, and seemingly harmless changes to the code shape generated by the
MethodHandlemechanism can break it, which is a usual symptom of undefined behaviour.Please take a look and leave your review, thanks a lot.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2204/head:pull/2204$ git checkout pull/2204Update a local copy of the PR:
$ git checkout pull/2204$ git pull https://git.openjdk.org/valhalla.git pull/2204/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2204View PR using the GUI difftool:
$ git pr show -t 2204Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2204.diff
Using Webrev
Link to Webrev Comment