Merge "ART: Forward-declare Context"
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 7fb6a15..22c622a 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -34,6 +34,7 @@
#include <array>
#include <sys/time.h>
+#include "arch/context.h"
#include "art_field-inl.h"
#include "art_jvmti.h"
#include "art_method-inl.h"
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 7d69c89..e88539f 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -33,6 +33,7 @@
#include <type_traits>
+#include "arch/context.h"
#include "art_jvmti.h"
#include "art_method-inl.h"
#include "base/enums.h"
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index 4a3eac8..385ac45 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -36,6 +36,7 @@
#include <unordered_map>
#include <vector>
+#include "arch/context.h"
#include "art_field-inl.h"
#include "art_method-inl.h"
#include "art_jvmti.h"
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 15225a6..eea7c67 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -42,6 +42,7 @@
#include "aot_class_linker.h"
#include "arch/arm/registers_arm.h"
#include "arch/arm64/registers_arm64.h"
+#include "arch/context.h"
#include "arch/instruction_set_features.h"
#include "arch/mips/registers_mips.h"
#include "arch/mips64/registers_mips64.h"
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 7c050a4..309c04e 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -48,6 +48,7 @@
#include "base/atomic.h"
#include "base/bit_utils.h"
#include "base/casts.h"
+#include "arch/context.h"
#include "base/file_utils.h"
#include "base/memory_tool.h"
#include "base/mutex.h"
@@ -4232,4 +4233,17 @@
Runtime::Current()->GetThreadList()->RunCheckpoint(&closure);
}
+void Thread::ReleaseLongJumpContextInternal() {
+ // Each QuickExceptionHandler gets a long jump context and uses
+ // it for doing the long jump, after finding catch blocks/doing deoptimization.
+ // Both finding catch blocks and deoptimization can trigger another
+ // exception such as a result of class loading. So there can be nested
+ // cases of exception handling and multiple contexts being used.
+ // ReleaseLongJumpContext tries to save the context in tlsPtr_.long_jump_context
+ // for reuse so there is no need to always allocate a new one each time when
+ // getting a context. Since we only keep one context for reuse, delete the
+ // existing one since the passed in context is yet to be used for longjump.
+ delete tlsPtr_.long_jump_context;
+}
+
} // namespace art
diff --git a/runtime/thread.h b/runtime/thread.h
index 592013b..7a14fd7 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -25,7 +25,6 @@
#include <memory>
#include <string>
-#include "arch/context.h"
#include "base/atomic.h"
#include "base/enums.h"
#include "base/locks.h"
@@ -471,16 +470,7 @@
Context* GetLongJumpContext();
void ReleaseLongJumpContext(Context* context) {
if (tlsPtr_.long_jump_context != nullptr) {
- // Each QuickExceptionHandler gets a long jump context and uses
- // it for doing the long jump, after finding catch blocks/doing deoptimization.
- // Both finding catch blocks and deoptimization can trigger another
- // exception such as a result of class loading. So there can be nested
- // cases of exception handling and multiple contexts being used.
- // ReleaseLongJumpContext tries to save the context in tlsPtr_.long_jump_context
- // for reuse so there is no need to always allocate a new one each time when
- // getting a context. Since we only keep one context for reuse, delete the
- // existing one since the passed in context is yet to be used for longjump.
- delete tlsPtr_.long_jump_context;
+ ReleaseLongJumpContextInternal();
}
tlsPtr_.long_jump_context = context;
}
@@ -1409,6 +1399,8 @@
static bool IsAotCompiler();
+ void ReleaseLongJumpContextInternal();
+
// 32 bits of atomically changed state and flags. Keeping as 32 bits allows and atomic CAS to
// change from being Suspended to Runnable without a suspend request occurring.
union PACKED(4) StateAndFlags {
diff --git a/test/common/stack_inspect.cc b/test/common/stack_inspect.cc
index 393e773..cb011a8 100644
--- a/test/common/stack_inspect.cc
+++ b/test/common/stack_inspect.cc
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
+#include "arch/context.h"
#include "base/mutex.h"
#include "dex/dex_file-inl.h"
#include "jni/jni_internal.h"