Workaround for Issue 7250540
There's a problem (originating with Dalvik's failure to properly type constants) with
Dalvik vregs that are used in both reference and floating point situations. In
particular, if a constant zero is used in a floating point context, the verifier in
some cases will treat it as a null pointer for the purposes generating the GC map.
If that vreg ends up promoted to a floating point value, the run-time value of that
vreg will not be found during garbage collection. As a quick workaround, this
CL causes the compiler to detect this special case of an immediate zero being loaded
into a promoted floating point register and also store a zero in the core/ref identity
of that vreg.
Note, the CL also excludes references from store elimination.
Change-Id: I72f0a96744823ff9c5a2bd961a5e39ac4bbc707b
diff --git a/src/compiler/codegen/mir_to_lir.cc b/src/compiler/codegen/mir_to_lir.cc
index 5a6a5fc..3dc6d59 100644
--- a/src/compiler/codegen/mir_to_lir.cc
+++ b/src/compiler/codegen/mir_to_lir.cc
@@ -141,12 +141,14 @@
rl_result = EvalLoc(cu, rl_dest, kAnyReg, true);
cg->LoadConstantNoClobber(cu, rl_result.low_reg, vB);
cg->StoreValue(cu, rl_dest, rl_result);
+ cg->Workaround7250540(cu, rl_dest, vB);
break;
case Instruction::CONST_HIGH16:
rl_result = EvalLoc(cu, rl_dest, kAnyReg, true);
cg->LoadConstantNoClobber(cu, rl_result.low_reg, vB << 16);
cg->StoreValue(cu, rl_dest, rl_result);
+ cg->Workaround7250540(cu, rl_dest, vB);
break;
case Instruction::CONST_WIDE_16: