OSDN Git Service

Jit: 2nd attempt at fix for [Issue 2302318] Crash during spin-on-suspend
authorBill Buzbee <buzbee@google.com>
Fri, 4 Dec 2009 21:17:36 +0000 (13:17 -0800)
committerBill Buzbee <buzbee@google.com>
Mon, 7 Dec 2009 17:48:34 +0000 (09:48 -0800)
Logic on the 1st attempt was a little off, preventing some invokes from
getting chaining cells.

vm/compiler/Frontend.c
vm/interp/Jit.c

index 0683ba2..12eb9a7 100644 (file)
@@ -154,8 +154,20 @@ static inline bool findBlockBoundary(const Method *caller, MIR *insn,
     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 @@ static inline bool isUnconditionalBranch(MIR *insn)
         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 @@ bool dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts,
             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 */
index c79c4bc..2a5d9ef 100644 (file)
@@ -669,7 +669,7 @@ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState)
 #endif
             }
             /* Break on throw or self-loop */
-            if (decInsn.opCode == OP_THROW) {
+            if ((decInsn.opCode == OP_THROW) || (lastPC == pc)){
                 interpState->jitState = kJitTSelectEnd;
             }
             if (interpState->totalTraceLen >= JIT_MAX_TRACE_LEN) {