Avoid read barriers for ArtMethod::GetDexFile
Shows up in pmd benchmark from Class::FindDeclaredDirectMethod and
Class::FindDeclaredVirtualMethod. There are still calls to
IsProxyMethod that could probably be eliminated.
ReadBarrier::Mark goes from 12.39% to 3.45% according to perf.
Test: test-art-host
Change-Id: I6a4f2fa2d68bf5f393f83b9b70e8d6fcc9dbdaa2
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 2fb8d28..6a65e12 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -71,9 +71,10 @@
OFFSET_OF_OBJECT_MEMBER(Class, class_loader_));
}
-template<VerifyObjectFlags kVerifyFlags>
+template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
inline DexCache* Class::GetDexCache() {
- return GetFieldObject<DexCache, kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_));
+ return GetFieldObject<DexCache, kVerifyFlags, kReadBarrierOption>(
+ OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_));
}
inline uint32_t Class::GetCopiedMethodsStartOffset() {