resolved conflicts for merge of d255a545 to dalvik-dev

Change-Id: Ic8caa4cac0b442d5fe6c9fa6d37568c8f8e17c33
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 915e5f3..320eb29 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -781,14 +781,17 @@
         if (curBB->taken == NULL &&
             (isGoto(lastInsn) || isInvoke ||
             (targetOffset != UNKNOWN_TARGET && targetOffset != curOffset))) {
-            BasicBlock *newBB;
+            BasicBlock *newBB = NULL;
             if (isInvoke) {
                 /* Monomorphic callee */
                 if (callee) {
-                    newBB = dvmCompilerNewBB(kChainingCellInvokeSingleton,
-                                             numBlocks++);
-                    newBB->startOffset = 0;
-                    newBB->containingMethod = callee;
+                    /* JNI call doesn't need a chaining cell */
+                    if (!dvmIsNativeMethod(callee)) {
+                        newBB = dvmCompilerNewBB(kChainingCellInvokeSingleton,
+                                                 numBlocks++);
+                        newBB->startOffset = 0;
+                        newBB->containingMethod = callee;
+                    }
                 /* Will resolve at runtime */
                 } else {
                     newBB = dvmCompilerNewBB(kChainingCellInvokePredicted,
@@ -818,8 +821,10 @@
                 newBB->startOffset = targetOffset;
 #endif
             }
-            curBB->taken = newBB;
-            dvmInsertGrowableList(blockList, (intptr_t) newBB);
+            if (newBB) {
+                curBB->taken = newBB;
+                dvmInsertGrowableList(blockList, (intptr_t) newBB);
+            }
         }
     }