Improve JIT self verifier test coverage to follow single-step instructions.
Bug: 2549326
Change-Id: I01412d4aac1379b61c90fe6e59c534b33be93f66
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index 54a5060..e3ac5bb 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -3511,6 +3511,26 @@
cUnit->loopAnalysis->branchToPCR = (LIR *) branchToPCR;
}
+#if defined(WITH_SELF_VERIFICATION)
+static bool selfVerificationPuntOps(MIR *mir)
+{
+ DecodedInstruction *decInsn = &mir->dalvikInsn;
+ OpCode op = decInsn->opCode;
+ int flags = dexGetInstrFlags(gDvm.instrFlags, op);
+ /*
+ * All opcodes that can throw exceptions and use the
+ * TEMPLATE_THROW_EXCEPTION_COMMON template should be excluded in the trace
+ * under self-verification mode.
+ */
+ return (op == OP_MONITOR_ENTER || op == OP_MONITOR_EXIT ||
+ op == OP_NEW_INSTANCE || op == OP_NEW_ARRAY ||
+ op == OP_CHECK_CAST || op == OP_MOVE_EXCEPTION ||
+ op == OP_FILL_ARRAY_DATA || op == OP_EXECUTE_INLINE ||
+ op == OP_EXECUTE_INLINE_RANGE ||
+ (flags & kInstrInvoke));
+}
+#endif
+
void dvmCompilerMIR2LIR(CompilationUnit *cUnit)
{
/* Used to hold the labels of each block */
@@ -3709,6 +3729,11 @@
((gDvmJit.opList[dalvikOpCode >> 3] &
(1 << (dalvikOpCode & 0x7))) !=
0);
+#if defined(WITH_SELF_VERIFICATION)
+ if (singleStepMe == false) {
+ singleStepMe = selfVerificationPuntOps(mir);
+ }
+#endif
if (singleStepMe || cUnit->allSingleStep) {
notHandled = false;
genInterpSingleStep(cUnit, mir);