diff options
-rw-r--r-- | runtime/oat/runtime/support_interpreter.cc | 4 | ||||
-rw-r--r-- | runtime/stack.cc | 7 | ||||
-rw-r--r-- | runtime/thread.cc | 9 |
3 files changed, 13 insertions, 7 deletions
diff --git a/runtime/oat/runtime/support_interpreter.cc b/runtime/oat/runtime/support_interpreter.cc index 55be54f..fc59e2b 100644 --- a/runtime/oat/runtime/support_interpreter.cc +++ b/runtime/oat/runtime/support_interpreter.cc @@ -115,6 +115,10 @@ extern "C" void artInterpreterToQuickEntry(Thread* self, MethodHelper& mh, ShadowFrame* shadow_frame, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::AbstractMethod* method = shadow_frame->GetMethod(); + // Ensure static methods are initialized. + if (method->IsStatic()) { + Runtime::Current()->GetClassLinker()->EnsureInitialized(method->GetDeclaringClass(), true, true); + } uint16_t arg_offset = (code_item == NULL) ? 0 : code_item->registers_size_ - code_item->ins_size_; ArgArray arg_array(mh.GetShorty(), mh.GetShortyLength()); arg_array.BuildArgArray(shadow_frame, arg_offset); diff --git a/runtime/stack.cc b/runtime/stack.cc index 35cd895..9ce65da 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -309,9 +309,12 @@ void StackVisitor::WalkStack(bool include_transitions) { instrumentation::InstrumentationStackFrame instrumentation_frame = GetInstrumentationStackFrame(instrumentation_stack_depth); instrumentation_stack_depth++; - if (instrumentation_frame.interpreter_entry_) { + if (GetMethod() == Runtime::Current()->GetCalleeSaveMethod(Runtime::kSaveAll)) { + // Skip runtime save all callee frames which are used to deliver exceptions. + } else if (instrumentation_frame.interpreter_entry_) { mirror::AbstractMethod* callee = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs); - CHECK_EQ(GetMethod(), callee); + CHECK_EQ(GetMethod(), callee) << "Expected: " << PrettyMethod(callee) << " Found: " + << PrettyMethod(GetMethod()); } else if (instrumentation_frame.method_ != GetMethod()) { LOG(FATAL) << "Expected: " << PrettyMethod(instrumentation_frame.method_) << " Found: " << PrettyMethod(GetMethod()); diff --git a/runtime/thread.cc b/runtime/thread.cc index d1e33b8..9b7d194 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1814,10 +1814,6 @@ class CatchBlockStackVisitor : public StackVisitor { } } else { CHECK(!is_deoptimization_); - if (instrumentation_frames_to_pop_ > 0) { - // Don't pop the instrumentation frame of the catch handler. - instrumentation_frames_to_pop_--; - } if (kDebugExceptionDelivery) { const DexFile& dex_file = *catch_method->GetDeclaringClass()->GetDexCache()->GetDexFile(); int line_number = dex_file.GetLineNumFromPC(catch_method, handler_dex_pc_); @@ -1831,7 +1827,10 @@ class CatchBlockStackVisitor : public StackVisitor { instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); for (size_t i = 0; i < instrumentation_frames_to_pop_; ++i) { // We pop the instrumentation stack here so as not to corrupt it during the stack walk. - instrumentation->PopMethodForUnwind(self_, is_deoptimization_); + if (i != instrumentation_frames_to_pop_ - 1 || self_->GetInstrumentationStack()->front().method_ != catch_method) { + // Don't pop the instrumentation frame of the catch handler. + instrumentation->PopMethodForUnwind(self_, is_deoptimization_); + } } if (!is_deoptimization_) { instrumentation->ExceptionCaughtEvent(self_, throw_location_, catch_method, handler_dex_pc_, |