Jit: 2nd attempt at fix for [Issue 2302318] Crash during spin-on-suspend
Logic on the 1st attempt was a little off, preventing some invokes from
getting chaining cells.
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 0683ba2..12eb9a7 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -154,8 +154,20 @@
return true;
}
+static inline bool isGoto(MIR *insn)
+{
+ switch (insn->dalvikInsn.opCode) {
+ case OP_GOTO:
+ case OP_GOTO_16:
+ case OP_GOTO_32:
+ return true;
+ default:
+ return false;
+ }
+}
+
/*
- * Identify conditional branch instructions
+ * Identify unconditional branch instructions
*/
static inline bool isUnconditionalBranch(MIR *insn)
{
@@ -164,12 +176,9 @@
case OP_RETURN:
case OP_RETURN_WIDE:
case OP_RETURN_OBJECT:
- case OP_GOTO:
- case OP_GOTO_16:
- case OP_GOTO_32:
return true;
default:
- return false;
+ return isGoto(insn);
}
}
@@ -563,11 +572,10 @@
lastBB->startOffset = fallThroughOffset;
curBB->fallThrough = lastBB;
}
-
/* Target block not included in the trace */
if (curBB->taken == NULL &&
- (isInvoke || (targetOffset != UNKNOWN_TARGET &&
- targetOffset != curOffset))) {
+ (isGoto(lastInsn) || isInvoke ||
+ (targetOffset != UNKNOWN_TARGET && targetOffset != curOffset))) {
BasicBlock *newBB;
if (isInvoke) {
/* Monomorphic callee */