Use try item offset to find catch block instead of Dex PC.
Change-Id: Icb8cd07a824be638c02a6204cfaf034a249d49b5
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 52807e3..f9a2833 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -3841,16 +3841,11 @@
// Find catch block with matching type
llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
- // TODO: Maybe passing try item offset will be a better idea? For now,
- // we are passing dex_pc, so that we can use existing runtime support
- // function directly. However, in the runtime supporting function we
- // have to search for try item with binary search which can be
- // eliminated.
- llvm::Value* dex_pc_value = irb_.getInt32(ti->start_addr_);
+ llvm::Value* ti_offset_value = irb_.getInt32(ti_offset);
llvm::Value* catch_handler_index_value =
irb_.CreateCall2(irb_.GetRuntime(FindCatchBlock),
- method_object_addr, dex_pc_value);
+ method_object_addr, ti_offset_value);
// Switch instruction (Go to unwind basic block by default)
llvm::SwitchInst* sw =