diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-05-21 17:43:44 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-06-09 12:46:32 -0700 |
commit | bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe (patch) | |
tree | 3d3f667c8232a9c1bb6fe9daea0d364f9ae01d8c /runtime/interpreter/interpreter_switch_impl.cc | |
parent | 2e1ca953c7fb165da36cc26ea74d3045d7e272c8 (diff) | |
download | android_art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.gz android_art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.bz2 android_art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.zip |
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
Diffstat (limited to 'runtime/interpreter/interpreter_switch_impl.cc')
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index d592a53e1d..a43fad365e 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -244,11 +244,14 @@ JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem if (UNLIKELY(self->TestAllFlags())) { CheckSuspend(self); } - Object* obj_result = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); - result.SetJ(0); - result.SetL(obj_result); + const size_t ref_idx = inst->VRegA_11x(inst_data); + Object* obj_result = shadow_frame.GetVRegReference(ref_idx); if (do_assignability_check && obj_result != NULL) { - Class* return_type = MethodHelper(shadow_frame.GetMethod()).GetReturnType(); + StackHandleScope<1> hs(self); + MethodHelper mhs(hs.NewHandle(shadow_frame.GetMethod())); + Class* return_type = mhs.GetReturnType(); + // Re-load since it might have moved. + obj_result = shadow_frame.GetVRegReference(ref_idx); if (return_type == NULL) { // Return the pending exception. HANDLE_PENDING_EXCEPTION(); @@ -263,6 +266,7 @@ JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem HANDLE_PENDING_EXCEPTION(); } } + result.SetL(obj_result); if (UNLIKELY(instrumentation->HasMethodExitListeners())) { instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), shadow_frame.GetMethod(), inst->GetDexPc(insns), |