From be1ca55db3362f5b100c4c65da5342fd299520bb Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Wed, 15 Jan 2014 11:46:48 -0800 Subject: Use direct class pointers at allocation sites in the compiled code. - Rather than looking up a class from its type ID (and checking if it's resolved/initialized, resolving/initializing if not), use direct class pointers, if possible (boot-code-to-boot-class pointers and app-code-to-boot-class pointers.) - This results in a 1-2% speedup in Ritz MemAllocTest on Nexus 4. - Embedding the object size (along with class pointers) caused a 1-2% slowdown in MemAllocTest and isn't implemented in this change. - TODO: do the same for array allocations. - TODO: when/if an application gets its own image, implement app-code-to-app-class pointers. - Fix a -XX:gc bug. cf. https://android-review.googlesource.com/79460/ - Add /tmp/android-data/dalvik-cache to the list of locations to remove oat files in clean-oat-host. cf. https://android-review.googlesource.com/79550 - Add back a dropped UNLIKELY in FindMethodFromCode(). cf. https://android-review.googlesource.com/74205 Bug: 9986565 Change-Id: I590b96bd21f7a7472f88e36752e675547559a5b1 --- runtime/arch/quick_alloc_entrypoints.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/arch/quick_alloc_entrypoints.cc') diff --git a/runtime/arch/quick_alloc_entrypoints.cc b/runtime/arch/quick_alloc_entrypoints.cc index 457c73a2be..0fad82266c 100644 --- a/runtime/arch/quick_alloc_entrypoints.cc +++ b/runtime/arch/quick_alloc_entrypoints.cc @@ -21,12 +21,16 @@ extern "C" void* art_quick_alloc_array##suffix(uint32_t, void*, int32_t); \ extern "C" void* art_quick_alloc_array_with_access_check##suffix(uint32_t, void*, int32_t); \ extern "C" void* art_quick_alloc_object##suffix(uint32_t type_idx, void* method); \ +extern "C" void* art_quick_alloc_object_resolved##suffix(void* klass, void* method); \ +extern "C" void* art_quick_alloc_object_initialized##suffix(void* klass, void* method); \ extern "C" void* art_quick_alloc_object_with_access_check##suffix(uint32_t type_idx, void* method); \ extern "C" void* art_quick_check_and_alloc_array##suffix(uint32_t, void*, int32_t); \ extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix(uint32_t, void*, int32_t); \ extern "C" void* art_quick_alloc_array##suffix##_instrumented(uint32_t, void*, int32_t); \ extern "C" void* art_quick_alloc_array_with_access_check##suffix##_instrumented(uint32_t, void*, int32_t); \ extern "C" void* art_quick_alloc_object##suffix##_instrumented(uint32_t type_idx, void* method); \ +extern "C" void* art_quick_alloc_object_resolved##suffix##_instrumented(void* klass, void* method); \ +extern "C" void* art_quick_alloc_object_initialized##suffix##_instrumented(void* klass, void* method); \ extern "C" void* art_quick_alloc_object_with_access_check##suffix##_instrumented(uint32_t type_idx, void* method); \ extern "C" void* art_quick_check_and_alloc_array##suffix##_instrumented(uint32_t, void*, int32_t); \ extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented(uint32_t, void*, int32_t); \ @@ -35,6 +39,8 @@ void SetQuickAllocEntryPoints##suffix(QuickEntryPoints* qpoints, bool instrument qpoints->pAllocArray = art_quick_alloc_array##suffix##_instrumented; \ qpoints->pAllocArrayWithAccessCheck = art_quick_alloc_array_with_access_check##suffix##_instrumented; \ qpoints->pAllocObject = art_quick_alloc_object##suffix##_instrumented; \ + qpoints->pAllocObjectResolved = art_quick_alloc_object_resolved##suffix##_instrumented; \ + qpoints->pAllocObjectInitialized = art_quick_alloc_object_initialized##suffix##_instrumented; \ qpoints->pAllocObjectWithAccessCheck = art_quick_alloc_object_with_access_check##suffix##_instrumented; \ qpoints->pCheckAndAllocArray = art_quick_check_and_alloc_array##suffix##_instrumented; \ qpoints->pCheckAndAllocArrayWithAccessCheck = art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented; \ @@ -42,6 +48,8 @@ void SetQuickAllocEntryPoints##suffix(QuickEntryPoints* qpoints, bool instrument qpoints->pAllocArray = art_quick_alloc_array##suffix; \ qpoints->pAllocArrayWithAccessCheck = art_quick_alloc_array_with_access_check##suffix; \ qpoints->pAllocObject = art_quick_alloc_object##suffix; \ + qpoints->pAllocObjectResolved = art_quick_alloc_object_resolved##suffix; \ + qpoints->pAllocObjectInitialized = art_quick_alloc_object_initialized##suffix; \ qpoints->pAllocObjectWithAccessCheck = art_quick_alloc_object_with_access_check##suffix; \ qpoints->pCheckAndAllocArray = art_quick_check_and_alloc_array##suffix; \ qpoints->pCheckAndAllocArrayWithAccessCheck = art_quick_check_and_alloc_array_with_access_check##suffix; \ -- cgit v1.2.3-59-g8ed1b