diff options
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 5 | ||||
-rw-r--r-- | runtime/method_helper.cc | 16 | ||||
-rw-r--r-- | runtime/method_helper.h | 2 | ||||
-rw-r--r-- | runtime/mirror/art_method.cc | 11 | ||||
-rw-r--r-- | runtime/mirror/art_method.h | 4 |
5 files changed, 16 insertions, 22 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index c887a8877f..5c77b96a5f 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -891,9 +891,8 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper* mh, Object* obj = shadow_frame->GetVRegReference(arg_offset); result->SetI(obj->IdentityHashCode()); } else if (name == "java.lang.String java.lang.reflect.ArtMethod.getMethodName(java.lang.reflect.ArtMethod)") { - StackHandleScope<1> hs(self); - MethodHelper mh(hs.NewHandle(shadow_frame->GetVRegReference(arg_offset)->AsArtMethod())); - result->SetL(mh.GetNameAsString(self)); + mirror::ArtMethod* method = shadow_frame->GetVRegReference(arg_offset)->AsArtMethod(); + result->SetL(method->GetNameAsString(self)); } else if (name == "void java.lang.System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)" || name == "void java.lang.System.arraycopy(char[], int, char[], int, int)") { // Special case array copying without initializing System. diff --git a/runtime/method_helper.cc b/runtime/method_helper.cc index 0799bb0aca..81e17943ec 100644 --- a/runtime/method_helper.cc +++ b/runtime/method_helper.cc @@ -26,18 +26,6 @@ namespace art { template <template <class T> class HandleKind> -mirror::String* MethodHelperT<HandleKind>::GetNameAsString(Thread* self) { - const DexFile* dex_file = method_->GetDexFile(); - mirror::ArtMethod* method = method_->GetInterfaceMethodIfProxy(); - uint32_t dex_method_idx = method->GetDexMethodIndex(); - const DexFile::MethodId& method_id = dex_file->GetMethodId(dex_method_idx); - StackHandleScope<1> hs(self); - Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache())); - return Runtime::Current()->GetClassLinker()->ResolveString(*dex_file, method_id.name_idx_, - dex_cache); -} - -template <template <class T> class HandleKind> template <template <class T2> class HandleKind2> bool MethodHelperT<HandleKind>::HasSameSignatureWithDifferentClassLoaders(Thread* self, MethodHelperT<HandleKind2>* other) { @@ -144,10 +132,6 @@ uint32_t MethodHelperT<HandleKind>::FindDexMethodIndexInOtherDexFile( } // Instantiate methods. -template mirror::String* MethodHelperT<Handle>::GetNameAsString(Thread* self); - -template mirror::String* MethodHelperT<MutableHandle>::GetNameAsString(Thread* self); - template uint32_t MethodHelperT<Handle>::FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile); template diff --git a/runtime/method_helper.h b/runtime/method_helper.h index 14ba7d1254..dc305d57b7 100644 --- a/runtime/method_helper.h +++ b/runtime/method_helper.h @@ -40,8 +40,6 @@ class MethodHelperT { return method_.Get(); } - mirror::String* GetNameAsString(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - const char* GetShorty() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { const char* result = shorty_; if (result == nullptr) { diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc index ddc16fb5e2..acd104383c 100644 --- a/runtime/mirror/art_method.cc +++ b/runtime/mirror/art_method.cc @@ -67,6 +67,17 @@ void ArtMethod::VisitRoots(RootCallback* callback, void* arg) { } } +mirror::String* ArtMethod::GetNameAsString(Thread* self) { + mirror::ArtMethod* method = GetInterfaceMethodIfProxy(); + const DexFile* dex_file = method->GetDexFile(); + uint32_t dex_method_idx = method->GetDexMethodIndex(); + const DexFile::MethodId& method_id = dex_file->GetMethodId(dex_method_idx); + StackHandleScope<1> hs(self); + Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache())); + return Runtime::Current()->GetClassLinker()->ResolveString(*dex_file, method_id.name_idx_, + dex_cache); +} + InvokeType ArtMethod::GetInvokeType() { // TODO: kSuper? if (GetDeclaringClass()->IsInterface()) { diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h index 9bb838b369..6927f1d251 100644 --- a/runtime/mirror/art_method.h +++ b/runtime/mirror/art_method.h @@ -484,6 +484,8 @@ class MANAGED ArtMethod FINAL : public Object { ALWAYS_INLINE const char* GetName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + mirror::String* GetNameAsString(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const DexFile::CodeItem* GetCodeItem() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool IsResolvedTypeIdx(uint16_t type_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -515,7 +517,7 @@ class MANAGED ArtMethod FINAL : public Object { ALWAYS_INLINE ArtMethod* GetInterfaceMethodIfProxy() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - protected: + private: // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses". // The class we are a part of. HeapReference<Class> declaring_class_; |