From b52de2427700ebdecc904aa2f3f59a079319abd5 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 19 Feb 2016 12:43:12 +0000 Subject: Fix braino in single frame deopt. handler_method_header_ is actually the OatQuickMethodHeader of the caller of the method that is deoptimizing (as we will resume at its call site). We should use the OatQuickMethodHeader of the method that is deoptimizing and pass it to the code cache to invalidate the method. Change-Id: I2b61a96b8415e9477e3ac902c54a314aeb0811a0 --- runtime/quick_exception_handler.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime/quick_exception_handler.cc') diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index dd384c7586..2dfa860dcb 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -290,13 +290,18 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { stacked_shadow_frame_pushed_(false), single_frame_deopt_(single_frame), single_frame_done_(false), - single_frame_deopt_method_(nullptr) { + single_frame_deopt_method_(nullptr), + single_frame_deopt_quick_method_header_(nullptr) { } ArtMethod* GetSingleFrameDeoptMethod() const { return single_frame_deopt_method_; } + const OatQuickMethodHeader* GetSingleFrameDeoptQuickMethodHeader() const { + return single_frame_deopt_quick_method_header_; + } + bool VisitFrame() OVERRIDE SHARED_REQUIRES(Locks::mutator_lock_) { exception_handler_->SetHandlerFrameDepth(GetFrameDepth()); ArtMethod* method = GetMethod(); @@ -368,6 +373,7 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { exception_handler_->SetHandlerQuickArg0(reinterpret_cast(method)); single_frame_done_ = true; single_frame_deopt_method_ = method; + single_frame_deopt_quick_method_header_ = GetCurrentOatQuickMethodHeader(); } return true; } @@ -603,6 +609,7 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { const bool single_frame_deopt_; bool single_frame_done_; ArtMethod* single_frame_deopt_method_; + const OatQuickMethodHeader* single_frame_deopt_quick_method_header_; DISALLOW_COPY_AND_ASSIGN(DeoptimizeStackVisitor); }; @@ -636,7 +643,7 @@ void QuickExceptionHandler::DeoptimizeSingleFrame() { DCHECK(deopt_method != nullptr); if (Runtime::Current()->UseJit()) { Runtime::Current()->GetJit()->GetCodeCache()->InvalidateCompiledCodeFor( - deopt_method, handler_method_header_); + deopt_method, visitor.GetSingleFrameDeoptQuickMethodHeader()); } else { // Transfer the code to interpreter. Runtime::Current()->GetInstrumentation()->UpdateMethodsCode( -- cgit v1.2.3-59-g8ed1b