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
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 4b6967f..a653ab4 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -21,9 +21,9 @@
#include "indirect_reference_table.h"
#include "jni_internal.h"
#include "mem_map.h"
+#include "mirror/art_method-inl.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
-#include "mirror/abstract_method-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
#include "mirror/stack_trace_element.h"
@@ -51,7 +51,7 @@
// Compile the native method before starting the runtime
mirror::Class* c = class_linker_->FindClass("LMyClassNatives;",
soa.Decode<mirror::ClassLoader*>(class_loader));
- mirror::AbstractMethod* method;
+ mirror::ArtMethod* method;
if (direct) {
method = c->FindDirectMethod(method_name, method_sig);
} else {
diff --git a/compiler/jni/portable/jni_compiler.cc b/compiler/jni/portable/jni_compiler.cc
index e05f291..58ee1c1 100644
--- a/compiler/jni/portable/jni_compiler.cc
+++ b/compiler/jni/portable/jni_compiler.cc
@@ -27,7 +27,7 @@
#include "llvm/llvm_compilation_unit.h"
#include "llvm/runtime_support_llvm_func.h"
#include "llvm/utils_llvm.h"
-#include "mirror/abstract_method.h"
+#include "mirror/art_method.h"
#include "runtime.h"
#include "stack.h"
#include "thread.h"
@@ -91,7 +91,7 @@
// Load class object
this_object_or_class_object =
irb_.LoadFromObjectOffset(method_object_addr,
- mirror::AbstractMethod::DeclaringClassOffset().Int32Value(),
+ mirror::ArtMethod::DeclaringClassOffset().Int32Value(),
irb_.getJObjectTy(),
kTBAAConstJObject);
}
@@ -135,7 +135,7 @@
// Get callee code_addr
::llvm::Value* code_addr =
irb_.LoadFromObjectOffset(method_object_addr,
- mirror::AbstractMethod::NativeMethodOffset().Int32Value(),
+ mirror::ArtMethod::NativeMethodOffset().Int32Value(),
GetFunctionType(dex_compilation_unit_->GetDexMethodIndex(),
is_static, true)->getPointerTo(),
kTBAARuntimeInfo);
diff --git a/compiler/jni/portable/jni_compiler.h b/compiler/jni/portable/jni_compiler.h
index 9bdf35e..49cc9f4 100644
--- a/compiler/jni/portable/jni_compiler.h
+++ b/compiler/jni/portable/jni_compiler.h
@@ -28,7 +28,7 @@
class DexFile;
class DexCompilationUnit;
namespace mirror {
- class AbstractMethod;
+ class ArtMethod;
class ClassLoader;
class DexCache;
} // namespace mirror
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index 9713fe9..069def6 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -119,7 +119,7 @@
// Check sirt offset is within frame
CHECK_LT(sirt_offset.Uint32Value(), frame_size);
__ LoadRef(main_jni_conv->InterproceduralScratchRegister(),
- mr_conv->MethodRegister(), mirror::AbstractMethod::DeclaringClassOffset());
+ mr_conv->MethodRegister(), mirror::ArtMethod::DeclaringClassOffset());
__ VerifyObject(main_jni_conv->InterproceduralScratchRegister(), false);
__ StoreRef(sirt_offset, main_jni_conv->InterproceduralScratchRegister());
main_jni_conv->Next(); // in SIRT so move to next argument
@@ -270,7 +270,7 @@
}
// 9. Plant call to native code associated with method.
- __ Call(main_jni_conv->MethodStackOffset(), mirror::AbstractMethod::NativeMethodOffset(),
+ __ Call(main_jni_conv->MethodStackOffset(), mirror::ArtMethod::NativeMethodOffset(),
mr_conv->InterproceduralScratchRegister());
// 10. Fix differences in result widths.