summaryrefslogtreecommitdiffstats
path: root/runtime/mirror
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-04-09 14:13:13 +0100
committerVladimir Marko <vmarko@google.com>2015-04-10 18:46:03 +0100
commitc136312832d4be25db2ecc5673967d71d0ad4b9c (patch)
treeb9cdcccdd947632b2031ae2b4c3a9c3658ef3366 /runtime/mirror
parent1576be32be4a99a1cffdaaf209a3cd67e8b2f88a (diff)
downloadart-c136312832d4be25db2ecc5673967d71d0ad4b9c.zip
art-c136312832d4be25db2ecc5673967d71d0ad4b9c.tar.gz
art-c136312832d4be25db2ecc5673967d71d0ad4b9c.tar.bz2
Avoid using dex cache array pointers in libart.
In preparation for making dex cache arrays native, avoid using them in Java code. This causes a performance regression for our reflection benchmarks. Class_getDeclaredMethod and Class_getMethod take an up to 30% hit, measured using the Quick compiler. We accept this hit at this stage and we will tune the performance after we're done with the larger effort. Companion libcore/ change: https://android-review.googlesource.com/146069 Bug: 20134538 Change-Id: Ibbef3b50043a1311cd40723ed42e1f1c609b8fc1
Diffstat (limited to 'runtime/mirror')
-rw-r--r--runtime/mirror/art_method-inl.h2
-rw-r--r--runtime/mirror/art_method.h13
-rw-r--r--runtime/mirror/dex_cache-inl.h2
3 files changed, 8 insertions, 9 deletions
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h
index 0ccf5db..fb427dc 100644
--- a/runtime/mirror/art_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -36,7 +36,7 @@ namespace art {
namespace mirror {
inline uint32_t ArtMethod::ClassSize() {
- uint32_t vtable_entries = Object::kVTableLength + 8;
+ uint32_t vtable_entries = Object::kVTableLength + 7;
return Class::ComputeClassSize(true, vtable_entries, 0, 0, 0, 0, 0);
}
diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h
index 22481ce..55b8068 100644
--- a/runtime/mirror/art_method.h
+++ b/runtime/mirror/art_method.h
@@ -183,6 +183,10 @@ class MANAGED ArtMethod FINAL : public Object {
SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), new_method_index);
}
+ static MemberOffset DexMethodIndexOffset() {
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_method_index_);
+ }
+
static MemberOffset MethodIndexOffset() {
return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
}
@@ -214,6 +218,8 @@ class MANAGED ArtMethod FINAL : public Object {
return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_);
}
+ ALWAYS_INLINE ObjectArray<ArtMethod>* GetDexCacheResolvedMethods()
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
ALWAYS_INLINE ArtMethod* GetDexCacheResolvedMethod(uint16_t method_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
ALWAYS_INLINE void SetDexCacheResolvedMethod(uint16_t method_idx, ArtMethod* new_method)
@@ -434,10 +440,6 @@ class MANAGED ArtMethod FINAL : public Object {
EntryPointFromJniOffset(pointer_size), entrypoint, pointer_size);
}
- static MemberOffset GetMethodIndexOffset() {
- return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
- }
-
// Is this a CalleSaveMethod or ResolutionMethod and therefore doesn't adhere to normal
// conventions for a method of managed code. Returns false for Proxy methods.
bool IsRuntimeMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -604,9 +606,6 @@ class MANAGED ArtMethod FINAL : public Object {
private:
ALWAYS_INLINE void CheckObjectSizeEqualsMirrorSize() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ALWAYS_INLINE ObjectArray<ArtMethod>* GetDexCacheResolvedMethods()
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
ALWAYS_INLINE ObjectArray<Class>* GetDexCacheResolvedTypes()
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index 288e88e..6758e22 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -27,7 +27,7 @@ namespace art {
namespace mirror {
inline uint32_t DexCache::ClassSize() {
- uint32_t vtable_entries = Object::kVTableLength + 1;
+ uint32_t vtable_entries = Object::kVTableLength + 5;
return Class::ComputeClassSize(true, vtable_entries, 0, 0, 0, 0, 0);
}