Skip to content

8360520: RISC-V: C1: Fix primitive array clone intrinsic regression after JDK-8333154 #25976

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
wants to merge 8 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
ciArrayKlass* expected_type = nullptr;
arraycopy_helper(x, &flags, &expected_type);
if (x->check_flag(Instruction::OmitChecksFlag)) {
flags = 0;
flags = (flags & LIR_OpArrayCopy::unaligned);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be LIR_OpArrayCopy::unaligned|LIR_OpArrayCopy::overlapping? See below.

}

__ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/c1/c1_LIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ LIR_OpArrayCopy::LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_
, _expected_type(expected_type)
, _flags(flags) {
#if defined(X86) || defined(AARCH64) || defined(S390) || defined(RISCV64) || defined(PPC64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this #if? It would be nice if we can eventually remove it, but I guess arm32 support is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, ARM32 support is not available, so we have to keep these platform guards for now.

if (expected_type != nullptr && flags == 0) {
if (expected_type != nullptr && ((flags & ~LIR_OpArrayCopy::unaligned) == 0)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned that this is platform-specific, but I checked and all platforms can handle unaligned or overlapping w/o using the stub. So maybe this should be using LIR_OpArrayCopy::unaligned|LIR_OpArrayCopy::overlapping?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, LIR_OpArrayCopy::overlapping was also reset if OmitChecksFlag is true. Added LIR_OpArrayCopy::overlapping too.

_stub = nullptr;
} else {
_stub = new ArrayCopyStub(this);
Expand Down