ART: Introduce runtime_globals

Split libartbase's globals.h into actual globals, and runtime-
dependent globals which should live in runtime.

Blanket-convert all runtime/ inclusions.

In future CLs, the number of global constants should be reduced.
For example, GC types are only relevant to GC/alloc functionality.

Bug: 119869270
Test: mmma art
Change-Id: I2d8cd32e0e7ab4084d2f2e96864b5338a78da94e
diff --git a/libartbase/base/globals.h b/libartbase/base/globals.h
index 2a2a737..97eae63 100644
--- a/libartbase/base/globals.h
+++ b/libartbase/base/globals.h
@@ -38,20 +38,6 @@
 // compile-time constant so the compiler can generate better code.
 static constexpr int kPageSize = 4096;
 
-// Size of Dex virtual registers.
-static constexpr size_t kVRegSize = 4;
-
-// Returns whether the given memory offset can be used for generating
-// an implicit null check.
-static inline bool CanDoImplicitNullCheckOn(uintptr_t offset) {
-  return offset < kPageSize;
-}
-
-// Required object alignment
-static constexpr size_t kObjectAlignmentShift = 3;
-static constexpr size_t kObjectAlignment = 1u << kObjectAlignmentShift;
-static constexpr size_t kLargeObjectAlignment = kPageSize;
-
 // Clion, clang analyzer, etc can falsely believe that "if (kIsDebugBuild)" always
 // returns the same value. By wrapping into a call to another constexpr function, we force it
 // to realize that is not actually always evaluating to the same value.
@@ -117,48 +103,6 @@
 static constexpr bool kHostStaticBuildEnabled = false;
 #endif
 
-// Garbage collector constants.
-static constexpr bool kMovingCollector = true;
-static constexpr bool kMarkCompactSupport = false && kMovingCollector;
-// True if we allow moving classes.
-static constexpr bool kMovingClasses = !kMarkCompactSupport;
-// If true, enable generational collection when using the Concurrent Copying
-// (CC) collector, i.e. use sticky-bit CC for minor collections and (full) CC
-// for major collections.
-//
-// Generational CC collection is currently only compatible with Baker read
-// barriers.
-#if defined(ART_USE_GENERATIONAL_CC) && defined(ART_READ_BARRIER_TYPE_IS_BAKER)
-static constexpr bool kEnableGenerationalConcurrentCopyingCollection = true;
-#else
-static constexpr bool kEnableGenerationalConcurrentCopyingCollection = false;
-#endif
-
-// If true, enable the tlab allocator by default.
-#ifdef ART_USE_TLAB
-static constexpr bool kUseTlab = true;
-#else
-static constexpr bool kUseTlab = false;
-#endif
-
-// Kinds of tracing clocks.
-enum class TraceClockSource {
-  kThreadCpu,
-  kWall,
-  kDual,  // Both wall and thread CPU clocks.
-};
-
-#if defined(__linux__)
-static constexpr TraceClockSource kDefaultTraceClockSource = TraceClockSource::kDual;
-#else
-static constexpr TraceClockSource kDefaultTraceClockSource = TraceClockSource::kWall;
-#endif
-
-static constexpr bool kDefaultMustRelocate = true;
-
-// Size of a heap reference.
-static constexpr size_t kHeapReferenceSize = sizeof(uint32_t);
-
 }  // namespace art
 
 #endif  // ART_LIBARTBASE_BASE_GLOBALS_H_
diff --git a/runtime/arch/arm/callee_save_frame_arm.h b/runtime/arch/arm/callee_save_frame_arm.h
index 11eefb9..72ba3b7 100644
--- a/runtime/arch/arm/callee_save_frame_arm.h
+++ b/runtime/arch/arm/callee_save_frame_arm.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_arm.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace arm {
diff --git a/runtime/arch/arm/fault_handler_arm.cc b/runtime/arch/arm/fault_handler_arm.cc
index bb33a27..ac3d77c 100644
--- a/runtime/arch/arm/fault_handler_arm.cc
+++ b/runtime/arch/arm/fault_handler_arm.cc
@@ -20,10 +20,10 @@
 
 #include "art_method.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "base/hex_dump.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
+#include "runtime_globals.h"
 #include "thread-current-inl.h"
 
 //
diff --git a/runtime/arch/arm64/callee_save_frame_arm64.h b/runtime/arch/arm64/callee_save_frame_arm64.h
index a5aea2a..d3609f1 100644
--- a/runtime/arch/arm64/callee_save_frame_arm64.h
+++ b/runtime/arch/arm64/callee_save_frame_arm64.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_arm64.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace arm64 {
diff --git a/runtime/arch/arm64/fault_handler_arm64.cc b/runtime/arch/arm64/fault_handler_arm64.cc
index e8b4627..18ddc82 100644
--- a/runtime/arch/arm64/fault_handler_arm64.cc
+++ b/runtime/arch/arm64/fault_handler_arm64.cc
@@ -20,11 +20,11 @@
 
 #include "art_method.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "base/hex_dump.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
 #include "registers_arm64.h"
+#include "runtime_globals.h"
 #include "thread-current-inl.h"
 
 extern "C" void art_quick_throw_stack_overflow();
diff --git a/runtime/arch/mips/callee_save_frame_mips.h b/runtime/arch/mips/callee_save_frame_mips.h
index 6e88d08..84ce209 100644
--- a/runtime/arch/mips/callee_save_frame_mips.h
+++ b/runtime/arch/mips/callee_save_frame_mips.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_mips.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace mips {
diff --git a/runtime/arch/mips/fault_handler_mips.cc b/runtime/arch/mips/fault_handler_mips.cc
index 7c8ac28..5213668 100644
--- a/runtime/arch/mips/fault_handler_mips.cc
+++ b/runtime/arch/mips/fault_handler_mips.cc
@@ -20,11 +20,11 @@
 #include "arch/mips/callee_save_frame_mips.h"
 #include "art_method.h"
 #include "base/callee_save_type.h"
-#include "base/globals.h"
 #include "base/hex_dump.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
 #include "registers_mips.h"
+#include "runtime_globals.h"
 #include "thread-current-inl.h"
 
 extern "C" void art_quick_throw_stack_overflow();
diff --git a/runtime/arch/mips/registers_mips.h b/runtime/arch/mips/registers_mips.h
index 34f2f96..4900e41 100644
--- a/runtime/arch/mips/registers_mips.h
+++ b/runtime/arch/mips/registers_mips.h
@@ -19,9 +19,6 @@
 
 #include <iosfwd>
 
-#include <android-base/logging.h>
-
-#include "base/globals.h"
 #include "base/macros.h"
 
 namespace art {
diff --git a/runtime/arch/mips64/callee_save_frame_mips64.h b/runtime/arch/mips64/callee_save_frame_mips64.h
index 59529a0..64d6bec 100644
--- a/runtime/arch/mips64/callee_save_frame_mips64.h
+++ b/runtime/arch/mips64/callee_save_frame_mips64.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_mips64.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace mips64 {
diff --git a/runtime/arch/mips64/fault_handler_mips64.cc b/runtime/arch/mips64/fault_handler_mips64.cc
index 85f3528..a55cb1a 100644
--- a/runtime/arch/mips64/fault_handler_mips64.cc
+++ b/runtime/arch/mips64/fault_handler_mips64.cc
@@ -21,11 +21,11 @@
 #include "arch/mips64/callee_save_frame_mips64.h"
 #include "art_method.h"
 #include "base/callee_save_type.h"
-#include "base/globals.h"
 #include "base/hex_dump.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
 #include "registers_mips64.h"
+#include "runtime_globals.h"
 #include "thread-current-inl.h"
 
 extern "C" void art_quick_throw_stack_overflow();
diff --git a/runtime/arch/mips64/registers_mips64.h b/runtime/arch/mips64/registers_mips64.h
index a3fa2ac4..1c22c07 100644
--- a/runtime/arch/mips64/registers_mips64.h
+++ b/runtime/arch/mips64/registers_mips64.h
@@ -19,9 +19,6 @@
 
 #include <iosfwd>
 
-#include <android-base/logging.h>
-
-#include "base/globals.h"
 #include "base/macros.h"
 
 namespace art {
diff --git a/runtime/arch/x86/callee_save_frame_x86.h b/runtime/arch/x86/callee_save_frame_x86.h
index f336f43..2edcade 100644
--- a/runtime/arch/x86/callee_save_frame_x86.h
+++ b/runtime/arch/x86/callee_save_frame_x86.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_x86.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace x86 {
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index 8b24334..a0dbaed 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -20,11 +20,11 @@
 
 #include "art_method.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "base/hex_dump.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
 #include "base/safe_copy.h"
+#include "runtime_globals.h"
 #include "thread-current-inl.h"
 
 #if defined(__APPLE__)
diff --git a/runtime/arch/x86/registers_x86.h b/runtime/arch/x86/registers_x86.h
index d3b959f..ff6c18f 100644
--- a/runtime/arch/x86/registers_x86.h
+++ b/runtime/arch/x86/registers_x86.h
@@ -19,9 +19,6 @@
 
 #include <iosfwd>
 
-#include <android-base/logging.h>
-
-#include "base/globals.h"
 #include "base/macros.h"
 
 namespace art {
diff --git a/runtime/arch/x86_64/callee_save_frame_x86_64.h b/runtime/arch/x86_64/callee_save_frame_x86_64.h
index 228a902..d4f2da7 100644
--- a/runtime/arch/x86_64/callee_save_frame_x86_64.h
+++ b/runtime/arch/x86_64/callee_save_frame_x86_64.h
@@ -21,9 +21,9 @@
 #include "base/bit_utils.h"
 #include "base/callee_save_type.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "quick/quick_method_frame_info.h"
 #include "registers_x86_64.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace x86_64 {
diff --git a/runtime/arch/x86_64/registers_x86_64.h b/runtime/arch/x86_64/registers_x86_64.h
index 66aea70..248c82b 100644
--- a/runtime/arch/x86_64/registers_x86_64.h
+++ b/runtime/arch/x86_64/registers_x86_64.h
@@ -19,9 +19,6 @@
 
 #include <iosfwd>
 
-#include <android-base/logging.h>
-
-#include "base/globals.h"
 #include "base/macros.h"
 
 namespace art {
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 41a47af..aaa1ee6 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -28,7 +28,7 @@
 
 #include "base/aborting.h"
 #include "base/atomic.h"
-#include "base/globals.h"
+#include "runtime_globals.h"
 #include "base/macros.h"
 #include "locks.h"
 
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 29b7813..d7f6127 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -26,7 +26,6 @@
 
 #include "arch/instruction_set.h"
 #include "base/common_art_test.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/os.h"
 #include "base/unix_file/fd_file.h"
@@ -34,6 +33,7 @@
 #include "dex/compact_dex_level.h"
 // TODO: Add inl file and avoid including inl.
 #include "obj_ptr-inl.h"
+#include "runtime_globals.h"
 #include "scoped_thread_state_change-inl.h"
 
 namespace art {
diff --git a/runtime/fault_handler.h b/runtime/fault_handler.h
index d3be51f..f6cf2d7 100644
--- a/runtime/fault_handler.h
+++ b/runtime/fault_handler.h
@@ -23,8 +23,8 @@
 
 #include <vector>
 
-#include "base/globals.h"  // For CanDoImplicitNullCheckOn.
 #include "base/locks.h"  // For annotalysis.
+#include "runtime_globals.h"  // For CanDoImplicitNullCheckOn.
 
 namespace art {
 
diff --git a/runtime/gc/accounting/bitmap.h b/runtime/gc/accounting/bitmap.h
index bdc686e..68f2d04 100644
--- a/runtime/gc/accounting/bitmap.h
+++ b/runtime/gc/accounting/bitmap.h
@@ -23,9 +23,9 @@
 #include <set>
 #include <vector>
 
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/mem_map.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h
index c99ed4b..30c4386 100644
--- a/runtime/gc/accounting/card_table.h
+++ b/runtime/gc/accounting/card_table.h
@@ -19,9 +19,9 @@
 
 #include <memory>
 
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/mem_map.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h
index 8c471bc..011e95c 100644
--- a/runtime/gc/accounting/mod_union_table.h
+++ b/runtime/gc/accounting/mod_union_table.h
@@ -18,12 +18,12 @@
 #define ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_H_
 
 #include "base/allocator.h"
-#include "base/globals.h"
 #include "base/safe_map.h"
 #include "base/tracking_safe_map.h"
 #include "bitmap.h"
 #include "card_table.h"
 #include "mirror/object_reference.h"
+#include "runtime_globals.h"
 
 #include <set>
 #include <vector>
diff --git a/runtime/gc/accounting/read_barrier_table.h b/runtime/gc/accounting/read_barrier_table.h
index 2e42f8d..44cdb5e 100644
--- a/runtime/gc/accounting/read_barrier_table.h
+++ b/runtime/gc/accounting/read_barrier_table.h
@@ -20,10 +20,10 @@
 #include <sys/mman.h>  // For the PROT_* and MAP_* constants.
 
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/mem_map.h"
 #include "gc/space/space.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace gc {
diff --git a/runtime/gc/accounting/remembered_set.h b/runtime/gc/accounting/remembered_set.h
index 469074f..3525667 100644
--- a/runtime/gc/accounting/remembered_set.h
+++ b/runtime/gc/accounting/remembered_set.h
@@ -18,9 +18,9 @@
 #define ART_RUNTIME_GC_ACCOUNTING_REMEMBERED_SET_H_
 
 #include "base/allocator.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/safe_map.h"
+#include "runtime_globals.h"
 
 #include <set>
 #include <vector>
diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h
index 8561f06..6ca254a 100644
--- a/runtime/gc/accounting/space_bitmap.h
+++ b/runtime/gc/accounting/space_bitmap.h
@@ -23,9 +23,9 @@
 #include <set>
 #include <vector>
 
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/mem_map.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc
index 22529b8..9f355e3 100644
--- a/runtime/gc/accounting/space_bitmap_test.cc
+++ b/runtime/gc/accounting/space_bitmap_test.cc
@@ -19,9 +19,9 @@
 #include <stdint.h>
 #include <memory>
 
-#include "base/globals.h"
 #include "base/mutex.h"
 #include "common_runtime_test.h"
+#include "runtime_globals.h"
 #include "space_bitmap-inl.h"
 
 namespace art {
diff --git a/runtime/gc/allocator/dlmalloc.cc b/runtime/gc/allocator/dlmalloc.cc
index 11ad8a8..79d4fbf 100644
--- a/runtime/gc/allocator/dlmalloc.cc
+++ b/runtime/gc/allocator/dlmalloc.cc
@@ -60,8 +60,8 @@
 
 #include <sys/mman.h>
 
-#include "base/globals.h"
 #include "base/utils.h"
+#include "runtime_globals.h"
 
 extern "C" void DlmallocMadviseCallback(void* start, void* end, size_t used_bytes, void* arg) {
   // Is this chunk in use?
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index bf26aea..0906295 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -30,9 +30,9 @@
 
 #include "base/allocator.h"
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "base/mem_map.h"
 #include "base/mutex.h"
+#include "runtime_globals.h"
 #include "thread.h"
 
 namespace art {
diff --git a/runtime/gc/gc_cause.cc b/runtime/gc/gc_cause.cc
index ee7ac7d..8b4bac2 100644
--- a/runtime/gc/gc_cause.cc
+++ b/runtime/gc/gc_cause.cc
@@ -18,8 +18,8 @@
 
 #include <android-base/logging.h>
 
-#include "base/globals.h"
 #include "base/macros.h"
+#include "runtime_globals.h"
 
 #include <ostream>
 
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 9949bf4..6b18784 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -27,7 +27,6 @@
 #include "allocator_type.h"
 #include "arch/instruction_set.h"
 #include "base/atomic.h"
-#include "base/globals.h"
 #include "base/macros.h"
 #include "base/mutex.h"
 #include "base/runtime_debug.h"
@@ -43,6 +42,7 @@
 #include "offsets.h"
 #include "process_state.h"
 #include "read_barrier_config.h"
+#include "runtime_globals.h"
 #include "verify_object.h"
 
 namespace art {
diff --git a/runtime/gc/reference_processor.h b/runtime/gc/reference_processor.h
index 17b546a..c1c9a3c 100644
--- a/runtime/gc/reference_processor.h
+++ b/runtime/gc/reference_processor.h
@@ -17,10 +17,10 @@
 #ifndef ART_RUNTIME_GC_REFERENCE_PROCESSOR_H_
 #define ART_RUNTIME_GC_REFERENCE_PROCESSOR_H_
 
-#include "base/globals.h"
 #include "base/locks.h"
 #include "jni.h"
 #include "reference_queue.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h
index 53518cc..90f0be7 100644
--- a/runtime/gc/reference_queue.h
+++ b/runtime/gc/reference_queue.h
@@ -22,12 +22,12 @@
 #include <vector>
 
 #include "base/atomic.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/timing_logger.h"
 #include "jni.h"
 #include "obj_ptr.h"
 #include "offsets.h"
+#include "runtime_globals.h"
 #include "thread_pool.h"
 
 namespace art {
diff --git a/runtime/gc/space/image_space_fs.h b/runtime/gc/space/image_space_fs.h
index 14deb6f..262c6e0 100644
--- a/runtime/gc/space/image_space_fs.h
+++ b/runtime/gc/space/image_space_fs.h
@@ -23,13 +23,13 @@
 #include "android-base/stringprintf.h"
 
 #include "base/file_utils.h"
-#include "base/globals.h"
 #include "base/logging.h"  // For VLOG.
 #include "base/macros.h"
 #include "base/os.h"
 #include "base/unix_file/fd_file.h"
 #include "base/utils.h"
 #include "runtime.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace gc {
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index dd5451b..903263f 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -21,12 +21,12 @@
 #include <string>
 
 #include "base/atomic.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/macros.h"
 #include "base/mem_map.h"
 #include "gc/accounting/space_bitmap.h"
 #include "gc/collector/object_byte_pair.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace mirror {
diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h
index 1b111e3..7fbd0b5 100644
--- a/runtime/gc/space/space_test.h
+++ b/runtime/gc/space/space_test.h
@@ -20,13 +20,13 @@
 #include <stdint.h>
 #include <memory>
 
-#include "base/globals.h"
 #include "common_runtime_test.h"
 #include "handle_scope-inl.h"
 #include "mirror/array-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/class_loader.h"
 #include "mirror/object-inl.h"
+#include "runtime_globals.h"
 #include "scoped_thread_state_change-inl.h"
 #include "thread_list.h"
 #include "zygote_space.h"
diff --git a/runtime/gc/task_processor.h b/runtime/gc/task_processor.h
index 6db3c37..86e36ab 100644
--- a/runtime/gc/task_processor.h
+++ b/runtime/gc/task_processor.h
@@ -20,8 +20,8 @@
 #include <memory>
 #include <set>
 
-#include "base/globals.h"
 #include "base/mutex.h"
+#include "runtime_globals.h"
 #include "thread_pool.h"
 
 namespace art {
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 3abe4c5..34f645b 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -42,7 +42,6 @@
 #include "art_method-inl.h"
 #include "base/array_ref.h"
 #include "base/file_utils.h"
-#include "base/globals.h"
 #include "base/macros.h"
 #include "base/mutex.h"
 #include "base/os.h"
@@ -66,6 +65,7 @@
 #include "mirror/class-inl.h"
 #include "mirror/class.h"
 #include "mirror/object-refvisitor-inl.h"
+#include "runtime_globals.h"
 #include "scoped_thread_state_change-inl.h"
 #include "thread_list.h"
 
diff --git a/runtime/image.h b/runtime/image.h
index 140f504..6578287 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -20,9 +20,9 @@
 #include <string.h>
 
 #include "base/enums.h"
-#include "base/globals.h"
 #include "base/iteration_range.h"
 #include "mirror/object.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/jdwp_provider.h b/runtime/jdwp_provider.h
index 9579513..29fbc3f 100644
--- a/runtime/jdwp_provider.h
+++ b/runtime/jdwp_provider.h
@@ -19,7 +19,7 @@
 
 #include <ios>
 
-#include "base/globals.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/mirror/dex_cache.cc b/runtime/mirror/dex_cache.cc
index 8d2b838..7e79ebe 100644
--- a/runtime/mirror/dex_cache.cc
+++ b/runtime/mirror/dex_cache.cc
@@ -17,7 +17,6 @@
 #include "dex_cache-inl.h"
 
 #include "art_method-inl.h"
-#include "base/globals.h"
 #include "class_linker.h"
 #include "gc/accounting/card_table-inl.h"
 #include "gc/heap.h"
@@ -27,6 +26,7 @@
 #include "object.h"
 #include "object_array-inl.h"
 #include "runtime.h"
+#include "runtime_globals.h"
 #include "string.h"
 #include "thread.h"
 #include "utils/dex_cache_arrays_layout-inl.h"
diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h
index bca7511..ba222f6 100644
--- a/runtime/mirror/object.h
+++ b/runtime/mirror/object.h
@@ -20,13 +20,13 @@
 #include "base/atomic.h"
 #include "base/casts.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "dex/primitive.h"
 #include "obj_ptr.h"
 #include "object_reference.h"
 #include "offsets.h"
 #include "read_barrier_config.h"
 #include "read_barrier_option.h"
+#include "runtime_globals.h"
 #include "verify_object.h"
 
 namespace art {
diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h
index 8636928..e19e165 100644
--- a/runtime/mirror/object_reference.h
+++ b/runtime/mirror/object_reference.h
@@ -18,10 +18,10 @@
 #define ART_RUNTIME_MIRROR_OBJECT_REFERENCE_H_
 
 #include "base/atomic.h"
-#include "base/globals.h"
 #include "base/locks.h"  // For Locks::mutator_lock_.
 #include "heap_poisoning.h"
 #include "obj_ptr.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace mirror {
diff --git a/runtime/mirror/string-alloc-inl.h b/runtime/mirror/string-alloc-inl.h
index c31eccf..4c4e2af 100644
--- a/runtime/mirror/string-alloc-inl.h
+++ b/runtime/mirror/string-alloc-inl.h
@@ -22,11 +22,11 @@
 
 #include "array.h"
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "class.h"
 #include "class_root.h"
 #include "gc/heap-inl.h"
 #include "runtime.h"
+#include "runtime_globals.h"
 #include "thread.h"
 
 namespace art {
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h
index e11906a..f04a8aa 100644
--- a/runtime/mirror/string-inl.h
+++ b/runtime/mirror/string-inl.h
@@ -20,10 +20,10 @@
 
 #include "android-base/stringprintf.h"
 
-#include "base/globals.h"
 #include "class-inl.h"
 #include "common_throws.h"
 #include "dex/utf.h"
+#include "runtime_globals.h"
 
 namespace art {
 namespace mirror {
diff --git a/runtime/mirror/string.h b/runtime/mirror/string.h
index b32db08..c367957 100644
--- a/runtime/mirror/string.h
+++ b/runtime/mirror/string.h
@@ -18,10 +18,10 @@
 #define ART_RUNTIME_MIRROR_STRING_H_
 
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "gc/allocator_type.h"
 #include "class.h"
 #include "object.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h
index 9e2ee29..73a99ab 100644
--- a/runtime/obj_ptr.h
+++ b/runtime/obj_ptr.h
@@ -20,9 +20,9 @@
 #include <ostream>
 #include <type_traits>
 
-#include "base/globals.h"
 #include "base/locks.h"  // For Locks::mutator_lock_.
 #include "base/macros.h"
+#include "runtime_globals.h"
 
 // Always inline ObjPtr methods even in debug builds.
 #define OBJPTR_INLINE __attribute__ ((always_inline))
diff --git a/runtime/offsets.h b/runtime/offsets.h
index 372b821..d4c0dd6 100644
--- a/runtime/offsets.h
+++ b/runtime/offsets.h
@@ -20,7 +20,7 @@
 #include <ostream>
 
 #include "base/enums.h"
-#include "base/globals.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/parsed_options.h b/runtime/parsed_options.h
index 8c77d39..095d66e 100644
--- a/runtime/parsed_options.h
+++ b/runtime/parsed_options.h
@@ -23,10 +23,10 @@
 #include <jni.h>
 
 #include "arch/instruction_set.h"
-#include "base/globals.h"
 #include "gc/collector_type.h"
 #include "gc/space/large_object_space.h"
 // #include "jit/profile_saver_options.h"
+#include "runtime_globals.h"
 #include "runtime_options.h"
 
 namespace art {
diff --git a/runtime/runtime_globals.h b/runtime/runtime_globals.h
new file mode 100644
index 0000000..793291a
--- /dev/null
+++ b/runtime/runtime_globals.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_RUNTIME_GLOBALS_H_
+#define ART_RUNTIME_RUNTIME_GLOBALS_H_
+
+#include "base/globals.h"
+
+namespace art {
+
+// Size of Dex virtual registers.
+static constexpr size_t kVRegSize = 4;
+
+// Returns whether the given memory offset can be used for generating
+// an implicit null check.
+static inline bool CanDoImplicitNullCheckOn(uintptr_t offset) {
+  return offset < kPageSize;
+}
+
+// Required object alignment
+static constexpr size_t kObjectAlignmentShift = 3;
+static constexpr size_t kObjectAlignment = 1u << kObjectAlignmentShift;
+static constexpr size_t kLargeObjectAlignment = kPageSize;
+
+// Garbage collector constants.
+static constexpr bool kMovingCollector = true;
+static constexpr bool kMarkCompactSupport = false && kMovingCollector;
+// True if we allow moving classes.
+static constexpr bool kMovingClasses = !kMarkCompactSupport;
+// If true, enable generational collection when using the Concurrent Copying
+// (CC) collector, i.e. use sticky-bit CC for minor collections and (full) CC
+// for major collections.
+//
+// Generational CC collection is currently only compatible with Baker read
+// barriers.
+#if defined(ART_USE_GENERATIONAL_CC) && defined(ART_READ_BARRIER_TYPE_IS_BAKER)
+static constexpr bool kEnableGenerationalConcurrentCopyingCollection = true;
+#else
+static constexpr bool kEnableGenerationalConcurrentCopyingCollection = false;
+#endif
+
+// If true, enable the tlab allocator by default.
+#ifdef ART_USE_TLAB
+static constexpr bool kUseTlab = true;
+#else
+static constexpr bool kUseTlab = false;
+#endif
+
+// Kinds of tracing clocks.
+enum class TraceClockSource {
+  kThreadCpu,
+  kWall,
+  kDual,  // Both wall and thread CPU clocks.
+};
+
+#if defined(__linux__)
+static constexpr TraceClockSource kDefaultTraceClockSource = TraceClockSource::kDual;
+#else
+static constexpr TraceClockSource kDefaultTraceClockSource = TraceClockSource::kWall;
+#endif
+
+static constexpr bool kDefaultMustRelocate = true;
+
+// Size of a heap reference.
+static constexpr size_t kHeapReferenceSize = sizeof(uint32_t);
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_RUNTIME_GLOBALS_H_
diff --git a/runtime/thread.h b/runtime/thread.h
index ad69ecf..334e9b7 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -29,7 +29,6 @@
 #include "arch/instruction_set.h"
 #include "base/atomic.h"
 #include "base/enums.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/macros.h"
 #include "base/safe_map.h"
@@ -41,6 +40,7 @@
 #include "managed_stack.h"
 #include "offsets.h"
 #include "read_barrier_config.h"
+#include "runtime_globals.h"
 #include "runtime_stats.h"
 #include "suspend_reason.h"
 #include "thread_state.h"
diff --git a/runtime/trace.h b/runtime/trace.h
index 582f756..567f6ed 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -27,12 +27,12 @@
 #include <vector>
 
 #include "base/atomic.h"
-#include "base/globals.h"
 #include "base/locks.h"
 #include "base/macros.h"
 #include "base/os.h"
 #include "base/safe_map.h"
 #include "instrumentation.h"
+#include "runtime_globals.h"
 
 namespace unix_file {
 class FdFile;
diff --git a/runtime/utils/dex_cache_arrays_layout-inl.h b/runtime/utils/dex_cache_arrays_layout-inl.h
index c0ea6be..3512efe 100644
--- a/runtime/utils/dex_cache_arrays_layout-inl.h
+++ b/runtime/utils/dex_cache_arrays_layout-inl.h
@@ -22,10 +22,10 @@
 #include <android-base/logging.h>
 
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "dex/primitive.h"
 #include "gc_root.h"
 #include "mirror/dex_cache.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/runtime/verify_object.cc b/runtime/verify_object.cc
index 70ca13f..2b8c7da 100644
--- a/runtime/verify_object.cc
+++ b/runtime/verify_object.cc
@@ -17,11 +17,11 @@
 #include "verify_object-inl.h"
 
 #include "base/bit_utils.h"
-#include "base/globals.h"
 #include "gc/heap.h"
 #include "mirror/object-inl.h"
 #include "obj_ptr-inl.h"
 #include "runtime.h"
+#include "runtime_globals.h"
 
 namespace art {
 
diff --git a/tools/cpp-define-generator/globals.def b/tools/cpp-define-generator/globals.def
index 6443a0c..1054262 100644
--- a/tools/cpp-define-generator/globals.def
+++ b/tools/cpp-define-generator/globals.def
@@ -26,6 +26,7 @@
 #include "jit/jit.h"
 #include "mirror/object.h"
 #include "mirror/object_reference.h"
+#include "runtime_globals.h"
 #include "stack.h"
 #endif