summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/method_compiler.cc
diff options
context:
space:
mode:
author Logan Chien <loganchien@google.com> 2012-01-13 14:29:03 +0800
committer Shih-wei Liao <sliao@google.com> 2012-02-17 20:27:17 -0800
commit3354cec8828abd98ce18baaad199d7d9bc47bdd2 (patch)
tree2c27714650ffda890fefe75dfa6db31d9a0760ff /src/compiler_llvm/method_compiler.cc
parent9e0dbe424ae0c17d843bbbdd2ab61ffde8eb3e68 (diff)
Implement move-exception instruction.
Change-Id: I85ce1b59fcf9e5e29ff78c6fba150a5a5d69d8cd
Diffstat (limited to 'src/compiler_llvm/method_compiler.cc')
-rw-r--r--src/compiler_llvm/method_compiler.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 3bd79c7ed9..54e9decddb 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -1108,7 +1108,29 @@ void MethodCompiler::EmitInsn_MoveResult(uint32_t dex_pc,
void MethodCompiler::EmitInsn_MoveException(uint32_t dex_pc,
Instruction const* insn) {
- // UNIMPLEMENTED(WARNING);
+
+ Instruction::DecodedInstruction dec_insn(insn);
+
+ // Get thread-local exception field address
+ llvm::Constant* exception_field_offset =
+ irb_.getPtrEquivInt(Thread::ExceptionOffset().Int32Value());
+
+ llvm::Value* thread_object_addr =
+ irb_.CreateCall(irb_.GetRuntime(GetCurrentThread));
+
+ llvm::Value* exception_field_addr =
+ irb_.CreatePtrDisp(thread_object_addr, exception_field_offset,
+ irb_.getJObjectTy()->getPointerTo());
+
+ // Get exception object address
+ llvm::Value* exception_object_addr = irb_.CreateLoad(exception_field_addr);
+
+ // Set thread-local exception field address to NULL
+ irb_.CreateStore(irb_.getJNull(), exception_field_addr);
+
+ // Keep the exception object in the Dalvik register
+ EmitStoreDalvikReg(dec_insn.vA_, kObject, kAccurate, exception_object_addr);
+
irb_.CreateBr(GetNextBasicBlock(dex_pc));
}