From d8c3e3608a7b47e82186e4f8118541ef06d9eab2 Mon Sep 17 00:00:00 2001 From: Alexei Zavjalov Date: Wed, 8 Oct 2014 15:51:59 +0700 Subject: ART: X86: GenLongArith should handle overlapped VRs In a case, when src and dest VRs are overlapped when we called GenLongArith it may cause the incorrect use of regs. The solution is to map src to an physical reg and work with this reg instead of mem. Renamed BadOverlap() to PartiallyIntersects() for consistency. Change-Id: Ia3fc7f741f0a92556e1b2a1b084506662ef04c9d Signed-off-by: Katkov, Serguei I Signed-off-by: Alexei Zavjalov --- compiler/dex/quick/codegen_util.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/dex/quick/codegen_util.cc') diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index e18116ec3c..80a1ac4c52 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -1185,12 +1185,18 @@ int32_t Mir2Lir::LowestSetBit(uint64_t x) { return bit_posn; } -bool Mir2Lir::BadOverlap(RegLocation rl_src, RegLocation rl_dest) { +bool Mir2Lir::PartiallyIntersects(RegLocation rl_src, RegLocation rl_dest) { DCHECK(rl_src.wide); DCHECK(rl_dest.wide); return (abs(mir_graph_->SRegToVReg(rl_src.s_reg_low) - mir_graph_->SRegToVReg(rl_dest.s_reg_low)) == 1); } +bool Mir2Lir::Intersects(RegLocation rl_src, RegLocation rl_dest) { + DCHECK(rl_src.wide); + DCHECK(rl_dest.wide); + return (abs(mir_graph_->SRegToVReg(rl_src.s_reg_low) - mir_graph_->SRegToVReg(rl_dest.s_reg_low)) <= 1); +} + LIR *Mir2Lir::OpCmpMemImmBranch(ConditionCode cond, RegStorage temp_reg, RegStorage base_reg, int offset, int check_value, LIR* target, LIR** compare) { // Handle this for architectures that can't compare to memory. -- cgit v1.2.3-59-g8ed1b