From bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 21 May 2014 17:43:44 -0700 Subject: Change MethodHelper to use a Handle. Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3 --- runtime/interpreter/interpreter_common.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'runtime/interpreter/interpreter_common.h') diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h index 6e136d62c3..88a84689b5 100644 --- a/runtime/interpreter/interpreter_common.h +++ b/runtime/interpreter/interpreter_common.h @@ -604,10 +604,15 @@ static inline uint32_t FindNextInstructionFollowingException(Thread* self, ThrowLocation throw_location; mirror::Throwable* exception = self->GetException(&throw_location); bool clear_exception = false; - StackHandleScope<3> hs(self); - Handle exception_class(hs.NewHandle(exception->GetClass())); - uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception_class, dex_pc, - &clear_exception); + uint32_t found_dex_pc; + { + StackHandleScope<3> hs(self); + Handle exception_class(hs.NewHandle(exception->GetClass())); + Handle h_method(hs.NewHandle(shadow_frame.GetMethod())); + HandleWrapper h(hs.NewHandleWrapper(&this_object)); + found_dex_pc = mirror::ArtMethod::FindCatchBlock(h_method, exception_class, dex_pc, + &clear_exception); + } if (found_dex_pc == DexFile::kDexNoIndex) { instrumentation->MethodUnwindEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); @@ -627,7 +632,7 @@ static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static inline void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) { - LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(&mh.GetDexFile()); + LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(mh.GetMethod()->GetDexFile()); exit(0); // Unreachable, keep GCC happy. } @@ -640,7 +645,7 @@ static inline void TraceExecution(const ShadowFrame& shadow_frame, const Instruc std::ostringstream oss; oss << PrettyMethod(shadow_frame.GetMethod()) << StringPrintf("\n0x%x: ", dex_pc) - << inst->DumpString(&mh.GetDexFile()) << "\n"; + << inst->DumpString(mh.GetMethod()->GetDexFile()) << "\n"; for (uint32_t i = 0; i < shadow_frame.NumberOfVRegs(); ++i) { uint32_t raw_value = shadow_frame.GetVReg(i); Object* ref_value = shadow_frame.GetVRegReference(i); -- cgit v1.2.3-59-g8ed1b