summaryrefslogtreecommitdiff
path: root/runtime/mirror/array-inl.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2019-02-04 11:18:43 -0800
committer Andreas Gampe <agampe@google.com> 2019-02-05 08:31:26 -0800
commit3aa868aba9cc4d9b61898f7fbfac7a4bccdb74d4 (patch)
treedee7b51a244648fd4b54da71f930f0788ea37f23 /runtime/mirror/array-inl.h
parenta2fed081e33bcc956ebc545aacd654ec6a32673d (diff)
ART: Add unchecked conversions of arrays
Add array conversion functions that do not check the type, and use them in an unchecked version for PointerArray. Decreases dex2oatd preopting of a big app from 151s to 150s. Bug: 123888325 Test: m test-art-host Change-Id: Id58c65ac603a20c2cfb9e3289af4f3bc323554b6
Diffstat (limited to 'runtime/mirror/array-inl.h')
-rw-r--r--runtime/mirror/array-inl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h
index 40507e7aee..c4a892b856 100644
--- a/runtime/mirror/array-inl.h
+++ b/runtime/mirror/array-inl.h
@@ -233,6 +233,15 @@ inline T PointerArray::GetElementPtrSize(uint32_t idx) {
}
return (T)static_cast<uintptr_t>(AsIntArray<kVerifyFlags>()->GetWithoutChecks(idx));
}
+template<typename T, PointerSize kPointerSize, VerifyObjectFlags kVerifyFlags>
+inline T PointerArray::GetElementPtrSizeUnchecked(uint32_t idx) {
+ // C style casts here since we sometimes have T be a pointer, or sometimes an integer
+ // (for stack traces).
+ if (kPointerSize == PointerSize::k64) {
+ return (T)static_cast<uintptr_t>(AsLongArrayUnchecked<kVerifyFlags>()->GetWithoutChecks(idx));
+ }
+ return (T)static_cast<uintptr_t>(AsIntArrayUnchecked<kVerifyFlags>()->GetWithoutChecks(idx));
+}
template<typename T, VerifyObjectFlags kVerifyFlags>
inline T PointerArray::GetElementPtrSize(uint32_t idx, PointerSize ptr_size) {
// C style casts here since we sometimes have T be a pointer, or sometimes an integer