diff options
Diffstat (limited to 'src/compiler')
| -rw-r--r-- | src/compiler/codegen/arm/call_arm.cc | 12 | ||||
| -rw-r--r-- | src/compiler/codegen/arm/codegen_arm.h | 1 | ||||
| -rw-r--r-- | src/compiler/codegen/codegen.h | 2 | ||||
| -rw-r--r-- | src/compiler/codegen/gen_common.cc | 14 | ||||
| -rw-r--r-- | src/compiler/codegen/mips/call_mips.cc | 12 | ||||
| -rw-r--r-- | src/compiler/codegen/mips/codegen_mips.h | 1 | ||||
| -rw-r--r-- | src/compiler/codegen/mir_to_lir.cc | 1 | ||||
| -rw-r--r-- | src/compiler/codegen/x86/call_x86.cc | 9 | ||||
| -rw-r--r-- | src/compiler/codegen/x86/codegen_x86.h | 1 |
9 files changed, 38 insertions, 15 deletions
diff --git a/src/compiler/codegen/arm/call_arm.cc b/src/compiler/codegen/arm/call_arm.cc index 9696bcab6f..cb3af5eb22 100644 --- a/src/compiler/codegen/arm/call_arm.cc +++ b/src/compiler/codegen/arm/call_arm.cc @@ -541,6 +541,18 @@ void ArmCodegen::GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation GenMemBarrier(cu, kStoreLoad); } +void ArmCodegen::GenMoveException(CompilationUnit* cu, RegLocation rl_dest) +{ + int ex_offset = Thread::ExceptionOffset().Int32Value(); + RegLocation rl_result = EvalLoc(cu, rl_dest, kCoreReg, true); + int reset_reg = AllocTemp(cu); + LoadWordDisp(cu, rARM_SELF, ex_offset, rl_result.low_reg); + LoadConstant(cu, reset_reg, 0); + StoreWordDisp(cu, rARM_SELF, ex_offset, reset_reg); + FreeTemp(cu, reset_reg); + StoreValue(cu, rl_dest, rl_result); +} + /* * Mark garbage collection card. Skip if the value we're storing is null. */ diff --git a/src/compiler/codegen/arm/codegen_arm.h b/src/compiler/codegen/arm/codegen_arm.h index ca39e5a46b..8d99049c6b 100644 --- a/src/compiler/codegen/arm/codegen_arm.h +++ b/src/compiler/codegen/arm/codegen_arm.h @@ -138,6 +138,7 @@ class ArmCodegen : public Codegen { virtual void GenMemBarrier(CompilationUnit* cu, MemBarrierKind barrier_kind); virtual void GenMonitorEnter(CompilationUnit* cu, int opt_flags, RegLocation rl_src); virtual void GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation rl_src); + virtual void GenMoveException(CompilationUnit* cu, RegLocation rl_dest); virtual void GenMultiplyByTwoBitMultiplier(CompilationUnit* cu, RegLocation rl_src, RegLocation rl_result, int lit, int first_bit, int second_bit); diff --git a/src/compiler/codegen/codegen.h b/src/compiler/codegen/codegen.h index 7a85ce8d30..595a1dbb61 100644 --- a/src/compiler/codegen/codegen.h +++ b/src/compiler/codegen/codegen.h @@ -130,7 +130,6 @@ class Codegen { void GenConstClass(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest); void GenConstString(CompilationUnit* cu, uint32_t string_idx, RegLocation rl_dest); void GenNewInstance(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest); - void GenMoveException(CompilationUnit* cu, RegLocation rl_dest); void GenThrow(CompilationUnit* cu, RegLocation rl_src); void GenInstanceof(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest, RegLocation rl_src); @@ -332,6 +331,7 @@ class Codegen { virtual void GenMemBarrier(CompilationUnit* cu, MemBarrierKind barrier_kind) = 0; virtual void GenMonitorEnter(CompilationUnit* cu, int opt_flags, RegLocation rl_src) = 0; virtual void GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation rl_src) = 0; + virtual void GenMoveException(CompilationUnit* cu, RegLocation rl_dest) = 0; virtual void GenMultiplyByTwoBitMultiplier(CompilationUnit* cu, RegLocation rl_src, RegLocation rl_result, int lit, int first_bit, int second_bit) = 0; diff --git a/src/compiler/codegen/gen_common.cc b/src/compiler/codegen/gen_common.cc index 57cf2a5597..e1054db201 100644 --- a/src/compiler/codegen/gen_common.cc +++ b/src/compiler/codegen/gen_common.cc @@ -915,20 +915,6 @@ void Codegen::GenNewInstance(CompilationUnit* cu, uint32_t type_idx, RegLocation StoreValue(cu, rl_dest, rl_result); } -void Codegen::GenMoveException(CompilationUnit* cu, RegLocation rl_dest) -{ - FlushAllRegs(cu); /* Everything to home location */ - int func_offset = ENTRYPOINT_OFFSET(pGetAndClearException); - if (cu->instruction_set == kX86) { - // Runtime helper will load argument for x86. - CallRuntimeHelperReg(cu, func_offset, TargetReg(kArg0), false); - } else { - CallRuntimeHelperReg(cu, func_offset, TargetReg(kSelf), false); - } - RegLocation rl_result = GetReturn(cu, false); - StoreValue(cu, rl_dest, rl_result); -} - void Codegen::GenThrow(CompilationUnit* cu, RegLocation rl_src) { FlushAllRegs(cu); diff --git a/src/compiler/codegen/mips/call_mips.cc b/src/compiler/codegen/mips/call_mips.cc index f14ebab81a..76c9fbd393 100644 --- a/src/compiler/codegen/mips/call_mips.cc +++ b/src/compiler/codegen/mips/call_mips.cc @@ -294,6 +294,18 @@ void MipsCodegen::GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation MarkSafepointPC(cu, call_inst); } +void MipsCodegen::GenMoveException(CompilationUnit* cu, RegLocation rl_dest) +{ + int ex_offset = Thread::ExceptionOffset().Int32Value(); + RegLocation rl_result = EvalLoc(cu, rl_dest, kCoreReg, true); + int reset_reg = AllocTemp(cu); + LoadWordDisp(cu, rMIPS_SELF, ex_offset, rl_result.low_reg); + LoadConstant(cu, reset_reg, 0); + StoreWordDisp(cu, rMIPS_SELF, ex_offset, reset_reg); + FreeTemp(cu, reset_reg); + StoreValue(cu, rl_dest, rl_result); +} + /* * Mark garbage collection card. Skip if the value we're storing is null. */ diff --git a/src/compiler/codegen/mips/codegen_mips.h b/src/compiler/codegen/mips/codegen_mips.h index 4178f2eb12..fcd5669422 100644 --- a/src/compiler/codegen/mips/codegen_mips.h +++ b/src/compiler/codegen/mips/codegen_mips.h @@ -138,6 +138,7 @@ class MipsCodegen : public Codegen { virtual void GenMemBarrier(CompilationUnit* cu, MemBarrierKind barrier_kind); virtual void GenMonitorEnter(CompilationUnit* cu, int opt_flags, RegLocation rl_src); virtual void GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation rl_src); + virtual void GenMoveException(CompilationUnit* cu, RegLocation rl_dest); virtual void GenMultiplyByTwoBitMultiplier(CompilationUnit* cu, RegLocation rl_src, RegLocation rl_result, int lit, int first_bit, int second_bit); diff --git a/src/compiler/codegen/mir_to_lir.cc b/src/compiler/codegen/mir_to_lir.cc index 1d64661c5d..2bc0f8642b 100644 --- a/src/compiler/codegen/mir_to_lir.cc +++ b/src/compiler/codegen/mir_to_lir.cc @@ -85,6 +85,7 @@ static bool CompileDalvikInstruction(CompilationUnit* cu, MIR* mir, BasicBlock* case Instruction::MOVE_EXCEPTION: cg->GenMoveException(cu, rl_dest); break; + case Instruction::RETURN_VOID: if (((cu->access_flags & kAccConstructor) != 0) && cu->compiler->RequiresConstructorBarrier(Thread::Current(), cu->dex_file, diff --git a/src/compiler/codegen/x86/call_x86.cc b/src/compiler/codegen/x86/call_x86.cc index 80de901e8b..727c5e861a 100644 --- a/src/compiler/codegen/x86/call_x86.cc +++ b/src/compiler/codegen/x86/call_x86.cc @@ -191,6 +191,15 @@ void X86Codegen::GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation branch2->target = NewLIR0(cu, kPseudoTargetLabel); } +void X86Codegen::GenMoveException(CompilationUnit* cu, RegLocation rl_dest) +{ + int ex_offset = Thread::ExceptionOffset().Int32Value(); + RegLocation rl_result = EvalLoc(cu, rl_dest, kCoreReg, true); + NewLIR2(cu, kX86Mov32RT, rl_result.low_reg, ex_offset); + NewLIR2(cu, kX86Mov32TI, ex_offset, 0); + StoreValue(cu, rl_dest, rl_result); +} + /* * Mark garbage collection card. Skip if the value we're storing is null. */ diff --git a/src/compiler/codegen/x86/codegen_x86.h b/src/compiler/codegen/x86/codegen_x86.h index f467e83770..25f4461237 100644 --- a/src/compiler/codegen/x86/codegen_x86.h +++ b/src/compiler/codegen/x86/codegen_x86.h @@ -139,6 +139,7 @@ class X86Codegen : public Codegen { virtual void GenMemBarrier(CompilationUnit* cu, MemBarrierKind barrier_kind); virtual void GenMonitorEnter(CompilationUnit* cu, int opt_flags, RegLocation rl_src); virtual void GenMonitorExit(CompilationUnit* cu, int opt_flags, RegLocation rl_src); + virtual void GenMoveException(CompilationUnit* cu, RegLocation rl_dest); virtual void GenMultiplyByTwoBitMultiplier(CompilationUnit* cu, RegLocation rl_src, RegLocation rl_result, int lit, int first_bit, int second_bit); |