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
8253416: [lworld] C1: incorrect nestmate access to flattened field if nest-host is not loaded #198
Conversation
… nest-host is not loaded
|
@TobiHartmann This change now passes all automated pre-integration checks. 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 no new commits pushed to the
|
Tobias, I'm still reviewing the code, but here are already two comments: 1 - the empty inline type optimization can be applied to load_indexed() and store_indexed() too. Regards, Fred |
Hi Fred, thanks for the quick review!
Yes, there are even more optimization opportunities and I'll address these with JDK-8248220. I've only added the empty field load/store removal here for correctness because otherwise we miss adding a null check (see re-enabled
If Thanks, |
Tobias,
Thank you for the explanation on the needs_patching flag and the Withfield node.
So, did you keep the needs_patching argument in the copy_inline_content() method only for verification purpose?
Overall, changes look good to me.
Fred
Thanks a lot for the review! |
Yes, but we could also move the assert into the caller. What do you prefer? |
I'm fine with both approaches (assert in the caller or in copy_inline_content()), just pick the solution you think is the safest (I don't think it makes a lot of difference from a performance point of view). Fred |
Thanks. I'll go with the current version and think about refactoring with JDK-8228634. |
/integrate |
@TobiHartmann Pushed as commit 268a9ad. |
C1 incorrectly assumes that a nestmate field access is not flat if the nest-host is not loaded.
We are creating the ciField instance for a field in the nest-host via:
ciField::ciField -> Reflection::verify_member_access -> InstanceKlass::has_nestmate_access_to -> InstanceKlass::nest_host
Resolving the nest host then requires class loading which is not possible from the C1 compiler thread and as a result we end up with partial field information (is_flattened is always false). The code in LIRGenerator::flattened_field_load_prolog then assumes that if !field->is_flattened(), the field is indeed not flattened. However, we can only rely on that information if !needs_patching.
I've completely re-wrote and simplified the complex logic in LIRGenerator::flattened_field_load_prolog and added asserts/checks to make sure we are not attempting to patch flattened inline type field accesses (that functionality could be added though but it's not easy).
This patch also includes the following unrelated changes:
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/valhalla pull/198/head:pull/198
$ git checkout pull/198