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
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index cb1fbfe..ef0d72f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7090,7 +7090,9 @@
MethodNameAndSignatureComparator name_comparator(
vtable_entry->GetInterfaceMethodIfProxy(kPointerSize));
for (int32_t j = i + 1; j < num_entries; j++) {
- ArtMethod* other_entry = vtable->GetElementPtrSize<ArtMethod*, kPointerSize>(j);
+ // Can use Unchecked here as the outer loop already ensured that the arrays are correct
+ // wrt/ kPointerSize.
+ ArtMethod* other_entry = vtable->GetElementPtrSizeUnchecked<ArtMethod*, kPointerSize>(j);
if (!klass->CanAccessMember(other_entry->GetDeclaringClass(),
other_entry->GetAccessFlags())) {
continue;