From f9562dc6e14621961dd5276c6669bf0adb84e149 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 11 Dec 2023 17:02:22 +0000 Subject: riscv64: Clean up the `SystemArrayCopy` intrinsic. Define a new optimization flag for source and destination position match. Use it to avoid the forward-copy check (where the assembler optimized away a BLT instruction, so we had just a useless BNE to the next instruction) and one position sign check. Avoid checking that the position is inside the array. The subsequent subtraction cannot underflow an `int32_t` and the following BLT shall go to the slow path for negative values anyway. Rewrite the array type check to avoid unnecessary checks and read barriers. Use an allocated temporary instead of scratch register for the marking in the read barrier slow path. Simplify the gray bit check and the fake dependency. Use constant position and length locations for small constant values. (It was probably an oversight that we used it only for large constant values.) Emit threshold check when the length equals source or destination length. The old code allowed the intrinsic to process array copy of an arbirary length. Use `ShNAdd()` for faster array address calculations. Use helper functions and lambdas to simplify the code. Pass registers and locations by value. Prefer load/store macro instructions over raw load/store instructions. Use a bare conditional branch to assert the `TMP` shall not be clobbered. Test: testrunner.py --target --64 --ndebug --optimizing Bug: 283082089 Change-Id: I3f697b4a74497d6d712a92450a6a45e772430662 --- compiler/optimizing/nodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 7d9e50e3e7..d84ff7be73 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -253,7 +253,7 @@ class ReferenceTypeInfo : ValueObject { bool IsNonPrimitiveArrayClass() const REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(IsValid()); - return GetTypeHandle()->IsArrayClass() && !GetTypeHandle()->IsPrimitiveArray(); + return IsArrayClass() && !GetTypeHandle()->IsPrimitiveArray(); } bool CanArrayHold(ReferenceTypeInfo rti) const REQUIRES_SHARED(Locks::mutator_lock_) { -- cgit v1.2.3-59-g8ed1b