-
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
base: lworld
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5197,15 +5197,22 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { | |
| // 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) && | ||
| const bool is_src_abstract_flat_value_array = orig_t != nullptr && !orig_t->elem()->is_inlinetypeptr() && orig_t->is_flat(); | ||
| const bool can_dest_be_value_class_array = tklass->can_be_inline_array(); | ||
| const bool is_dest_abstract_flat_value_class_array = can_dest_be_value_class_array && tklass->is_flat() && | ||
| !tklass->is_aryklassptr()->elem()->is_instklassptr()->instance_klass()->is_inlinetype(); | ||
| const bool is_abstract_flat_value_class_array_involved = is_src_abstract_flat_value_array || is_dest_abstract_flat_value_class_array; | ||
| 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 || | ||
| (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()); | ||
| can_dest_be_value_class_array && (!tklass->is_flat() || tklass->is_aryklassptr()->elem()->is_instklassptr()->instance_klass()->as_inline_klass()->contains_oops()))); | ||
|
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. This should also check for
Member
Author
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. I agree. I also took another look at the code again and refactored it a bit to make |
||
| 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); | ||
|
|
||
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 check for
!orig_t->is_not_flat()instead?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 a good idea to cover all the cases where it could be flat. Updated this and the check for
tklassas well accordingly.