-
Notifications
You must be signed in to change notification settings - Fork 176
8382226: [lworld] C2: Fix _copyOf/_copyOfRange intrinsic for flat abstract value class arrays #2569
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
Open
chhagedorn
wants to merge
4
commits into
openjdk:lworld
Choose a base branch
from
chhagedorn:JDK-8382226
base: lworld
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+193
−12
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5193,19 +5193,30 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { | |
|
|
||
| // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc. | ||
| // Bail out if that is so. | ||
| // Inline type array may have object field that would require a | ||
| // write barrier. Conservatively, go to slow path. | ||
| // TODO 8251971: Optimize for the case when flat src/dst are later found | ||
| // to not contain oops (i.e., move this check to the macro expansion phase). | ||
| // TODO 8382226: Revisit for flat abstract value class arrays | ||
| BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); | ||
| const TypeAryPtr* orig_t = _gvn.type(original)->isa_aryptr(); | ||
| const TypeKlassPtr* tklass = _gvn.type(klass_node)->is_klassptr(); | ||
| bool exclude_flat = UseArrayFlattening && bs->array_copy_requires_gc_barriers(true, T_OBJECT, false, false, BarrierSetC2::Parsing) && | ||
| // Can src array be flat and contain oops? | ||
| (orig_t == nullptr || (!orig_t->is_not_flat() && (!orig_t->is_flat() || orig_t->elem()->inline_klass()->contains_oops()))) && | ||
| // Can dest array be flat and contain oops? | ||
| tklass->can_be_inline_array() && (!tklass->is_flat() || tklass->is_aryklassptr()->elem()->is_instklassptr()->instance_klass()->as_inline_klass()->contains_oops()); | ||
| const TypeAryKlassPtr* dest_klass_t = _gvn.type(klass_node)->is_klassptr()->isa_aryklassptr(); | ||
| const bool can_src_be_abstract_flat_value_class_array = orig_t != nullptr && !orig_t->elem()->is_inlinetypeptr() && !orig_t->is_not_flat(); | ||
| const bool can_dest_be_value_class_array = dest_klass_t != nullptr && dest_klass_t->can_be_inline_array(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if |
||
| const bool can_dest_be_abstract_flat_value_class_array = can_dest_be_value_class_array && !dest_klass_t->is_not_flat() && | ||
| !dest_klass_t->elem()->is_instklassptr()->instance_klass()->is_inlinetype(); | ||
| const bool is_abstract_flat_value_class_array_involved = can_src_be_abstract_flat_value_class_array || can_dest_be_abstract_flat_value_class_array; | ||
| const bool can_src_be_flat_with_oops = orig_t == nullptr || | ||
| (!can_src_be_abstract_flat_value_class_array && | ||
| !orig_t->is_not_flat() && (!orig_t->is_flat() || orig_t->elem()->inline_klass()->contains_oops())); | ||
| const bool can_dest_be_flat_with_oops = can_dest_be_value_class_array && !can_dest_be_abstract_flat_value_class_array && | ||
| !dest_klass_t->is_not_flat() && | ||
| (!dest_klass_t->is_flat() || dest_klass_t->elem()->is_instklassptr()->instance_klass()->as_inline_klass()->contains_oops()); | ||
|
|
||
| const bool exclude_flat = UseArrayFlattening && | ||
| // We do not know the exact layout of an abstract flat value class array. Bail out. | ||
| (is_abstract_flat_value_class_array_involved || | ||
| // Value class array may have object field that would require a write barrier. | ||
| // Conservatively, go to slow path. | ||
| // TODO 8251971: Optimize for the case when flat src/dst are later found to not contain | ||
| // oops (i.e., move this check to the macro expansion phase). | ||
| (bs->array_copy_requires_gc_barriers(true, T_OBJECT, false, false, BarrierSetC2::Parsing) && | ||
| can_src_be_flat_with_oops && can_dest_be_flat_with_oops)); | ||
| Node* not_objArray = exclude_flat ? generate_non_refArray_guard(klass_node, bailout) : generate_typeArray_guard(klass_node, bailout); | ||
|
|
||
| Node* refined_klass_node = load_default_refined_array_klass(klass_node, /* type_array_guard= */ false); | ||
|
|
||
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
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.
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.
This name is a little misleading, I think you want to catch the case
orig_t == nullptrbelow, but if the static type isj.l.O, the runtime type can still be an abstract flat array.