ART: Fix single-step interpretation for mterp
For bring-up (and failover) purposes, mterp can bail out to the
switch interpreter to handle a single opcode. This CL fixes the
handoff of the result register (a bug that was masked by an earlier
revision which passed it around by reference, rather than by value.
Change-Id: Iba9e1576f52b3660348c89466438bdc0526227d0
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index dca792c..e93bbdb 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -336,11 +336,11 @@
return result_register;
} else {
// Mterp didn't like that instruction. Single-step it with the reference interpreter.
- JValue res = ExecuteSwitchImpl<false, false>(self, code_item, shadow_frame,
+ result_register = ExecuteSwitchImpl<false, false>(self, code_item, shadow_frame,
result_register, true);
if (shadow_frame.GetDexPC() == DexFile::kDexNoIndex) {
// Single-stepped a return or an exception not handled locally. Return to caller.
- return res;
+ return result_register;
}
}
}
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index f7b9cdf..f606978 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -2383,7 +2383,7 @@
} while (!interpret_one_instruction);
// Record where we stopped.
shadow_frame.SetDexPC(inst->GetDexPc(insns));
- return JValue();
+ return result_register;
} // NOLINT(readability/fn_size)
// Explicit definitions of ExecuteSwitchImpl.