Revert "Revert "Make libdexfile build independent of runtime dir""

This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf.

Reason for revert: Bot configuration issue.

Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de
Bug: 22322814
Test: make -j 50 checkbuild
diff --git a/openjdkjvmti/Android.bp b/openjdkjvmti/Android.bp
index 0283999..1500bca 100644
--- a/openjdkjvmti/Android.bp
+++ b/openjdkjvmti/Android.bp
@@ -58,6 +58,7 @@
         "libopenjdkjvmti_headers",
     ],
     shared_libs: [
+        "libdexfile",
         "libbase",
     ],
 }
diff --git a/openjdkjvmti/ti_class_loader.h b/openjdkjvmti/ti_class_loader.h
index 27ea3f5..ceb7b33 100644
--- a/openjdkjvmti/ti_class_loader.h
+++ b/openjdkjvmti/ti_class_loader.h
@@ -41,6 +41,7 @@
 #include "base/array_slice.h"
 #include "class_linker.h"
 #include "dex/dex_file.h"
+#include "dex/utf.h"
 #include "gc_root-inl.h"
 #include "globals.h"
 #include "jni_env_ext-inl.h"
@@ -60,7 +61,6 @@
 #include "thread_list.h"
 #include "ti_class_definition.h"
 #include "transform.h"
-#include "utf.h"
 #include "utils/dex_cache_arrays_layout-inl.h"
 
 namespace openjdkjvmti {
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 3f144c8..83d64ef 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -123,7 +123,7 @@
   }
 
   art::ScopedObjectAccess soa(art::Thread::Current());
-  art::CodeItemInstructionAccessor accessor(art_method);
+  art::CodeItemInstructionAccessor accessor(art_method->DexInstructions());
   if (!accessor.HasCodeItem()) {
     *size_ptr = 0;
     *bytecode_ptr = nullptr;
@@ -168,7 +168,7 @@
   }
 
   DCHECK_NE(art_method->GetCodeItemOffset(), 0u);
-  *size_ptr = art::CodeItemDataAccessor(art_method).InsSize();
+  *size_ptr = art_method->DexInstructionData().InsSize();
 
   return ERR(NONE);
 }
@@ -200,7 +200,7 @@
   // TODO HasCodeItem == false means that the method is abstract (or native, but we check that
   // earlier). We should check what is returned by the RI in this situation since it's not clear
   // what the appropriate return value is from the spec.
-  art::CodeItemDebugInfoAccessor accessor(art_method);
+  art::CodeItemDebugInfoAccessor accessor(art_method->DexInstructionDebugInfo());
   if (!accessor.HasCodeItem()) {
     return ERR(ABSENT_INFORMATION);
   }
@@ -301,7 +301,7 @@
   }
 
   DCHECK_NE(art_method->GetCodeItemOffset(), 0u);
-  *max_ptr = art::CodeItemDataAccessor(art_method).RegistersSize();
+  *max_ptr = art_method->DexInstructionData().RegistersSize();
 
   return ERR(NONE);
 }
@@ -480,7 +480,7 @@
       return ERR(NULL_POINTER);
     }
 
-    accessor = art::CodeItemDebugInfoAccessor(art_method);
+    accessor = art::CodeItemDebugInfoAccessor(art_method->DexInstructionDebugInfo());
     dex_file = art_method->GetDexFile();
     DCHECK(accessor.HasCodeItem()) << art_method->PrettyMethod() << " " << dex_file->GetLocation();
   }
@@ -567,7 +567,7 @@
       // TODO It might be useful to fake up support for get at least on proxy frames.
       result_ = ERR(OPAQUE_FRAME);
       return;
-    } else if (art::CodeItemDataAccessor(method).RegistersSize() <= slot_) {
+    } else if (method->DexInstructionData().RegistersSize() <= slot_) {
       result_ = ERR(INVALID_SLOT);
       return;
     }
@@ -618,7 +618,7 @@
     if (dex_file == nullptr) {
       return ERR(OPAQUE_FRAME);
     }
-    art::CodeItemDebugInfoAccessor accessor(method);
+    art::CodeItemDebugInfoAccessor accessor(method->DexInstructionDebugInfo());
     if (!accessor.HasCodeItem()) {
       return ERR(OPAQUE_FRAME);
     }
diff --git a/openjdkjvmti/ti_redefine.h b/openjdkjvmti/ti_redefine.h
index b537e1b..c920707 100644
--- a/openjdkjvmti/ti_redefine.h
+++ b/openjdkjvmti/ti_redefine.h
@@ -41,6 +41,7 @@
 #include "base/array_ref.h"
 #include "class_linker.h"
 #include "dex/dex_file.h"
+#include "dex/utf.h"
 #include "gc_root-inl.h"
 #include "globals.h"
 #include "jni_env_ext-inl.h"
@@ -60,7 +61,6 @@
 #include "thread_list.h"
 #include "ti_class_definition.h"
 #include "transform.h"
-#include "utf.h"
 #include "utils/dex_cache_arrays_layout-inl.h"
 
 namespace openjdkjvmti {
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index bc77753..373944f 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -1045,7 +1045,7 @@
     if (shadow_frame == nullptr) {
       needs_instrument = true;
       const size_t frame_id = visitor.GetFrameId();
-      const uint16_t num_regs = art::CodeItemDataAccessor(method).RegistersSize();
+      const uint16_t num_regs = method->DexInstructionData().RegistersSize();
       shadow_frame = target->FindOrCreateDebuggerShadowFrame(frame_id,
                                                              num_regs,
                                                              method,
diff --git a/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc
index 8445eca..af838d6 100644
--- a/openjdkjvmti/transform.cc
+++ b/openjdkjvmti/transform.cc
@@ -39,6 +39,7 @@
 #include "class_linker.h"
 #include "dex/dex_file.h"
 #include "dex/dex_file_types.h"
+#include "dex/utf.h"
 #include "events-inl.h"
 #include "gc_root-inl.h"
 #include "globals.h"
@@ -58,7 +59,6 @@
 #include "thread_list.h"
 #include "ti_redefine.h"
 #include "transform.h"
-#include "utf.h"
 #include "utils/dex_cache_arrays_layout-inl.h"
 
 namespace openjdkjvmti {