Add suspend by ourselves to improve performance.
Set shadow frame entry after invoke.
Some reference is not in the shadow frame because of invoke/move-result
fusing.
Change-Id: I157eaad5be85a4a7f0d4ce89a960d52863df29ad
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc
index 055a99d..6f2c52d 100644
--- a/src/compiler/codegen/MethodBitcode.cc
+++ b/src/compiler/codegen/MethodBitcode.cc
@@ -608,6 +608,10 @@
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
if (info->result.location != kLocInvalid) {
defineValue(cUnit, res, info->result.origSReg);
+ if (info->result.ref) {
+ setShadowFrameEntry(cUnit, (llvm::Value*)
+ cUnit->llvmValues.elemList[info->result.origSReg]);
+ }
}
}
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index 412dbf7..9d7f1ae 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -1169,6 +1169,10 @@
// alloca instructions)
EmitStackOverflowCheck(&*first_non_alloca);
+#if defined(ART_USE_QUICK_COMPILER)
+ irb_.Runtime().EmitTestSuspend();
+#endif
+
llvm::BasicBlock* next_basic_block = irb_.GetInsertBlock();
if (next_basic_block != first_basic_block) {
// Splice the rest of the instruction to the continuing basic block
@@ -2630,8 +2634,11 @@
case IntrinsicHelper::GetCurrentThread: {
return irb_.Runtime().EmitGetCurrentThread();
}
- case IntrinsicHelper::TestSuspend:
case IntrinsicHelper::CheckSuspend: {
+ // We will add suspend by ourselves.
+ return NULL;
+ }
+ case IntrinsicHelper::TestSuspend: {
Expand_TestSuspend(call_inst);
return NULL;
}