From 3aa868aba9cc4d9b61898f7fbfac7a4bccdb74d4 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 4 Feb 2019 11:18:43 -0800 Subject: 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 --- runtime/mirror/array-inl.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/mirror/array-inl.h') 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(AsIntArray()->GetWithoutChecks(idx)); } +template +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(AsLongArrayUnchecked()->GetWithoutChecks(idx)); + } + return (T)static_cast(AsIntArrayUnchecked()->GetWithoutChecks(idx)); +} template 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 -- cgit v1.2.3-59-g8ed1b