diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2016-02-17 11:31:49 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2016-02-17 11:32:49 +0000 |
commit | b88d59ef4fe611fe47e50a6a19785e03bbd5f93b (patch) | |
tree | 7db030759bf4eb20df3bfef823e75b5a39a313a7 /runtime/quick_exception_handler.cc | |
parent | b93c21e83c8fbf0191093c01a8951adb5be9010b (diff) |
Be a bit smarter with JIT code triggering deoptimization.
Do not re-use an OSR method that triggered deoptimization.
Also add a stack overflow check before doing OSR.
bug:27094810
Change-Id: I6ff6a7fb9b3df9b7c0ff37e3610595efa70ad067
Diffstat (limited to 'runtime/quick_exception_handler.cc')
-rw-r--r-- | runtime/quick_exception_handler.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 786cf06e2d..dd384c7586 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -23,6 +23,8 @@ #include "entrypoints/quick/quick_entrypoints_enum.h" #include "entrypoints/runtime_asm_entrypoints.h" #include "handle_scope-inl.h" +#include "jit/jit.h" +#include "jit/jit_code_cache.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/throwable.h" @@ -629,13 +631,17 @@ void QuickExceptionHandler::DeoptimizeSingleFrame() { DeoptimizeStackVisitor visitor(self_, context_, this, true); visitor.WalkStack(true); - // Compiled code made an explicit deoptimization. Transfer the code - // to interpreter and clear the counter to JIT the method again. + // Compiled code made an explicit deoptimization. ArtMethod* deopt_method = visitor.GetSingleFrameDeoptMethod(); DCHECK(deopt_method != nullptr); - deopt_method->ClearCounter(); - Runtime::Current()->GetInstrumentation()->UpdateMethodsCode( - deopt_method, GetQuickToInterpreterBridge()); + if (Runtime::Current()->UseJit()) { + Runtime::Current()->GetJit()->GetCodeCache()->InvalidateCompiledCodeFor( + deopt_method, handler_method_header_); + } else { + // Transfer the code to interpreter. + Runtime::Current()->GetInstrumentation()->UpdateMethodsCode( + deopt_method, GetQuickToInterpreterBridge()); + } // PC needs to be of the quick-to-interpreter bridge. int32_t offset; |