Jit: Make most Jit compile failures non-fatal; just abort offending translation
Issue 2175597 Jit compile failures should abort translation, but not the VM
Added new dvmCompileAbort() to replace uses of dvmAbort() when something goes
wrong during the compliation of a trace. In that case, we'll abort the translation
and set it's head to the interpret-only "translation".
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 0c8a8df..d97001f 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -286,7 +286,7 @@
* bytecode into machine code.
*/
bool dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts,
- JitTranslationInfo *info)
+ JitTranslationInfo *info, jmp_buf *bailPtr)
{
const DexCode *dexCode = dvmGetMethodCode(desc->method);
const JitTraceRun* currRun = &desc->trace[0];
@@ -316,6 +316,9 @@
methodStats = analyzeMethodBody(desc->method);
#endif
+ /* Set the recover buffer pointer */
+ cUnit.bailPtr = bailPtr;
+
/* Initialize the printMe flag */
cUnit.printMe = gDvmJit.printMe;
@@ -760,7 +763,7 @@
/* Halve the instruction count and retry again */
} else {
- return dvmCompileTrace(desc, cUnit.numInsts / 2, info);
+ return dvmCompileTrace(desc, cUnit.numInsts / 2, info, bailPtr);
}
}
@@ -896,7 +899,7 @@
if (numBlocks != cUnit.numBlocks) {
LOGE("Expect %d vs %d basic blocks\n", numBlocks, cUnit.numBlocks);
- dvmAbort();
+ dvmCompilerAbort(&cUnit);
}
/* Connect the basic blocks through the taken links */
@@ -930,7 +933,7 @@
if (j == numBlocks && !isInvoke) {
LOGE("Target not found for insn %x: expect target %x\n",
curBB->lastMIRInsn->offset, target);
- dvmAbort();
+ dvmCompilerAbort(&cUnit);
}
}
}