summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-01-02 19:07:06 +0000
committer Vladimir Marko <vmarko@google.com> 2018-01-03 14:08:38 +0000
commit38b8b25b7deff92627586405c80182a19e7c18f9 (patch)
tree60c804df353e436d5f783830971bd9d3112caeeb /runtime/class_linker.cc
parentca420e49fc97983c2b49f42823bba68e3af26998 (diff)
ART: Faster type check bitstring initialization.
Reuse depth from recursive call instead of calculating it repeatedly at every level of recursion. Pass pointers by value instead of reference. Test: m test-art-host-gtest Test: testrunner.py --host --jit Bug: 70734806 Change-Id: Idd405a2c3b04adbfd544639358dc562b32e4c34f
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 192517fc5d..727dd14d6a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -462,10 +462,8 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b
//
// We take the lock here to avoid using NO_THREAD_SAFETY_ANALYSIS.
MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
- mirror::Class* java_lang_Object_ptr = java_lang_Object.Get();
- SubtypeCheck<mirror::Class*>::EnsureInitialized(java_lang_Object_ptr);
- mirror::Class* java_lang_Class_ptr = java_lang_Class.Get();
- SubtypeCheck<mirror::Class*>::EnsureInitialized(java_lang_Class_ptr);
+ SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(java_lang_Object.Get());
+ SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(java_lang_Class.Get());
}
// Object[] next to hold class roots.
@@ -1872,8 +1870,7 @@ bool ClassLinker::AddImageSpace(
ScopedTrace trace("Recalculate app image SubtypeCheck bitstrings");
MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
for (const ClassTable::TableSlot& root : temp_set) {
- mirror::Class* root_klass = root.Read();
- SubtypeCheck<mirror::Class*>::EnsureInitialized(root_klass);
+ SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(root.Read());
}
}
}
@@ -5220,8 +5217,7 @@ bool ClassLinker::EnsureInitialized(Thread* self,
// or Overflowed (can be used as a source for IsSubClass check).
{
MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
- ObjPtr<mirror::Class> c_ptr(c.Get());
- SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(c_ptr);
+ SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(c.Get());
// TODO: Avoid taking subtype_check_lock_ if SubtypeCheck is already initialized.
}
const bool success = InitializeClass(self, c, can_init_fields, can_init_parents);