diff options
author | Brian Carlstrom <bdc@google.com> | 2013-07-30 01:26:50 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-08-13 18:09:46 -0700 |
commit | ea46f950e7a51585db293cd7f047de190a482414 (patch) | |
tree | 9dddc8073547a2dcb58a19e1728932a89cb149c3 /runtime/runtime.cc | |
parent | 5e3572709b5a5d59957f835db4f73760ecef08da (diff) | |
download | art-ea46f950e7a51585db293cd7f047de190a482414.zip art-ea46f950e7a51585db293cd7f047de190a482414.tar.gz art-ea46f950e7a51585db293cd7f047de190a482414.tar.bz2 |
Refactor java.lang.reflect implementation
Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.
Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.
Bug: 10014286.
Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 70d8816..7b12870 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -42,12 +42,11 @@ #include "intern_table.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/array.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "mirror/throwable.h" #include "monitor.h" #include "oat_file.h" @@ -654,7 +653,7 @@ static void CreateSystemClassLoader() { soa.Decode<mirror::Class*>(WellKnownClasses::java_lang_ClassLoader); CHECK(Runtime::Current()->GetClassLinker()->EnsureInitialized(class_loader_class, true, true)); - mirror::AbstractMethod* getSystemClassLoader = + mirror::ArtMethod* getSystemClassLoader = class_loader_class->FindDirectMethod("getSystemClassLoader", "()Ljava/lang/ClassLoader;"); CHECK(getSystemClassLoader != NULL); @@ -669,8 +668,8 @@ static void CreateSystemClassLoader() { mirror::Class* thread_class = soa.Decode<mirror::Class*>(WellKnownClasses::java_lang_Thread); CHECK(Runtime::Current()->GetClassLinker()->EnsureInitialized(thread_class, true, true)); - mirror::Field* contextClassLoader = thread_class->FindDeclaredInstanceField("contextClassLoader", - "Ljava/lang/ClassLoader;"); + mirror::ArtField* contextClassLoader = thread_class->FindDeclaredInstanceField("contextClassLoader", + "Ljava/lang/ClassLoader;"); CHECK(contextClassLoader != NULL); contextClassLoader->SetObject(soa.Self()->GetPeer(), class_loader); @@ -1125,11 +1124,11 @@ void Runtime::VisitRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool VisitNonConcurrentRoots(visitor, arg); } -mirror::AbstractMethod* Runtime::CreateResolutionMethod() { - mirror::Class* method_class = mirror::AbstractMethod::GetMethodClass(); +mirror::ArtMethod* Runtime::CreateResolutionMethod() { + mirror::Class* method_class = mirror::ArtMethod::GetJavaLangReflectArtMethod(); Thread* self = Thread::Current(); - SirtRef<mirror::AbstractMethod> - method(self, down_cast<mirror::AbstractMethod*>(method_class->AllocObject(self))); + SirtRef<mirror::ArtMethod> + method(self, down_cast<mirror::ArtMethod*>(method_class->AllocObject(self))); method->SetDeclaringClass(method_class); // TODO: use a special method for resolution method saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); @@ -1140,12 +1139,12 @@ mirror::AbstractMethod* Runtime::CreateResolutionMethod() { return method.get(); } -mirror::AbstractMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_set, +mirror::ArtMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type) { - mirror::Class* method_class = mirror::AbstractMethod::GetMethodClass(); + mirror::Class* method_class = mirror::ArtMethod::GetJavaLangReflectArtMethod(); Thread* self = Thread::Current(); - SirtRef<mirror::AbstractMethod> - method(self, down_cast<mirror::AbstractMethod*>(method_class->AllocObject(self))); + SirtRef<mirror::ArtMethod> + method(self, down_cast<mirror::ArtMethod*>(method_class->AllocObject(self))); method->SetDeclaringClass(method_class); // TODO: use a special method for callee saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); @@ -1205,7 +1204,7 @@ mirror::AbstractMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instructi return method.get(); } -void Runtime::SetCalleeSaveMethod(mirror::AbstractMethod* method, CalleeSaveType type) { +void Runtime::SetCalleeSaveMethod(mirror::ArtMethod* method, CalleeSaveType type) { DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastCalleeSaveType)); callee_save_methods_[type] = method; } |