summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/method_compiler.cc
diff options
context:
space:
mode:
author jeffhao <jeffhao@google.com> 2013-01-15 17:57:45 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2013-01-15 17:57:45 -0800
commit79ec6cd9309e8f916a6d80957674c74e1104e7fc (patch)
tree09621d97c37af5f66c1d19cf484bb587b9d4fae0 /src/compiler_llvm/method_compiler.cc
parentec0f83d95e2174c97e93279ffa71642be7e12b60 (diff)
parenta1ae861c673ab5160a2a7afee2ada806cb61966b (diff)
Merge "Change LLVM exception check to check all thread flags." into dalvik-dev
Diffstat (limited to 'src/compiler_llvm/method_compiler.cc')
-rw-r--r--src/compiler_llvm/method_compiler.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index ccec7e96ec..7ab11f5bd5 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -3540,16 +3540,34 @@ void MethodCompiler::EmitGuard_ExceptionLandingPad(uint32_t dex_pc, bool can_ski
return;
}
- llvm::Value* exception_pending = irb_.Runtime().EmitIsExceptionPending();
-
llvm::BasicBlock* block_cont = CreateBasicBlockWithDexPC(dex_pc, "cont");
+ llvm::BasicBlock* block_flags = CreateBasicBlockWithDexPC(dex_pc, "flags");
+ llvm::BasicBlock* block_suspend = CreateBasicBlockWithDexPC(dex_pc, "suspend");
+
+ llvm::Value* flags =
+ irb_.Runtime().EmitLoadFromThreadOffset(art::Thread::ThreadFlagsOffset().Int32Value(),
+ irb_.getInt16Ty(),
+ kTBAARuntimeInfo);
+ llvm::Value* flags_set = irb_.CreateICmpNE(flags, irb_.getInt16(0));
+ irb_.CreateCondBr(flags_set, block_flags, block_cont, kUnlikely);
+
+ irb_.SetInsertPoint(block_flags);
+ llvm::Value* exception_pending = irb_.CreateAnd(flags, irb_.getInt16(art::kExceptionPending));
+ llvm::Value* exception_set = irb_.CreateICmpNE(exception_pending, irb_.getInt16(0));
if (lpad) {
- irb_.CreateCondBr(exception_pending, lpad, block_cont, kUnlikely);
+ irb_.CreateCondBr(exception_set, lpad, block_suspend, kLikely);
} else {
- irb_.CreateCondBr(exception_pending, GetUnwindBasicBlock(), block_cont, kUnlikely);
+ irb_.CreateCondBr(exception_set, GetUnwindBasicBlock(), block_suspend, kLikely);
}
+ irb_.SetInsertPoint(block_suspend);
+ if (dex_pc != art::DexFile::kDexNoIndex) {
+ EmitUpdateDexPC(dex_pc);
+ }
+ irb_.Runtime().EmitTestSuspend();
+ irb_.CreateBr(block_cont);
+
irb_.SetInsertPoint(block_cont);
}