summaryrefslogtreecommitdiff
path: root/compiler/optimizing/intrinsics_utils.h
diff options
context:
space:
mode:
author Ulya Trafimovich <skvadrik@google.com> 2021-09-06 16:53:56 +0100
committer Treehugger Robot <treehugger-gerrit@google.com> 2021-10-11 15:11:52 +0000
commita3fe0452f6972218fce5aacd81ced3dc20ea482d (patch)
treebd6b748011c13a25fa31755f8ec27b170cb09999 /compiler/optimizing/intrinsics_utils.h
parent492649b718eed0c5834766b8a49ccbe9d86cf49a (diff)
x86_64: Implement VarHandle.get{,Acquire,Opaque,Volatile} for arrays.
Benchmarks improvements (using benchmarks provided by https://android-review.googlesource.com/1420959): benchmark before after ----------------------------------------------------- VarHandleGetArrayElementInt 2.725 0.002 VarHandleGetArrayElementString 2.778 0.003 Bug: 71781600 Test: lunch aosp_cf_x86_64_phone-userdebug \ && art/test.py --host -r -t 712-varhandle-invocations --64 Test: Repeat with ART_USE_READ_BARRIER=false. Test: Repeat with ART_HEAP_POISONING=true. Change-Id: Ie9c6cef4ef3cf459cbfebbc17d1f449c489ec357
Diffstat (limited to 'compiler/optimizing/intrinsics_utils.h')
-rw-r--r--compiler/optimizing/intrinsics_utils.h12
1 files changed, 12 insertions, 0 deletions
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_