summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-02-01 13:10:06 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-02-02 17:49:39 +0000
commit90c5a9b889af84cbb840c60e461d5bdbf8dc0df6 (patch)
treeef0cc70d9ad20546f950be3364cbbbdeb05b5db6
parent3cb871ab1af47576959fd24a99d370381b8f193e (diff)
Various improvements to stack walking speed
Make BitMemoryRegion constructor inlined, remove read barrier for IsProxyMethod. Around 15% speedup for pmd benchmark, maybe more for CC. Test: test-art-host Change-Id: Ib4392649e041406e538cc944c26c69f68d388fb4
-rw-r--r--runtime/art_method-inl.h5
-rw-r--r--runtime/art_method.h1
-rw-r--r--runtime/bit_memory_region.h2
-rw-r--r--runtime/class_linker-inl.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 7ec3900aa9..950f1aa9f4 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -374,9 +374,10 @@ inline mirror::DexCache* ArtMethod::GetDexCache() {
}
}
-template<ReadBarrierOption kReadBarrierOption>
inline bool ArtMethod::IsProxyMethod() {
- return GetDeclaringClass<kReadBarrierOption>()->IsProxyClass();
+ // Avoid read barrier since the from-space version of the class will have the correct proxy class
+ // flags since they are constant for the lifetime of the class.
+ return GetDeclaringClass<kWithoutReadBarrier>()->IsProxyClass();
}
inline ArtMethod* ArtMethod::GetInterfaceMethodIfProxy(PointerSize pointer_size) {
diff --git a/runtime/art_method.h b/runtime/art_method.h
index e4db2c7324..d4a65c8c38 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -251,7 +251,6 @@ class ArtMethod FINAL {
return (GetAccessFlags() & kAccVarargs) != 0;
}
- template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
bool IsProxyMethod() REQUIRES_SHARED(Locks::mutator_lock_);
bool SkipAccessChecks() {
diff --git a/runtime/bit_memory_region.h b/runtime/bit_memory_region.h
index 90a198193e..c3b5be458e 100644
--- a/runtime/bit_memory_region.h
+++ b/runtime/bit_memory_region.h
@@ -26,7 +26,7 @@ namespace art {
class BitMemoryRegion FINAL : public ValueObject {
public:
BitMemoryRegion() = default;
- BitMemoryRegion(MemoryRegion region, size_t bit_offset, size_t bit_size) {
+ ALWAYS_INLINE BitMemoryRegion(MemoryRegion region, size_t bit_offset, size_t bit_size) {
bit_start_ = bit_offset % kBitsPerByte;
const size_t start = bit_offset / kBitsPerByte;
const size_t end = (bit_offset + bit_size + kBitsPerByte - 1) / kBitsPerByte;
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index 34b737c73e..3438810069 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -233,7 +233,7 @@ template<ReadBarrierOption kReadBarrierOption>
ArtMethod* ClassLinker::FindMethodForProxy(ObjPtr<mirror::Class> proxy_class,
ArtMethod* proxy_method) {
DCHECK(proxy_class->IsProxyClass());
- DCHECK(proxy_method->IsProxyMethod<kReadBarrierOption>());
+ DCHECK(proxy_method->IsProxyMethod());
{
Thread* const self = Thread::Current();
ReaderMutexLock mu(self, *Locks::dex_lock_);