diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-10-23 16:48:06 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-10-27 16:49:43 -0700 |
commit | 2d2621a1463d2f3f03fa73503fa42e43657cdcfc (patch) | |
tree | 1f7cf393693d72db5c186f99b04ac511958c6418 /runtime/handle_scope.h | |
parent | ac293277b69882105810fabd6c53f55de58823fe (diff) | |
download | art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.zip art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.tar.gz art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.tar.bz2 |
Optimize method linking
Added more inlining, removed imt array allocation and replaced it
with a handle scope. Removed some un-necessary handle scopes.
Added logic to base interface method tables from the superclass so
that we dont need to reconstruct for every interface (large win).
Facebook launch Dalvik KK MR2:
TotalTime: 3165
TotalTime: 3652
TotalTime: 3143
TotalTime: 3298
TotalTime: 3212
TotalTime: 3211
Facebook launch TOT before:
WaitTime: 3702
WaitTime: 3616
WaitTime: 3616
WaitTime: 3687
WaitTime: 3742
WaitTime: 3767
After optimizations:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792
LinkInterfaceMethods no longer one of the hottest methods, new list:
4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)
3.07% art::DexFile::FindClassDef(char const*) const
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
2.90% art::DexFile::FindStringId(char const*) const
Bug: 18054905
Bug: 16828525
(cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4)
Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
Diffstat (limited to 'runtime/handle_scope.h')
-rw-r--r-- | runtime/handle_scope.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h index 13c939f..beb7ee0 100644 --- a/runtime/handle_scope.h +++ b/runtime/handle_scope.h @@ -166,11 +166,11 @@ class HandleWrapper : public MutableHandle<T> { template<size_t kNumReferences> class PACKED(4) StackHandleScope FINAL : public HandleScope { public: - explicit StackHandleScope(Thread* self); - ~StackHandleScope(); + explicit ALWAYS_INLINE StackHandleScope(Thread* self, mirror::Object* fill_value = nullptr); + ALWAYS_INLINE ~StackHandleScope(); template<class T> - MutableHandle<T> NewHandle(T* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + ALWAYS_INLINE MutableHandle<T> NewHandle(T* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { SetReference(pos_, object); MutableHandle<T> h(GetHandle<T>(pos_)); pos_++; @@ -178,25 +178,25 @@ class PACKED(4) StackHandleScope FINAL : public HandleScope { } template<class T> - HandleWrapper<T> NewHandleWrapper(T** object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + ALWAYS_INLINE HandleWrapper<T> NewHandleWrapper(T** object) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { SetReference(pos_, *object); MutableHandle<T> h(GetHandle<T>(pos_)); pos_++; return HandleWrapper<T>(object, h); } - private: - template<class T> - ALWAYS_INLINE MutableHandle<T> GetHandle(size_t i) + ALWAYS_INLINE void SetReference(size_t i, mirror::Object* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK_LT(i, kNumReferences); - return MutableHandle<T>(&GetReferences()[i]); + GetReferences()[i].Assign(object); } - ALWAYS_INLINE void SetReference(size_t i, mirror::Object* object) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + private: + template<class T> + ALWAYS_INLINE MutableHandle<T> GetHandle(size_t i) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK_LT(i, kNumReferences); - GetReferences()[i].Assign(object); + return MutableHandle<T>(&GetReferences()[i]); } // Reference storage needs to be first as expected by the HandleScope layout. |