diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2013-09-12 21:33:12 -0700 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2013-09-25 20:28:49 -0700 |
commit | 3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5 (patch) | |
tree | 5298ccd9c1f1f6b329c0cb6cefac6a8df43dd633 /runtime/mirror/array.h | |
parent | f7e090ebcded6d6693894c018d89c4add79253ff (diff) | |
download | art-3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5.zip art-3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5.tar.gz art-3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5.tar.bz2 |
Split the allocation path into 'instrumented' and 'uninstrumented'
ones.
The instrumented path is equivalent to the existing allocation path
that checks for three instrumentation mechanisms (the debugger
allocation tracking, the runtime allocation stats collection, and
valgrind) for every allocation. The uinstrumented path does not
perform these checks. We use the uninstrumented path by default and
enable the instrumented path only when any of the three mechanisms is
enabled. The uninstrumented version of Heap::AllocObject() is inlined.
This change improves the Ritz MemAllocTest by ~4% on Nexus 4 and ~3%
on Host/x86.
Bug: 9986565
Change-Id: I3e68dfff6789d77bbdcea98457b694e1b5fcef5f
Diffstat (limited to 'runtime/mirror/array.h')
-rw-r--r-- | runtime/mirror/array.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h index db6132d..570dcaa 100644 --- a/runtime/mirror/array.h +++ b/runtime/mirror/array.h @@ -27,10 +27,24 @@ class MANAGED Array : public Object { // A convenience for code that doesn't know the component size, // and doesn't want to have to work it out itself. static Array* Alloc(Thread* self, Class* array_class, int32_t component_count) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return AllocInstrumented(self, array_class, component_count); + } + static Array* AllocUninstrumented(Thread* self, Class* array_class, int32_t component_count) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static Array* AllocInstrumented(Thread* self, Class* array_class, int32_t component_count) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static Array* Alloc(Thread* self, Class* array_class, int32_t component_count, size_t component_size) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return AllocInstrumented(self, array_class, component_count, component_size); + } + static Array* AllocUninstrumented(Thread* self, Class* array_class, int32_t component_count, + size_t component_size) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static Array* AllocInstrumented(Thread* self, Class* array_class, int32_t component_count, + size_t component_size) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static Array* CreateMultiArray(Thread* self, Class* element_class, IntArray* dimensions) |