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

Galder Zamarreño galder at openjdk.org
Tue Jul 22 10:49:33 UTC 2025


On Mon, 21 Jul 2025 14:38:59 GMT, Feilong Jiang <fjiang at openjdk.org> wrote:

>> 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

Hmmm, I don't think I like that name. It's too specific on the flags but does not convey what it's used for. The aim of `flag=0` was to avoid instantiation of array copy stubs, so maybe the name could be `init_flags_for_copy_stubs`? It could be prepended with a `get_` if needs be to avoid confusion.

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

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


More information about the hotspot-compiler-dev mailing list