diff options
| -rw-r--r-- | openjdkjvmti/events.cc | 1 | ||||
| -rw-r--r-- | openjdkjvmti/ti_method.cc | 1 | ||||
| -rw-r--r-- | openjdkjvmti/ti_stack.cc | 1 | ||||
| -rw-r--r-- | runtime/runtime.cc | 1 | ||||
| -rw-r--r-- | runtime/thread.cc | 14 | ||||
| -rw-r--r-- | runtime/thread.h | 14 | ||||
| -rw-r--r-- | test/common/stack_inspect.cc | 1 |
7 files changed, 22 insertions, 11 deletions
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc index 7fb6a15220..22c622adcf 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 7d69c89d1e..e88539f6c2 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 4a3eac8a15..385ac45488 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 15225a6d05..eea7c6713a 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 7c050a4e4d..309c04e1f2 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 @@ void Thread::ClearAllInterpreterCaches() { 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 592013bd03..7a14fd7b48 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 @@ class Thread { 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 @@ class Thread { 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 393e773275..cb011a8607 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" |