Remove unnecessary exception and suspend checks.
1. Post exception check, when 2 consecutive branches are return and exception
unwind, respectively, merge these 2 branches as the caller doesn't care
the return value when an exception is pending..
2. If the method is leaf, we can elide the suspend check.
3. Also, move suspend checks to be before pushing shadow frame for the sake of "1"
and for reducing code size (Multiple returns).
Change-Id: I18f38f97f4e7714eadab4a1d6a568aa6e2c982ae
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index c912397..9e4c81b 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -286,11 +286,11 @@
llvm::FunctionType* GetFunctionType(uint32_t method_idx, bool is_static);
- void EmitGuard_ExceptionLandingPad(uint32_t dex_pc);
+ void EmitGuard_ExceptionLandingPad(uint32_t dex_pc, bool can_skip_unwind);
void EmitBranchExceptionLandingPad(uint32_t dex_pc);
- void EmitGuard_GarbageCollectionSuspend(uint32_t dex_pc);
+ void EmitGuard_GarbageCollectionSuspend();
llvm::Value* EmitCompareResultSelection(llvm::Value* cmp_eq,
llvm::Value* cmp_lt);
@@ -422,6 +422,8 @@
bool EmitInlinedStringLength(const std::vector<llvm::Value*>& args,
llvm::BasicBlock* after_invoke);
+ bool IsInstructionDirectToReturn(uint32_t dex_pc);
+
struct MethodInfo {
int64_t this_reg_idx;
bool this_will_not_be_null;
@@ -459,7 +461,6 @@
std::vector<int32_t> reg_to_shadow_frame_index_;
UniquePtr<DalvikReg> retval_reg_;
- llvm::BasicBlock* basic_block_stack_overflow_;
llvm::BasicBlock* basic_block_alloca_;
llvm::BasicBlock* basic_block_shadow_frame_;
llvm::BasicBlock* basic_block_reg_arg_init_;