From 5cbb0a9658e4c3a906139df2d1cf5b929d989faf Mon Sep 17 00:00:00 2001 From: Ulyana Trafimovich Date: Tue, 12 Oct 2021 11:33:59 +0000 Subject: Revert^2 "x86_64: Implement VarHandle.get{,Acquire,Opaque,Volatile} for arrays." This reverts commit eb270e4cf873acc6097da5647931cbfd67879864. Reason for revert: relanding original patch. The fix is to use signed comparison when checking out of bounds access (JAE instead of JGE). Bug: 71781600 Bug: 202734548 Change-Id: I4f5e170d293ccd675218b34f906b471de3c19a23 Test: atest CtsLibcoreJsr166TestCases:jsr166.AtomicReferenceArrayTest#testIndexing --- compiler/optimizing/intrinsics_utils.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'compiler/optimizing/intrinsics_utils.h') diff --git a/compiler/optimizing/intrinsics_utils.h b/compiler/optimizing/intrinsics_utils.h index 546d5b3b93..3713b32a6c 100644 --- a/compiler/optimizing/intrinsics_utils.h +++ b/compiler/optimizing/intrinsics_utils.h @@ -146,6 +146,18 @@ static inline bool IsVarHandleGetAndAdd(HInvoke* invoke) { } } +static inline DataType::Type GetVarHandleExpectedValueType(HInvoke* invoke, + size_t expected_coordinates_count) { + DCHECK_EQ(expected_coordinates_count, GetExpectedVarHandleCoordinatesCount(invoke)); + uint32_t number_of_arguments = invoke->GetNumberOfArguments(); + DCHECK_GE(number_of_arguments, /* VarHandle object */ 1u + expected_coordinates_count); + if (number_of_arguments == /* VarHandle object */ 1u + expected_coordinates_count) { + return invoke->GetType(); + } else { + return GetDataTypeFromShorty(invoke, number_of_arguments - 1u); + } +} + } // namespace art #endif // ART_COMPILER_OPTIMIZING_INTRINSICS_UTILS_H_ -- cgit v1.2.3-59-g8ed1b