RFR: 8360520: RISC-V: C1: Fix primitive array clone intrinsic regression after JDK-8333154 [v5]

Feilong Jiang fjiang at openjdk.org
Mon Jul 21 14:41:43 UTC 2025


On Mon, 21 Jul 2025 08:26:34 GMT, Galder Zamarreño <galder at openjdk.org> wrote:

>> Feilong Jiang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>> 
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into riscv-fix-c1-primitive-clone
>>  - also keep overlapping flag
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into riscv-fix-c1-primitive-clone
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into riscv-fix-c1-primitive-clone
>>  - Revert RISCV Macro modification
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into riscv-fix-c1-primitive-clone
>>  - check unaligned flag at LIR_OpArrayCopy to avoid using AvoidUnalignedAccesses
>>  - riscv: fix c1 primitive array clone intrinsic regression
>
> src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp line 775:
> 
>> 773:   arraycopy_helper(x, &flags, &expected_type);
>> 774:   if (x->check_flag(Instruction::OmitChecksFlag)) {
>> 775:     flags = (flags & (LIR_OpArrayCopy::unaligned | LIR_OpArrayCopy::overlapping));
> 
> The changes in the two files need to be in synch, so I wonder if `LIR_OpArrayCopy::unaligned | LIR_OpArrayCopy::overlapping` could be abstracted away within a function in `LIR_OpArrayCopy`.
> 
> So something like this (apologies for any syntactic/semantic errors):
> 
> 
> flags = (flags & LIR_OpArrayGopy::get_array_copy_flags());
> 
> 
> Then on the other method something like:
> 
> 
> ((flags & ~(LIR_OpArrayGopy::get_array_copy_flags())) == 0)
> 
> 
> Function name is just an example, feel free to suggest some other if you think it fits better.
> 
> Thoughts?

Adding new flag check routines seems like a good idea, but it's a bit challenging to choose a name, as there are too many flags for `LIR_OPArrayCopy`[1]. Perhaps something like `should_check_unaligned_or_overlapping` would be suitable?

1. https://github.com/openjdk/jdk/blob/15b5b54ac707ba0d4e473fd6eb02c38a8efe705c/src/hotspot/share/c1/c1_LIR.hpp#L1257-L1271

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25976#discussion_r2219422716


More information about the hotspot-compiler-dev mailing list