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/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc
index 60e638c..a0e2c1e 100644
--- a/compiler/dex/dex_to_dex_compiler.cc
+++ b/compiler/dex/dex_to_dex_compiler.cc
@@ -20,10 +20,10 @@
 #include "dex_instruction-inl.h"
 #include "driver/compiler_driver.h"
 #include "driver/dex_compilation_unit.h"
-#include "mirror/abstract_method-inl.h"
+#include "mirror/art_field-inl.h"
+#include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/dex_cache.h"
-#include "mirror/field-inl.h"
 
 namespace art {
 namespace optimizer {
diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc
index 298d389..e5c7fb1 100644
--- a/compiler/dex/quick/gen_common.cc
+++ b/compiler/dex/quick/gen_common.cc
@@ -347,7 +347,7 @@
       RegLocation rl_method  = LoadCurrMethod();
       rBase = AllocTemp();
       LoadWordDisp(rl_method.low_reg,
-                   mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
+                   mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase);
       if (IsTemp(rl_method.low_reg)) {
         FreeTemp(rl_method.low_reg);
       }
@@ -365,7 +365,7 @@
       rBase = TargetReg(kArg0);
       LockTemp(rBase);
       LoadWordDisp(r_method,
-                   mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
+                   mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
                    rBase);
       LoadWordDisp(rBase,
                    mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
@@ -433,7 +433,7 @@
       RegLocation rl_method  = LoadCurrMethod();
       rBase = AllocTemp();
       LoadWordDisp(rl_method.low_reg,
-                   mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
+                   mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase);
     } else {
       // Medium path, static storage base in a different class which requires checks that the other
       // class is initialized
@@ -448,7 +448,7 @@
       rBase = TargetReg(kArg0);
       LockTemp(rBase);
       LoadWordDisp(r_method,
-                   mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
+                   mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
                    rBase);
       LoadWordDisp(rBase, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() +
                    sizeof(int32_t*) * ssb_index, rBase);
@@ -746,7 +746,7 @@
   } else {
     // We're don't need access checks, load type from dex cache
     int32_t dex_cache_offset =
-        mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value();
+        mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value();
     LoadWordDisp(rl_method.low_reg, dex_cache_offset, res_reg);
     int32_t offset_of_type =
         mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
@@ -799,7 +799,7 @@
     LockCallTemps();  // Using explicit registers
     LoadCurrMethodDirect(TargetReg(kArg2));
     LoadWordDisp(TargetReg(kArg2),
-                 mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0));
+                 mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0));
     // Might call out to helper, which will return resolved string in kRet0
     int r_tgt = CallHelperSetup(QUICK_ENTRYPOINT_OFFSET(pResolveString));
     LoadWordDisp(TargetReg(kArg0), offset_of_string, TargetReg(kRet0));
@@ -835,7 +835,7 @@
     int res_reg = AllocTemp();
     RegLocation rl_result = EvalLoc(rl_dest, kCoreReg, true);
     LoadWordDisp(rl_method.low_reg,
-                 mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), res_reg);
+                 mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), res_reg);
     LoadWordDisp(res_reg, offset_of_string, rl_result.low_reg);
     StoreValue(rl_dest, rl_result);
   }
@@ -884,11 +884,11 @@
 
   LoadCurrMethodDirect(check_class);
   if (use_declaring_class) {
-    LoadWordDisp(check_class, mirror::AbstractMethod::DeclaringClassOffset().Int32Value(),
+    LoadWordDisp(check_class, mirror::ArtMethod::DeclaringClassOffset().Int32Value(),
                  check_class);
     LoadWordDisp(object.low_reg,  mirror::Object::ClassOffset().Int32Value(), object_class);
   } else {
-    LoadWordDisp(check_class, mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(),
+    LoadWordDisp(check_class, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(),
                  check_class);
     LoadWordDisp(object.low_reg,  mirror::Object::ClassOffset().Int32Value(), object_class);
     int32_t offset_of_type =
@@ -940,12 +940,12 @@
   } else if (use_declaring_class) {
     LoadValueDirectFixed(rl_src, TargetReg(kArg0));  // kArg0 <= ref
     LoadWordDisp(TargetReg(kArg1),
-                 mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg);
+                 mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg);
   } else {
     // Load dex cache entry into class_reg (kArg2)
     LoadValueDirectFixed(rl_src, TargetReg(kArg0));  // kArg0 <= ref
     LoadWordDisp(TargetReg(kArg1),
-                 mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
+                 mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
     int32_t offset_of_type =
         mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*)
         * type_idx);
@@ -1078,11 +1078,11 @@
     OpRegCopy(class_reg, TargetReg(kRet0));  // Align usage with fast path
   } else if (use_declaring_class) {
     LoadWordDisp(TargetReg(kArg1),
-                 mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg);
+                 mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg);
   } else {
     // Load dex cache entry into class_reg (kArg2)
     LoadWordDisp(TargetReg(kArg1),
-                 mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
+                 mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg);
     int32_t offset_of_type =
         mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() +
         (sizeof(mirror::Class*) * type_idx);
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index 20d683a..073b550 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -365,7 +365,7 @@
       break;
     case 1:  // Get method->dex_cache_resolved_methods_
       cg->LoadWordDisp(cg->TargetReg(kArg0),
-        mirror::AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), cg->TargetReg(kArg0));
+        mirror::ArtMethod::DexCacheResolvedMethodsOffset().Int32Value(), cg->TargetReg(kArg0));
       // Set up direct code if known.
       if (direct_code != 0) {
         if (direct_code != static_cast<unsigned int>(-1)) {
@@ -395,7 +395,7 @@
       if (cu->instruction_set != kX86) {
         if (direct_code == 0) {
           cg->LoadWordDisp(cg->TargetReg(kArg0),
-                           mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(),
+                           mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(),
                            cg->TargetReg(kInvokeTgt));
         }
         break;
@@ -448,7 +448,7 @@
     case 4:  // Get the compiled code address [uses kArg0, sets kInvokeTgt]
       if (cu->instruction_set != kX86) {
         cg->LoadWordDisp(cg->TargetReg(kArg0),
-                         mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(),
+                         mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(),
                          cg->TargetReg(kInvokeTgt));
         break;
       }
@@ -514,7 +514,7 @@
         break;
     case 1:  // Get method->dex_cache_resolved_methods_ [set/use kArg0]
       cg->LoadWordDisp(cg->TargetReg(kArg0),
-                       mirror::AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(),
+                       mirror::ArtMethod::DexCacheResolvedMethodsOffset().Int32Value(),
                        cg->TargetReg(kArg0));
       break;
     case 2:  // Grab target method* [set/use kArg0]
@@ -1407,7 +1407,7 @@
   } else {
     if (fast_path && info->type != kInterface) {
       call_inst = OpMem(kOpBlx, TargetReg(kArg0),
-                        mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value());
+                        mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value());
     } else {
       ThreadOffset trampoline(-1);
       switch (info->type) {