Move more runtime code to libartbase, libdexfile

Move some code that logically belongs to libartbase or libdexfile to
those places respectively.

Bug: 22322814
Test: make -j 50 checkbuild
Change-Id: Idfded5d24b40d8587011681e6235b6672846da19
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 76448d8..553d131 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -18,6 +18,7 @@
 #include "verifier/verifier_deps.h"
 
 #include "art_method-inl.h"
+#include "base/indenter.h"
 #include "class_linker.h"
 #include "common_compiler_test.h"
 #include "compiler_callbacks.h"
@@ -28,7 +29,6 @@
 #include "driver/compiler_driver-inl.h"
 #include "driver/compiler_options.h"
 #include "handle_scope-inl.h"
-#include "indenter.h"
 #include "mirror/class_loader.h"
 #include "runtime.h"
 #include "scoped_thread_state_change-inl.h"
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index bcc5909..690b565 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -40,6 +40,7 @@
 #include "dex/dex_file_loader.h"
 #include "dex/dex_file_types.h"
 #include "dex/standard_dex_file.h"
+#include "dex/type_lookup_table.h"
 #include "dex/verification_results.h"
 #include "dex_container.h"
 #include "dexlayout.h"
@@ -63,7 +64,6 @@
 #include "oat_quick_method_header.h"
 #include "quicken_info.h"
 #include "scoped_thread_state_change-inl.h"
-#include "type_lookup_table.h"
 #include "utils/dex_cache_arrays_layout-inl.h"
 #include "vdex_file.h"
 #include "verifier/verifier_deps.h"
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index ec0cbe6..da1573c 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -49,7 +49,6 @@
 #include "dex_visualize.h"
 #include "dex_writer.h"
 #include "jit/profile_compilation_info.h"
-#include "mem_map.h"
 
 namespace art {
 
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index 62157e1..e68c2fb 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -104,6 +104,7 @@
         "base/hash_set_test.cc",
         "base/hex_dump_test.cc",
         "base/histogram_test.cc",
+        "base/indenter_test.cc",
         "base/leb128_test.cc",
         "base/logging_test.cc",
         "base/memory_region_test.cc",
diff --git a/runtime/indenter.h b/libartbase/base/indenter.h
similarity index 96%
rename from runtime/indenter.h
rename to libartbase/base/indenter.h
index 6361dd2..850b7c4 100644
--- a/runtime/indenter.h
+++ b/libartbase/base/indenter.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef ART_RUNTIME_INDENTER_H_
-#define ART_RUNTIME_INDENTER_H_
+#ifndef ART_LIBARTBASE_BASE_INDENTER_H_
+#define ART_LIBARTBASE_BASE_INDENTER_H_
 
 #include <ostream>
 #include <streambuf>
@@ -160,4 +160,4 @@
 
 }  // namespace art
 
-#endif  // ART_RUNTIME_INDENTER_H_
+#endif  // ART_LIBARTBASE_BASE_INDENTER_H_
diff --git a/runtime/indenter_test.cc b/libartbase/base/indenter_test.cc
similarity index 100%
rename from runtime/indenter_test.cc
rename to libartbase/base/indenter_test.cc
diff --git a/libartbase/base/logging_test.cc b/libartbase/base/logging_test.cc
index 404e080..1456eb3 100644
--- a/libartbase/base/logging_test.cc
+++ b/libartbase/base/logging_test.cc
@@ -21,7 +21,7 @@
 #include "android-base/logging.h"
 #include "base/bit_utils.h"
 #include "base/macros.h"
-#include "common_runtime_test.h"
+#include "gtest/gtest.h"
 #include "runtime_debug.h"
 
 namespace art {
@@ -31,9 +31,9 @@
   _exit(1);
 }
 
-class LoggingTest : public CommonRuntimeTest {
+class LoggingTest : public testing::Test {
  protected:
-  void PostRuntimeCreate() OVERRIDE {
+  LoggingTest() {
     // In our abort tests we really don't want the runtime to create a real dump.
     android::base::SetAborter(SimpleAborter);
   }
diff --git a/libartbase/base/safe_copy_test.cc b/libartbase/base/safe_copy_test.cc
index a9ec952..f1d7c55 100644
--- a/libartbase/base/safe_copy_test.cc
+++ b/libartbase/base/safe_copy_test.cc
@@ -16,14 +16,15 @@
 
 #include "safe_copy.h"
 
-#include "common_runtime_test.h"
-
 #include <errno.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/user.h>
 
-#include "globals.h"
+#include "android-base/logging.h"
+#include "base/globals.h"
+#include "gtest/gtest.h"
+
 
 namespace art {
 
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 3fd61ee..b2c041c 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -32,6 +32,7 @@
         "dex/modifiers.cc",
         "dex/primitive.cc",
         "dex/standard_dex_file.cc",
+        "dex/type_lookup_table.cc",
         "dex/utf.cc",
     ],
 
@@ -123,6 +124,7 @@
         "dex/dex_instruction_test.cc",
         "dex/primitive_test.cc",
         "dex/string_reference_test.cc",
+        "dex/type_lookup_table_test.cc",
         "dex/utf_test.cc",
     ],
     shared_libs: [
diff --git a/runtime/type_lookup_table.cc b/libdexfile/dex/type_lookup_table.cc
similarity index 99%
rename from runtime/type_lookup_table.cc
rename to libdexfile/dex/type_lookup_table.cc
index 7e204fc..ca5ec2f 100644
--- a/runtime/type_lookup_table.cc
+++ b/libdexfile/dex/type_lookup_table.cc
@@ -20,7 +20,6 @@
 #include <memory>
 
 #include "base/bit_utils.h"
-#include "base/utils.h"
 #include "dex/dex_file-inl.h"
 #include "dex/utf-inl.h"
 
diff --git a/runtime/type_lookup_table.h b/libdexfile/dex/type_lookup_table.h
similarity index 97%
rename from runtime/type_lookup_table.h
rename to libdexfile/dex/type_lookup_table.h
index 3352d60..0ba2b75 100644
--- a/runtime/type_lookup_table.h
+++ b/libdexfile/dex/type_lookup_table.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef ART_RUNTIME_TYPE_LOOKUP_TABLE_H_
-#define ART_RUNTIME_TYPE_LOOKUP_TABLE_H_
+#ifndef ART_LIBDEXFILE_DEX_TYPE_LOOKUP_TABLE_H_
+#define ART_LIBDEXFILE_DEX_TYPE_LOOKUP_TABLE_H_
 
 #include "base/leb128.h"
 #include "dex/dex_file_types.h"
@@ -172,4 +172,4 @@
 
 }  // namespace art
 
-#endif  // ART_RUNTIME_TYPE_LOOKUP_TABLE_H_
+#endif  // ART_LIBDEXFILE_DEX_TYPE_LOOKUP_TABLE_H_
diff --git a/runtime/type_lookup_table_test.cc b/libdexfile/dex/type_lookup_table_test.cc
similarity index 100%
rename from runtime/type_lookup_table_test.cc
rename to libdexfile/dex/type_lookup_table_test.cc
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 3bff123..7530a9c 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -34,6 +34,7 @@
 #include "art_field-inl.h"
 #include "art_method-inl.h"
 #include "base/bit_utils_iterator.h"
+#include "base/indenter.h"
 #include "base/os.h"
 #include "base/safe_map.h"
 #include "base/stl_util.h"
@@ -49,6 +50,7 @@
 #include "dex/dex_file-inl.h"
 #include "dex/dex_instruction-inl.h"
 #include "dex/string_reference.h"
+#include "dex/type_lookup_table.h"
 #include "disassembler.h"
 #include "gc/accounting/space_bitmap-inl.h"
 #include "gc/space/image_space.h"
@@ -56,7 +58,6 @@
 #include "gc/space/space-inl.h"
 #include "image-inl.h"
 #include "imtable-inl.h"
-#include "indenter.h"
 #include "subtype_check.h"
 #include "index_bss_mapping.h"
 #include "interpreter/unstarted_runtime.h"
@@ -75,7 +76,6 @@
 #include "stack.h"
 #include "stack_map.h"
 #include "thread_list.h"
-#include "type_lookup_table.h"
 #include "vdex_file.h"
 #include "verifier/method_verifier.h"
 #include "verifier/verifier_deps.h"
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 00d4a60..d643509 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -199,7 +199,6 @@
         "ti/agent.cc",
         "trace.cc",
         "transaction.cc",
-        "type_lookup_table.cc",
         "vdex_file.cc",
         "verifier/instruction_flags.cc",
         "verifier/method_verifier.cc",
@@ -571,7 +570,6 @@
         "handle_scope_test.cc",
         "hidden_api_test.cc",
         "imtable_test.cc",
-        "indenter_test.cc",
         "indirect_reference_table_test.cc",
         "instrumentation_test.cc",
         "intern_table_test.cc",
@@ -598,7 +596,6 @@
         "subtype_check_test.cc",
         "thread_pool_test.cc",
         "transaction_test.cc",
-        "type_lookup_table_test.cc",
         "vdex_file_test.cc",
         "verifier/method_verifier_test.cc",
         "verifier/reg_type_test.cc",
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index cfbcda3..bda6604 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -49,6 +49,7 @@
 #include "dex/dex_file_loader.h"
 #include "dex/dex_file_types.h"
 #include "dex/standard_dex_file.h"
+#include "dex/type_lookup_table.h"
 #include "dex/utf-inl.h"
 #include "elf_file.h"
 #include "elf_utils.h"
@@ -61,7 +62,6 @@
 #include "oat_file-inl.h"
 #include "oat_file_manager.h"
 #include "runtime.h"
-#include "type_lookup_table.h"
 #include "vdex_file.h"
 
 namespace art {
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index 24868dd..6494b4c 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -32,11 +32,11 @@
 #include "compiler_filter.h"
 #include "dex/dex_file.h"
 #include "dex/dex_file_layout.h"
+#include "dex/type_lookup_table.h"
 #include "dex/utf.h"
 #include "index_bss_mapping.h"
 #include "mirror/object.h"
 #include "oat.h"
-#include "type_lookup_table.h"
 
 namespace art {
 
diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc
index 250ff2a..9c7b687 100644
--- a/runtime/stack_map.cc
+++ b/runtime/stack_map.cc
@@ -19,7 +19,7 @@
 #include <stdint.h>
 
 #include "art_method.h"
-#include "indenter.h"
+#include "base/indenter.h"
 #include "scoped_thread_state_change-inl.h"
 
 namespace art {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index cee7176..72292c3 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -25,6 +25,7 @@
 #include "base/aborting.h"
 #include "base/enums.h"
 #include "base/leb128.h"
+#include "base/indenter.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/mutex-inl.h"
 #include "base/stl_util.h"
@@ -41,7 +42,6 @@
 #include "experimental_flags.h"
 #include "gc/accounting/card_table-inl.h"
 #include "handle_scope-inl.h"
-#include "indenter.h"
 #include "intern_table.h"
 #include "mirror/class-inl.h"
 #include "mirror/class.h"
diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc
index 4772e53..fe839f7 100644
--- a/runtime/verifier/verifier_deps.cc
+++ b/runtime/verifier/verifier_deps.cc
@@ -20,11 +20,11 @@
 
 #include "art_field-inl.h"
 #include "art_method-inl.h"
+#include "base/indenter.h"
 #include "base/leb128.h"
 #include "base/stl_util.h"
 #include "compiler_callbacks.h"
 #include "dex/dex_file-inl.h"
-#include "indenter.h"
 #include "mirror/class-inl.h"
 #include "mirror/class_loader.h"
 #include "obj_ptr-inl.h"