Move most of runtime/base to libartbase/base

Enforce the layering that code in runtime/base should not depend on
runtime by separating it into libartbase.  Some of the code in
runtime/base depends on the Runtime class, so it cannot be moved yet.
Also, some of the tests depend on CommonRuntimeTest, which itself needs
to be factored (in a subsequent CL).

Bug: 22322814
Test: make -j 50 checkbuild
      make -j 50 test-art-host

Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index a203133..d3e3a51 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -21,6 +21,7 @@
 #include "art_method-inl.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
+#include "base/utils.h"
 #include "class_linker.h"
 #include "compiled_method-inl.h"
 #include "dex/descriptors_names.h"
@@ -36,7 +37,6 @@
 #include "oat_quick_method_header.h"
 #include "scoped_thread_state_change-inl.h"
 #include "thread-current-inl.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index 7c7ae71..646040f 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -19,10 +19,10 @@
 #include <android-base/logging.h>
 
 #include "base/macros.h"
+#include "base/utils.h"
 #include "dex/code_item_accessors-inl.h"
 #include "driver/compiler_driver.h"
 #include "optimizing/optimizing_compiler.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/compiler.h b/compiler/compiler.h
index a17e2b5..f2ec3a9 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -18,8 +18,8 @@
 #define ART_COMPILER_COMPILER_H_
 
 #include "base/mutex.h"
+#include "base/os.h"
 #include "dex/dex_file.h"
-#include "os.h"
 
 namespace art {
 
diff --git a/compiler/debug/dwarf/dwarf_test.h b/compiler/debug/dwarf/dwarf_test.h
index 5405759..9a7c604 100644
--- a/compiler/debug/dwarf/dwarf_test.h
+++ b/compiler/debug/dwarf/dwarf_test.h
@@ -26,12 +26,12 @@
 #include <set>
 #include <string>
 
+#include "base/os.h"
 #include "base/unix_file/fd_file.h"
 #include "common_runtime_test.h"
 #include "gtest/gtest.h"
 #include "linker/elf_builder.h"
 #include "linker/file_output_stream.h"
-#include "os.h"
 
 namespace art {
 namespace dwarf {
diff --git a/compiler/debug/elf_symtab_writer.h b/compiler/debug/elf_symtab_writer.h
index 1310e8d..7a8e291 100644
--- a/compiler/debug/elf_symtab_writer.h
+++ b/compiler/debug/elf_symtab_writer.h
@@ -20,12 +20,12 @@
 #include <map>
 #include <unordered_set>
 
+#include "base/utils.h"
 #include "debug/debug_info.h"
 #include "debug/method_debug_info.h"
 #include "dex/dex_file-inl.h"
 #include "dex/code_item_accessors.h"
 #include "linker/elf_builder.h"
-#include "utils.h"
 
 namespace art {
 namespace debug {
diff --git a/compiler/driver/compiled_method_storage.cc b/compiler/driver/compiled_method_storage.cc
index 48477ab..a26a985 100644
--- a/compiler/driver/compiled_method_storage.cc
+++ b/compiler/driver/compiled_method_storage.cc
@@ -21,10 +21,10 @@
 
 #include <android-base/logging.h>
 
+#include "base/utils.h"
 #include "compiled_method.h"
 #include "linker/linker_patch.h"
 #include "thread-current-inl.h"
-#include "utils.h"
 #include "utils/dedupe_set-inl.h"
 #include "utils/swap_space.h"
 
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index a3bb4ec..8db892b 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -29,6 +29,8 @@
 #include "base/array_ref.h"
 #include "base/bit_utils.h"
 #include "base/mutex.h"
+#include "base/os.h"
+#include "base/quasi_atomic.h"
 #include "base/safe_map.h"
 #include "base/timing_logger.h"
 #include "class_reference.h"
@@ -39,7 +41,6 @@
 #include "dex/dex_to_dex_compiler.h"
 #include "driver/compiled_method_storage.h"
 #include "method_reference.h"
-#include "os.h"
 #include "thread_pool.h"
 #include "utils/atomic_dex_ref_map.h"
 #include "utils/dex_cache_arrays_layout.h"
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 18b0913..05d8805 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -22,10 +22,10 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/utils.h"
 #include "compiler_filter.h"
 #include "globals.h"
 #include "optimizing/register_allocator.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index 2e315b5..c90c37d 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -16,10 +16,10 @@
 
 #include "dex_compilation_unit.h"
 
+#include "base/utils.h"
 #include "dex/code_item_accessors-inl.h"
 #include "dex/descriptors_names.h"
 #include "mirror/dex_cache.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index fc44927..d001cfe 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -27,6 +27,7 @@
 #include "base/enums.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
+#include "base/utils.h"
 #include "calling_convention.h"
 #include "class_linker.h"
 #include "debug/dwarf/debug_frame_opcode_writer.h"
@@ -37,7 +38,6 @@
 #include "jni_env_ext.h"
 #include "memory_region.h"
 #include "thread.h"
-#include "utils.h"
 #include "utils/arm/managed_register_arm.h"
 #include "utils/arm64/managed_register_arm64.h"
 #include "utils/assembler.h"
diff --git a/compiler/linker/file_output_stream.h b/compiler/linker/file_output_stream.h
index 28296a4..deb051f 100644
--- a/compiler/linker/file_output_stream.h
+++ b/compiler/linker/file_output_stream.h
@@ -17,9 +17,9 @@
 #ifndef ART_COMPILER_LINKER_FILE_OUTPUT_STREAM_H_
 #define ART_COMPILER_LINKER_FILE_OUTPUT_STREAM_H_
 
-#include "output_stream.h"
+#include "base/os.h"
 
-#include "os.h"
+#include "output_stream.h"
 
 namespace art {
 namespace linker {
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index ba4040a..a0fd5ff 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -18,6 +18,7 @@
 #include <memory>
 
 #include "base/macros.h"
+#include "base/utils.h"
 #include "builder.h"
 #include "codegen_test_utils.h"
 #include "dex/dex_file.h"
@@ -26,7 +27,6 @@
 #include "nodes.h"
 #include "optimizing_unit_test.h"
 #include "register_allocator_linear_scan.h"
-#include "utils.h"
 #include "utils/arm/assembler_arm_vixl.h"
 #include "utils/arm/managed_register_arm.h"
 #include "utils/mips/managed_register_mips.h"
diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc
index 71c394e..f05159b 100644
--- a/compiler/optimizing/gvn.cc
+++ b/compiler/optimizing/gvn.cc
@@ -17,11 +17,11 @@
 #include "gvn.h"
 
 #include "base/arena_bit_vector.h"
+#include "base/bit_vector-inl.h"
 #include "base/scoped_arena_allocator.h"
 #include "base/scoped_arena_containers.h"
-#include "base/bit_vector-inl.h"
+#include "base/utils.h"
 #include "side_effects_analysis.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc
index acb830e..f8dc316 100644
--- a/compiler/optimizing/intrinsics.cc
+++ b/compiler/optimizing/intrinsics.cc
@@ -18,6 +18,7 @@
 
 #include "art_field-inl.h"
 #include "art_method-inl.h"
+#include "base/utils.h"
 #include "class_linker.h"
 #include "dex/invoke_type.h"
 #include "driver/compiler_driver.h"
@@ -26,7 +27,6 @@
 #include "nodes.h"
 #include "scoped_thread_state_change-inl.h"
 #include "thread-current-inl.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 99d80d7..62550be 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -26,6 +26,7 @@
 #include "base/arena_object.h"
 #include "base/array_ref.h"
 #include "base/iteration_range.h"
+#include "base/quasi_atomic.h"
 #include "base/stl_util.h"
 #include "base/transform_array_ref.h"
 #include "data_type.h"
diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h
index 0023265..00194ff 100644
--- a/compiler/optimizing/optimizing_compiler_stats.h
+++ b/compiler/optimizing/optimizing_compiler_stats.h
@@ -22,9 +22,9 @@
 #include <string>
 #include <type_traits>
 
-#include "atomic.h"
+#include "base/atomic.h"
+#include "base/globals.h"
 #include "base/logging.h"  // For VLOG_IS_ON.
-#include "globals.h"
 
 namespace art {
 
diff --git a/compiler/utils/assembler_test_base.h b/compiler/utils/assembler_test_base.h
index 1482210..778a015 100644
--- a/compiler/utils/assembler_test_base.h
+++ b/compiler/utils/assembler_test_base.h
@@ -25,9 +25,9 @@
 
 #include "android-base/strings.h"
 
+#include "base/utils.h"
 #include "common_runtime_test.h"  // For ScratchFile
 #include "exec_utils.h"
-#include "utils.h"
 
 namespace art {
 
diff --git a/compiler/utils/atomic_dex_ref_map.h b/compiler/utils/atomic_dex_ref_map.h
index cabd79e..fc24379 100644
--- a/compiler/utils/atomic_dex_ref_map.h
+++ b/compiler/utils/atomic_dex_ref_map.h
@@ -17,7 +17,7 @@
 #ifndef ART_COMPILER_UTILS_ATOMIC_DEX_REF_MAP_H_
 #define ART_COMPILER_UTILS_ATOMIC_DEX_REF_MAP_H_
 
-#include "atomic.h"
+#include "base/atomic.h"
 #include "base/dchecked_vector.h"
 #include "base/safe_map.h"
 #include "dex/dex_file_reference.h"
diff --git a/compiler/utils/swap_space_test.cc b/compiler/utils/swap_space_test.cc
index f4bca59..1650080 100644
--- a/compiler/utils/swap_space_test.cc
+++ b/compiler/utils/swap_space_test.cc
@@ -24,9 +24,9 @@
 
 #include "gtest/gtest.h"
 
+#include "base/os.h"
 #include "base/unix_file/fd_file.h"
 #include "common_runtime_test.h"
-#include "os.h"
 
 namespace art {
 
diff --git a/compiler/utils/test_dex_file_builder_test.cc b/compiler/utils/test_dex_file_builder_test.cc
index 736a17e..788afd8 100644
--- a/compiler/utils/test_dex_file_builder_test.cc
+++ b/compiler/utils/test_dex_file_builder_test.cc
@@ -16,9 +16,9 @@
 
 #include "test_dex_file_builder.h"
 
+#include "base/utils.h"
 #include "dex/dex_file-inl.h"
 #include "gtest/gtest.h"
-#include "utils.h"
 
 namespace art {