ART: Remove instruction_set.h from thread.h
Move the function definitions relying on it to the -inl. Some
follow-up transitive-include cleanup, as well as some more
forward-declarations.
Bug: 119869270
Test: mmma art
Change-Id: I820f395e6cb8343a4bb9bf02da271fbec067109f
diff --git a/compiler/jni/quick/arm/calling_convention_arm.cc b/compiler/jni/quick/arm/calling_convention_arm.cc
index 8b4bab7..42a4603 100644
--- a/compiler/jni/quick/arm/calling_convention_arm.cc
+++ b/compiler/jni/quick/arm/calling_convention_arm.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "base/macros.h"
#include "handle_scope-inl.h"
#include "utils/arm/managed_register_arm.h"
diff --git a/compiler/jni/quick/arm64/calling_convention_arm64.cc b/compiler/jni/quick/arm64/calling_convention_arm64.cc
index 4e6221e..4a6a754 100644
--- a/compiler/jni/quick/arm64/calling_convention_arm64.cc
+++ b/compiler/jni/quick/arm64/calling_convention_arm64.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "handle_scope-inl.h"
#include "utils/arm64/managed_register_arm64.h"
diff --git a/compiler/jni/quick/calling_convention.cc b/compiler/jni/quick/calling_convention.cc
index ff814c8..f031b9b 100644
--- a/compiler/jni/quick/calling_convention.cc
+++ b/compiler/jni/quick/calling_convention.cc
@@ -18,6 +18,8 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
+
#ifdef ART_ENABLE_CODEGEN_arm
#include "jni/quick/arm/calling_convention_arm.h"
#endif
diff --git a/compiler/jni/quick/calling_convention.h b/compiler/jni/quick/calling_convention.h
index e256ce6..77a5d59 100644
--- a/compiler/jni/quick/calling_convention.h
+++ b/compiler/jni/quick/calling_convention.h
@@ -27,6 +27,8 @@
namespace art {
+enum class InstructionSet;
+
// Top-level abstraction for different calling conventions.
class CallingConvention : public DeletableArenaObject<kArenaAllocCallingConvention> {
public:
diff --git a/compiler/jni/quick/mips/calling_convention_mips.cc b/compiler/jni/quick/mips/calling_convention_mips.cc
index d3d489e..c69854d 100644
--- a/compiler/jni/quick/mips/calling_convention_mips.cc
+++ b/compiler/jni/quick/mips/calling_convention_mips.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "handle_scope-inl.h"
#include "utils/mips/managed_register_mips.h"
diff --git a/compiler/jni/quick/mips64/calling_convention_mips64.cc b/compiler/jni/quick/mips64/calling_convention_mips64.cc
index 3c7cee6..2c297b3 100644
--- a/compiler/jni/quick/mips64/calling_convention_mips64.cc
+++ b/compiler/jni/quick/mips64/calling_convention_mips64.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "handle_scope-inl.h"
#include "utils/mips64/managed_register_mips64.h"
diff --git a/compiler/jni/quick/x86/calling_convention_x86.cc b/compiler/jni/quick/x86/calling_convention_x86.cc
index 71e6019..1f255e2 100644
--- a/compiler/jni/quick/x86/calling_convention_x86.cc
+++ b/compiler/jni/quick/x86/calling_convention_x86.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "handle_scope-inl.h"
#include "utils/x86/managed_register_x86.h"
diff --git a/compiler/jni/quick/x86_64/calling_convention_x86_64.cc b/compiler/jni/quick/x86_64/calling_convention_x86_64.cc
index e5e96d0..9e77d6b 100644
--- a/compiler/jni/quick/x86_64/calling_convention_x86_64.cc
+++ b/compiler/jni/quick/x86_64/calling_convention_x86_64.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/instruction_set.h"
#include "base/bit_utils.h"
#include "handle_scope-inl.h"
#include "utils/x86_64/managed_register_x86_64.h"
diff --git a/runtime/arch/arm/fault_handler_arm.cc b/runtime/arch/arm/fault_handler_arm.cc
index ac3d77c..e186cd3 100644
--- a/runtime/arch/arm/fault_handler_arm.cc
+++ b/runtime/arch/arm/fault_handler_arm.cc
@@ -18,6 +18,7 @@
#include <sys/ucontext.h>
+#include "arch/instruction_set.h"
#include "art_method.h"
#include "base/enums.h"
#include "base/hex_dump.h"
diff --git a/runtime/arch/arm64/fault_handler_arm64.cc b/runtime/arch/arm64/fault_handler_arm64.cc
index 18ddc82..751c05b 100644
--- a/runtime/arch/arm64/fault_handler_arm64.cc
+++ b/runtime/arch/arm64/fault_handler_arm64.cc
@@ -18,6 +18,7 @@
#include <sys/ucontext.h>
+#include "arch/instruction_set.h"
#include "art_method.h"
#include "base/enums.h"
#include "base/hex_dump.h"
diff --git a/runtime/arch/mips/fault_handler_mips.cc b/runtime/arch/mips/fault_handler_mips.cc
index 5213668..0354f0c 100644
--- a/runtime/arch/mips/fault_handler_mips.cc
+++ b/runtime/arch/mips/fault_handler_mips.cc
@@ -17,6 +17,7 @@
#include <sys/ucontext.h>
#include "fault_handler.h"
+#include "arch/instruction_set.h"
#include "arch/mips/callee_save_frame_mips.h"
#include "art_method.h"
#include "base/callee_save_type.h"
diff --git a/runtime/arch/mips64/fault_handler_mips64.cc b/runtime/arch/mips64/fault_handler_mips64.cc
index a55cb1a..6255235 100644
--- a/runtime/arch/mips64/fault_handler_mips64.cc
+++ b/runtime/arch/mips64/fault_handler_mips64.cc
@@ -18,6 +18,7 @@
#include <sys/ucontext.h>
+#include "arch/instruction_set.h"
#include "arch/mips64/callee_save_frame_mips64.h"
#include "art_method.h"
#include "base/callee_save_type.h"
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index a0dbaed..26312fb 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -18,6 +18,7 @@
#include <sys/ucontext.h>
+#include "arch/instruction_set.h"
#include "art_method.h"
#include "base/enums.h"
#include "base/hex_dump.h"
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 6b18784..341f16a 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -25,7 +25,6 @@
#include <android-base/logging.h>
#include "allocator_type.h"
-#include "arch/instruction_set.h"
#include "base/atomic.h"
#include "base/macros.h"
#include "base/mutex.h"
@@ -48,6 +47,7 @@
namespace art {
class ConditionVariable;
+enum class InstructionSet;
class IsMarkedVisitor;
class Mutex;
class RootVisitor;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 64fd3cd..5ad5f52 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -25,6 +25,7 @@
#include "android-base/stringprintf.h"
#include "android-base/strings.h"
+#include "arch/instruction_set.h"
#include "art_field-inl.h"
#include "art_method-inl.h"
#include "base/array_ref.h"
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 14e364a..42ac3e2 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -17,7 +17,6 @@
#ifndef ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_
#define ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_
-#include "arch/instruction_set.h"
#include "gc/accounting/space_bitmap.h"
#include "image.h"
#include "space.h"
@@ -26,6 +25,7 @@
template <typename T> class ArrayRef;
class DexFile;
+enum class InstructionSet;
class OatFile;
namespace gc {
diff --git a/runtime/oat.cc b/runtime/oat.cc
index d7c968f..c6a963a 100644
--- a/runtime/oat.cc
+++ b/runtime/oat.cc
@@ -20,6 +20,7 @@
#include "android-base/stringprintf.h"
+#include "arch/instruction_set.h"
#include "arch/instruction_set_features.h"
#include "base/bit_utils.h"
#include "base/strlcpy.h"
diff --git a/runtime/oat.h b/runtime/oat.h
index ded1489..88238d9 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -19,13 +19,13 @@
#include <vector>
-#include "arch/instruction_set.h"
#include "base/macros.h"
#include "base/safe_map.h"
#include "compiler_filter.h"
namespace art {
+enum class InstructionSet;
class InstructionSetFeatures;
class PACKED(4) OatHeader {
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index dfd7e64..dbf40f6 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -33,6 +33,7 @@
#include "nth_caller_visitor.h"
#include "scoped_thread_state_change-inl.h"
#include "stack_reference.h"
+#include "thread-inl.h"
#include "well_known_classes.h"
namespace art {
diff --git a/runtime/runtime.h b/runtime/runtime.h
index a2d519d..a249c9f 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -27,7 +27,6 @@
#include <memory>
#include <vector>
-#include "arch/instruction_set.h"
#include "base/locks.h"
#include "base/macros.h"
#include "base/mem_map.h"
@@ -84,6 +83,7 @@
class ClassLinker;
class CompilerCallbacks;
class DexFile;
+enum class InstructionSet;
class InternTable;
class IsMarkedVisitor;
class JavaVMExt;
diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h
index 0c00fb9..00f882e 100644
--- a/runtime/thread-inl.h
+++ b/runtime/thread-inl.h
@@ -19,6 +19,7 @@
#include "thread.h"
+#include "arch/instruction_set.h"
#include "base/aborting.h"
#include "base/casts.h"
#include "base/mutex-inl.h"
@@ -393,6 +394,26 @@
return tlsPtr_.managed_stack.PopShadowFrame();
}
+inline uint8_t* Thread::GetStackEndForInterpreter(bool implicit_overflow_check) const {
+ uint8_t* end = tlsPtr_.stack_end + (implicit_overflow_check
+ ? GetStackOverflowReservedBytes(kRuntimeISA)
+ : 0);
+ if (kIsDebugBuild) {
+ // In a debuggable build, but especially under ASAN, the access-checks interpreter has a
+ // potentially humongous stack size. We don't want to take too much of the stack regularly,
+ // so do not increase the regular reserved size (for compiled code etc) and only report the
+ // virtually smaller stack to the interpreter here.
+ end += GetStackOverflowReservedBytes(kRuntimeISA);
+ }
+ return end;
+}
+
+inline void Thread::ResetDefaultStackEnd() {
+ // Our stacks grow down, so we want stack_end_ to be near there, but reserving enough room
+ // to throw a StackOverflowError.
+ tlsPtr_.stack_end = tlsPtr_.stack_begin + GetStackOverflowReservedBytes(kRuntimeISA);
+}
+
} // namespace art
#endif // ART_RUNTIME_THREAD_INL_H_
diff --git a/runtime/thread.h b/runtime/thread.h
index 4ac0f00..592013b 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -26,7 +26,6 @@
#include <string>
#include "arch/context.h"
-#include "arch/instruction_set.h"
#include "base/atomic.h"
#include "base/enums.h"
#include "base/locks.h"
@@ -820,19 +819,7 @@
return tlsPtr_.stack_size - (tlsPtr_.stack_end - tlsPtr_.stack_begin);
}
- uint8_t* GetStackEndForInterpreter(bool implicit_overflow_check) const {
- uint8_t* end = tlsPtr_.stack_end + (implicit_overflow_check
- ? GetStackOverflowReservedBytes(kRuntimeISA)
- : 0);
- if (kIsDebugBuild) {
- // In a debuggable build, but especially under ASAN, the access-checks interpreter has a
- // potentially humongous stack size. We don't want to take too much of the stack regularly,
- // so do not increase the regular reserved size (for compiled code etc) and only report the
- // virtually smaller stack to the interpreter here.
- end += GetStackOverflowReservedBytes(kRuntimeISA);
- }
- return end;
- }
+ ALWAYS_INLINE uint8_t* GetStackEndForInterpreter(bool implicit_overflow_check) const;
uint8_t* GetStackEnd() const {
return tlsPtr_.stack_end;
@@ -842,11 +829,7 @@
void SetStackEndForStackOverflow() REQUIRES_SHARED(Locks::mutator_lock_);
// Set the stack end to that to be used during regular execution
- void ResetDefaultStackEnd() {
- // Our stacks grow down, so we want stack_end_ to be near there, but reserving enough room
- // to throw a StackOverflowError.
- tlsPtr_.stack_end = tlsPtr_.stack_begin + GetStackOverflowReservedBytes(kRuntimeISA);
- }
+ ALWAYS_INLINE void ResetDefaultStackEnd();
bool IsHandlingStackOverflow() const {
return tlsPtr_.stack_end == tlsPtr_.stack_begin;