Fix an invoke-interface bug that manifests itself with thread state warnings.

r12 is a scratch register and apparently gcc 4.4 starts to actively use it in
dvmFindInterfaceMethodInCache, the very function that the original live value
is being protected around. This results in useless values setup in the chaining
cell and increases the chances to patch the cell (thus the suspend-all
requests).

Add verbose names for new JIT-related suspend reasons.

With all these changes, the thread state warning will still occur but much less
frequently.

bug 2194174.
diff --git a/vm/compiler/codegen/arm/Assemble.c b/vm/compiler/codegen/arm/Assemble.c
index 81dd0e3..799142f 100644
--- a/vm/compiler/codegen/arm/Assemble.c
+++ b/vm/compiler/codegen/arm/Assemble.c
@@ -1246,13 +1246,22 @@
         cell->counter = PREDICTED_CHAIN_COUNTER_DELAY;
         cacheflush((long) cell, (long) (cell+1), 0);
         COMPILER_TRACE_CHAINING(
-            LOGD("Jit Runtime: predicted chain %p to method %s delayed",
-                 cell, method->name));
+            LOGD("Jit Runtime: predicted chain %p to method %s%s delayed",
+                 cell, method->clazz->descriptor, method->name));
         goto done;
     }
 
+    /*
+     * Bump up the counter first just in case other mutator threads are in
+     * nearby territory to also attempt to rechain this cell. This is not
+     * done in a thread-safe way and doesn't need to be since the consequence
+     * of the race condition [rare] is two back-to-back suspend-all attempts,
+     * which will be handled correctly.
+     */
+    cell->counter = PREDICTED_CHAIN_COUNTER_AVOID;
+
     /* Stop the world */
-    dvmSuspendAllThreads(SUSPEND_FOR_JIT);
+    dvmSuspendAllThreads(SUSPEND_FOR_IC_PATCH);
 
     int baseAddr = (int) cell + 4;   // PC is cur_addr + 4
     int branchOffset = tgtAddr - baseAddr;
@@ -1266,12 +1275,16 @@
     cell->branch = assembleBXPair(branchOffset);
     cell->clazz = clazz;
     cell->method = method;
+    /*
+     * Reset the counter again in case other mutator threads got invoked
+     * between the previous rest and dvmSuspendAllThreads call.
+     */
     cell->counter = PREDICTED_CHAIN_COUNTER_RECHAIN;
 
     cacheflush((long) cell, (long) (cell+1), 0);
 
     /* All done - resume all other threads */
-    dvmResumeAllThreads(SUSPEND_FOR_JIT);
+    dvmResumeAllThreads(SUSPEND_FOR_IC_PATCH);
 #endif
 
 done: