ART: More header cleanup - runtime.h
Remove unnecessary runtime.h includes. Refactor other headers
(move to forward declarations) to make this possible.
Test: mmma art
Change-Id: I297f0ad444ba92169edd16d8c7cbe95bb6dbb800
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc
index 1a2b9cd..9f12f64 100644
--- a/cmdline/cmdline_parser_test.cc
+++ b/cmdline/cmdline_parser_test.cc
@@ -22,6 +22,7 @@
#include <numeric>
#include "gtest/gtest.h"
#include "runtime/experimental_flags.h"
+#include "runtime/runtime.h"
#define EXPECT_NULL(expected) EXPECT_EQ(reinterpret_cast<const void*>(expected), \
reinterpret_cast<void*>(nullptr));
diff --git a/cmdline/cmdline_types.h b/cmdline/cmdline_types.h
index e33a207..0d2aed8 100644
--- a/cmdline/cmdline_types.h
+++ b/cmdline/cmdline_types.h
@@ -18,6 +18,8 @@
#define CMDLINE_NDEBUG 1 // Do not output any debugging information for parsing.
+#include <list>
+
#include "memory_representation.h"
#include "detail/cmdline_debug_detail.h"
#include "cmdline_type_parser.h"
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h
index 5823306..8cc1cc3 100644
--- a/compiler/driver/compiler_driver-inl.h
+++ b/compiler/driver/compiler_driver-inl.h
@@ -24,10 +24,11 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "dex_compilation_unit.h"
+#include "handle_scope-inl.h"
#include "mirror/class_loader.h"
#include "mirror/dex_cache-inl.h"
+#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
-#include "handle_scope-inl.h"
namespace art {
@@ -149,6 +150,11 @@
return resolved_method;
}
+inline VerificationResults* CompilerDriver::GetVerificationResults() const {
+ DCHECK(Runtime::Current()->IsAotCompiler());
+ return verification_results_;
+}
+
} // namespace art
#endif // ART_COMPILER_DRIVER_COMPILER_DRIVER_INL_H_
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index e0d97b7..17c20b4 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -38,7 +38,6 @@
#include "method_reference.h"
#include "mirror/class.h" // For mirror::Class::Status.
#include "os.h"
-#include "runtime.h"
#include "safe_map.h"
#include "thread_pool.h"
#include "utils/atomic_method_ref_map.h"
@@ -61,6 +60,7 @@
class DexCompilationUnit;
struct InlineIGetIPutData;
class InstructionSetFeatures;
+class InternTable;
class ParallelCompilationManager;
class ScopedObjectAccess;
template <class Allocator> class SrcMap;
@@ -131,10 +131,7 @@
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!compiled_classes_lock_, !dex_to_dex_references_lock_);
- VerificationResults* GetVerificationResults() const {
- DCHECK(Runtime::Current()->IsAotCompiler());
- return verification_results_;
- }
+ VerificationResults* GetVerificationResults() const;
InstructionSet GetInstructionSet() const {
return instruction_set_;
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index bc411df..fed2d34 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -33,7 +33,7 @@
#include "dex/verification_results.h"
#include "dex_file-inl.h"
#include "dexlayout.h"
-#include "driver/compiler_driver.h"
+#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
#include "gc/space/image_space.h"
#include "gc/space/space.h"
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 4d55eb0..dd09fed 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -25,8 +25,8 @@
#include "dex/verified_method.h"
#include "dex_file.h"
#include "dex_file_types.h"
+#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
-#include "driver/compiler_driver.h"
#include "handle_scope-inl.h"
#include "indenter.h"
#include "mirror/class_loader.h"
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 7f652ec..3d4bbc3 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -64,6 +64,7 @@
template<typename T> class LengthPrefixedArray;
template<class T> class MutableHandle;
class InternTable;
+class LinearAlloc;
class OatFile;
template<class T> class ObjectLock;
class Runtime;
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 430edbb..8616dfb 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -25,18 +25,17 @@
#include "base/hash_set.h"
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
#include "gc_root.h"
#include "obj_ptr.h"
-#include "object_callbacks.h"
-#include "runtime.h"
namespace art {
class OatFile;
namespace mirror {
+ class Class;
class ClassLoader;
+ class Object;
} // namespace mirror
// Each loader has a ClassTable
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 748d378..b6bff5b 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -42,6 +42,7 @@
#include "mirror/object-refvisitor-inl.h"
#include "oat_file.h"
#include "os.h"
+#include "runtime.h"
#include "space-inl.h"
#include "utils.h"
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index aa3dd42..a4065bf 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -19,7 +19,6 @@
#include "arch/instruction_set.h"
#include "gc/accounting/space_bitmap.h"
-#include "runtime.h"
#include "space.h"
namespace art {
diff --git a/runtime/mirror/class_loader.h b/runtime/mirror/class_loader.h
index a62a460..6e1f44b 100644
--- a/runtime/mirror/class_loader.h
+++ b/runtime/mirror/class_loader.h
@@ -23,6 +23,7 @@
struct ClassLoaderOffsets;
class ClassTable;
+class LinearAlloc;
namespace mirror {
diff --git a/runtime/mirror/field-inl.h b/runtime/mirror/field-inl.h
index 2496989..d33df5c 100644
--- a/runtime/mirror/field-inl.h
+++ b/runtime/mirror/field-inl.h
@@ -21,7 +21,6 @@
#include "art_field-inl.h"
#include "mirror/dex_cache-inl.h"
-#include "runtime-inl.h"
namespace art {
diff --git a/runtime/mirror/reference.h b/runtime/mirror/reference.h
index f2fa589..cfcbd5a 100644
--- a/runtime/mirror/reference.h
+++ b/runtime/mirror/reference.h
@@ -22,10 +22,7 @@
#include "gc_root.h"
#include "obj_ptr.h"
#include "object.h"
-#include "object_callbacks.h"
#include "read_barrier_option.h"
-#include "runtime.h"
-#include "thread.h"
namespace art {
diff --git a/runtime/runtime-inl.h b/runtime/runtime-inl.h
index 75c25dd..9281577 100644
--- a/runtime/runtime-inl.h
+++ b/runtime/runtime-inl.h
@@ -20,10 +20,8 @@
#include "runtime.h"
#include "art_method.h"
-#include "class_linker.h"
#include "gc_root-inl.h"
#include "obj_ptr-inl.h"
-#include "read_barrier-inl.h"
namespace art {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 968f02a..74e291e 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -134,6 +134,7 @@
#include "native_stack_dump.h"
#include "oat_file.h"
#include "oat_file_manager.h"
+#include "object_callbacks.h"
#include "os.h"
#include "parsed_options.h"
#include "jit/profile_saver.h"
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 4e143e0..992c5c8 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -34,10 +34,7 @@
#include "experimental_flags.h"
#include "gc_root.h"
#include "instrumentation.h"
-#include "jobject_comparator.h"
-#include "method_reference.h"
#include "obj_ptr.h"
-#include "object_callbacks.h"
#include "offsets.h"
#include "process_state.h"
#include "quick/quick_method_frame_info.h"
@@ -79,6 +76,7 @@
class CompilerCallbacks;
class DexFile;
class InternTable;
+class IsMarkedVisitor;
class JavaVMExt;
class LinearAlloc;
class MemMap;
diff --git a/runtime/ti/agent.h b/runtime/ti/agent.h
index b5ecba1..f98e387 100644
--- a/runtime/ti/agent.h
+++ b/runtime/ti/agent.h
@@ -20,8 +20,7 @@
#include <dlfcn.h>
#include <jni.h> // for jint, JavaVM* etc declarations
-#include "runtime.h"
-#include "utils.h"
+#include "base/logging.h"
namespace art {
namespace ti {
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index b34a3af..9ef98f7 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -37,12 +37,17 @@
namespace art {
+class ClassLinker;
class CompilerCallbacks;
class Instruction;
struct ReferenceMap2Visitor;
class Thread;
class VariableIndentationOutputStream;
+namespace mirror {
+class DexCache;
+} // namespace mirror
+
namespace verifier {
class MethodVerifier;
diff --git a/runtime/verifier/reg_type_cache-inl.h b/runtime/verifier/reg_type_cache-inl.h
index 68af62e..b57a2c8 100644
--- a/runtime/verifier/reg_type_cache-inl.h
+++ b/runtime/verifier/reg_type_cache-inl.h
@@ -43,6 +43,43 @@
return FromCat1NonSmallConstant(value, precise);
}
+inline const BooleanType& RegTypeCache::Boolean() {
+ return *BooleanType::GetInstance();
+}
+inline const ByteType& RegTypeCache::Byte() {
+ return *ByteType::GetInstance();
+}
+inline const CharType& RegTypeCache::Char() {
+ return *CharType::GetInstance();
+}
+inline const ShortType& RegTypeCache::Short() {
+ return *ShortType::GetInstance();
+}
+inline const IntegerType& RegTypeCache::Integer() {
+ return *IntegerType::GetInstance();
+}
+inline const FloatType& RegTypeCache::Float() {
+ return *FloatType::GetInstance();
+}
+inline const LongLoType& RegTypeCache::LongLo() {
+ return *LongLoType::GetInstance();
+}
+inline const LongHiType& RegTypeCache::LongHi() {
+ return *LongHiType::GetInstance();
+}
+inline const DoubleLoType& RegTypeCache::DoubleLo() {
+ return *DoubleLoType::GetInstance();
+}
+inline const DoubleHiType& RegTypeCache::DoubleHi() {
+ return *DoubleHiType::GetInstance();
+}
+inline const UndefinedType& RegTypeCache::Undefined() {
+ return *UndefinedType::GetInstance();
+}
+inline const ConflictType& RegTypeCache::Conflict() {
+ return *ConflictType::GetInstance();
+}
+
inline const ImpreciseConstType& RegTypeCache::ByteConstant() {
const ConstantType& result = FromCat1Const(std::numeric_limits<jbyte>::min(), false);
DCHECK(result.IsImpreciseConstant());
diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h
index df0fe3d..37f8a1f 100644
--- a/runtime/verifier/reg_type_cache.h
+++ b/runtime/verifier/reg_type_cache.h
@@ -17,15 +17,14 @@
#ifndef ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_H_
#define ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_H_
+#include <stdint.h>
+#include <vector>
+
#include "base/casts.h"
#include "base/macros.h"
#include "base/scoped_arena_containers.h"
-#include "object_callbacks.h"
-#include "reg_type.h"
-#include "runtime.h"
-
-#include <stdint.h>
-#include <vector>
+#include "gc_root.h"
+#include "primitive.h"
namespace art {
namespace mirror {
@@ -37,7 +36,24 @@
namespace verifier {
+class BooleanType;
+class ByteType;
+class CharType;
+class ConflictType;
+class ConstantType;
+class DoubleHiType;
+class DoubleLoType;
+class FloatType;
+class ImpreciseConstType;
+class IntegerType;
+class LongHiType;
+class LongLoType;
+class PreciseConstType;
+class PreciseReferenceType;
class RegType;
+class ShortType;
+class UndefinedType;
+class UninitializedType;
// Use 8 bytes since that is the default arena allocator alignment.
static constexpr size_t kDefaultArenaBitVectorBytes = 8;
@@ -90,42 +106,18 @@
size_t GetCacheSize() {
return entries_.size();
}
- const BooleanType& Boolean() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *BooleanType::GetInstance();
- }
- const ByteType& Byte() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *ByteType::GetInstance();
- }
- const CharType& Char() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *CharType::GetInstance();
- }
- const ShortType& Short() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *ShortType::GetInstance();
- }
- const IntegerType& Integer() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *IntegerType::GetInstance();
- }
- const FloatType& Float() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *FloatType::GetInstance();
- }
- const LongLoType& LongLo() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *LongLoType::GetInstance();
- }
- const LongHiType& LongHi() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *LongHiType::GetInstance();
- }
- const DoubleLoType& DoubleLo() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *DoubleLoType::GetInstance();
- }
- const DoubleHiType& DoubleHi() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *DoubleHiType::GetInstance();
- }
- const UndefinedType& Undefined() REQUIRES_SHARED(Locks::mutator_lock_) {
- return *UndefinedType::GetInstance();
- }
- const ConflictType& Conflict() {
- return *ConflictType::GetInstance();
- }
+ const BooleanType& Boolean() REQUIRES_SHARED(Locks::mutator_lock_);
+ const ByteType& Byte() REQUIRES_SHARED(Locks::mutator_lock_);
+ const CharType& Char() REQUIRES_SHARED(Locks::mutator_lock_);
+ const ShortType& Short() REQUIRES_SHARED(Locks::mutator_lock_);
+ const IntegerType& Integer() REQUIRES_SHARED(Locks::mutator_lock_);
+ const FloatType& Float() REQUIRES_SHARED(Locks::mutator_lock_);
+ const LongLoType& LongLo() REQUIRES_SHARED(Locks::mutator_lock_);
+ const LongHiType& LongHi() REQUIRES_SHARED(Locks::mutator_lock_);
+ const DoubleLoType& DoubleLo() REQUIRES_SHARED(Locks::mutator_lock_);
+ const DoubleHiType& DoubleHi() REQUIRES_SHARED(Locks::mutator_lock_);
+ const UndefinedType& Undefined() REQUIRES_SHARED(Locks::mutator_lock_);
+ const ConflictType& Conflict();
const PreciseReferenceType& JavaLangClass() REQUIRES_SHARED(Locks::mutator_lock_);
const PreciseReferenceType& JavaLangString() REQUIRES_SHARED(Locks::mutator_lock_);
diff --git a/test/137-cfi/cfi.cc b/test/137-cfi/cfi.cc
index 3b237f4..1ed1f5a 100644
--- a/test/137-cfi/cfi.cc
+++ b/test/137-cfi/cfi.cc
@@ -33,6 +33,7 @@
#include "gc/heap.h"
#include "gc/space/image_space.h"
#include "oat_file.h"
+#include "runtime.h"
#include "utils.h"
namespace art {