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);
- newBB->startOffset = 0;
- newBB->containingMethod = callee;
+ /* JNI call doesn't need a chaining cell */
+ if (!dvmIsNativeMethod(callee)) {
+ newBB = dvmCompilerNewBB(kChainingCellInvokeSingleton);
+ newBB->startOffset = 0;
+ newBB->containingMethod = callee;
+ }
/* Will resolve at runtime */
} else {
newBB = dvmCompilerNewBB(kChainingCellInvokePredicted);
newBB->startOffset = targetOffset;
#endif
}
- newBB->id = numBlocks++;
- curBB->taken = newBB;
- lastBB->next = newBB;
- lastBB = newBB;
+ if (newBB) {
+ newBB->id = numBlocks++;
+ curBB->taken = newBB;
+ lastBB->next = newBB;
+ lastBB = newBB;
+ }
}
}