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/runtime/stack.cc b/runtime/stack.cc
index e1a752a..206bff3 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -16,7 +16,7 @@
 
 #include "stack.h"
 
-#include "mirror/abstract_method-inl.h"
+#include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object.h"
 #include "mirror/object-inl.h"
@@ -29,7 +29,7 @@
 namespace art {
 
 mirror::Object* ShadowFrame::GetThisObject() const {
-  mirror::AbstractMethod* m = GetMethod();
+  mirror::ArtMethod* m = GetMethod();
   if (m->IsStatic()) {
     return NULL;
   } else if (m->IsNative()) {
@@ -43,7 +43,7 @@
 }
 
 mirror::Object* ShadowFrame::GetThisObject(uint16_t num_ins) const {
-  mirror::AbstractMethod* m = GetMethod();
+  mirror::ArtMethod* m = GetMethod();
   if (m->IsStatic()) {
     return NULL;
   } else {
@@ -101,7 +101,7 @@
 }
 
 mirror::Object* StackVisitor::GetThisObject() const {
-  mirror::AbstractMethod* m = GetMethod();
+  mirror::ArtMethod* m = GetMethod();
   if (m->IsStatic()) {
     return NULL;
   } else if (m->IsNative()) {
@@ -132,7 +132,7 @@
   return GetMethod()->NativePcOffset(cur_quick_frame_pc_);
 }
 
-uint32_t StackVisitor::GetVReg(mirror::AbstractMethod* m, uint16_t vreg, VRegKind kind) const {
+uint32_t StackVisitor::GetVReg(mirror::ArtMethod* m, uint16_t vreg, VRegKind kind) const {
   if (cur_quick_frame_ != NULL) {
     DCHECK(context_ != NULL);  // You can't reliably read registers without a context.
     DCHECK(m == GetMethod());
@@ -156,7 +156,7 @@
   }
 }
 
-void StackVisitor::SetVReg(mirror::AbstractMethod* m, uint16_t vreg, uint32_t new_value,
+void StackVisitor::SetVReg(mirror::ArtMethod* m, uint16_t vreg, uint32_t new_value,
                            VRegKind kind) {
   if (cur_quick_frame_ != NULL) {
     DCHECK(context_ != NULL);  // You can't reliably write registers without a context.
@@ -195,14 +195,14 @@
 }
 
 uintptr_t StackVisitor::GetReturnPc() const {
-  mirror::AbstractMethod** sp = GetCurrentQuickFrame();
+  mirror::ArtMethod** sp = GetCurrentQuickFrame();
   DCHECK(sp != NULL);
   byte* pc_addr = reinterpret_cast<byte*>(sp) + GetMethod()->GetReturnPcOffsetInBytes();
   return *reinterpret_cast<uintptr_t*>(pc_addr);
 }
 
 void StackVisitor::SetReturnPc(uintptr_t new_ret_pc) {
-  mirror::AbstractMethod** sp = GetCurrentQuickFrame();
+  mirror::ArtMethod** sp = GetCurrentQuickFrame();
   CHECK(sp != NULL);
   byte* pc_addr = reinterpret_cast<byte*>(sp) + GetMethod()->GetReturnPcOffsetInBytes();
   *reinterpret_cast<uintptr_t*>(pc_addr) = new_ret_pc;
@@ -241,7 +241,7 @@
 
 std::string StackVisitor::DescribeLocation() const {
   std::string result("Visiting method '");
-  mirror::AbstractMethod* m = GetMethod();
+  mirror::ArtMethod* m = GetMethod();
   if (m == NULL) {
     return "upcall";
   }
@@ -259,9 +259,8 @@
 
 void StackVisitor::SanityCheckFrame() const {
 #ifndef NDEBUG
-  mirror::AbstractMethod* method = GetMethod();
-  CHECK(method->GetClass() == mirror::AbstractMethod::GetMethodClass() ||
-        method->GetClass() == mirror::AbstractMethod::GetConstructorClass());
+  mirror::ArtMethod* method = GetMethod();
+  CHECK(method->GetClass() == mirror::ArtMethod::GetJavaLangReflectArtMethod());
   if (cur_quick_frame_ != NULL) {
     method->AssertPcIsWithinCode(cur_quick_frame_pc_);
     // Frame sanity.
@@ -291,7 +290,7 @@
     if (cur_quick_frame_ != NULL) {  // Handle quick stack frames.
       // Can't be both a shadow and a quick fragment.
       DCHECK(current_fragment->GetTopShadowFrame() == NULL);
-      mirror::AbstractMethod* method = *cur_quick_frame_;
+      mirror::ArtMethod* method = *cur_quick_frame_;
       while (method != NULL) {
         SanityCheckFrame();
         bool should_continue = VisitFrame();
@@ -316,7 +315,7 @@
             if (GetMethod() == Runtime::Current()->GetCalleeSaveMethod(Runtime::kSaveAll)) {
               // Skip runtime save all callee frames which are used to deliver exceptions.
             } else if (instrumentation_frame.interpreter_entry_) {
-              mirror::AbstractMethod* callee = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs);
+              mirror::ArtMethod* callee = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs);
               CHECK_EQ(GetMethod(), callee) << "Expected: " << PrettyMethod(callee) << " Found: "
                   << PrettyMethod(GetMethod());
             } else if (instrumentation_frame.method_ != GetMethod()) {
@@ -335,7 +334,7 @@
         }
         cur_quick_frame_pc_ = return_pc;
         byte* next_frame = reinterpret_cast<byte*>(cur_quick_frame_) + frame_size;
-        cur_quick_frame_ = reinterpret_cast<mirror::AbstractMethod**>(next_frame);
+        cur_quick_frame_ = reinterpret_cast<mirror::ArtMethod**>(next_frame);
         cur_depth_++;
         method = *cur_quick_frame_;
       }