From 3d661949dba4a2f3311e6f74a3c42b5addf1f534 Mon Sep 17 00:00:00 2001 From: buzbee Date: Wed, 14 Mar 2012 17:37:27 -0700 Subject: Real fix for 064 The recent ssa cleanup CL surfaced a somewhat subtle bug in live register tracking. The code generation register utilities attempt to remember and reuse live Dalvik register values for future use. This remembering takes place in the storeValueXX() code. For this to work, though, storeValue may only be called once during the compilation of any single Dalvik instruction. However, the code generation routine for CONST_CLASS included a somewhat complicated slow path with iternal branches and two generated "storeValue" locations. This resulted in downstream code expecting to find a live value in the wrong place. This fix is to note this special case and do a "clobber" on the ssa name. This CL also includes some sanity checking code that can detect multiple calls to storeValue during one intruction compilation to try to catch this situation in the future. Change-Id: I66a279140accd80cda83f66efe570c9702fb351b --- src/compiler/codegen/GenCommon.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/compiler/codegen/GenCommon.cc') diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc index 9b1654f764..72a596afed 100644 --- a/src/compiler/codegen/GenCommon.cc +++ b/src/compiler/codegen/GenCommon.cc @@ -870,6 +870,11 @@ void genConstClass(CompilationUnit* cUnit, MIR* mir, RegLocation rlDest, NULL); // Resolved, store and hop over following code storeValue(cUnit, rlDest, rlResult); + /* + * Because we have stores of the target value on two paths, + * clobber temp tracking for the destination using the ssa name + */ + oatClobberSReg(cUnit, rlDest.sRegLow); LIR* branch2 = opUnconditionalBranch(cUnit,0); // TUNING: move slow path to end & remove unconditional branch LIR* target1 = newLIR0(cUnit, kPseudoTargetLabel); @@ -881,6 +886,11 @@ void genConstClass(CompilationUnit* cUnit, MIR* mir, RegLocation rlDest, callRuntimeHelper(cUnit, rTgt); RegLocation rlResult = oatGetReturn(cUnit); storeValue(cUnit, rlDest, rlResult); + /* + * Because we have stores of the target value on two paths, + * clobber temp tracking for the destination using the ssa name + */ + oatClobberSReg(cUnit, rlDest.sRegLow); // Rejoin code paths LIR* target2 = newLIR0(cUnit, kPseudoTargetLabel); branch1->target = (LIR*)target1; -- cgit v1.2.3-59-g8ed1b