Merge "ART: Fix StoreValue to use RefDisp when necessary."
diff --git a/compiler/dex/quick/gen_loadstore.cc b/compiler/dex/quick/gen_loadstore.cc
index 6469d9c..2dd7def 100644
--- a/compiler/dex/quick/gen_loadstore.cc
+++ b/compiler/dex/quick/gen_loadstore.cc
@@ -213,8 +213,13 @@
ResetDefLoc(rl_dest);
if (IsDirty(rl_dest.reg) && LiveOut(rl_dest.s_reg_low)) {
def_start = last_lir_insn_;
- ScopedMemRefType mem_ref_type(this, ResourceMask::kDalvikReg);
- Store32Disp(TargetReg(kSp), SRegOffset(rl_dest.s_reg_low), rl_dest.reg);
+ if (rl_dest.ref) {
+ ScopedMemRefType mem_ref_type(this, ResourceMask::kHeapRef);
+ StoreRefDisp(TargetReg(kSp), SRegOffset(rl_dest.s_reg_low), rl_dest.reg);
+ } else {
+ ScopedMemRefType mem_ref_type(this, ResourceMask::kDalvikReg);
+ Store32Disp(TargetReg(kSp), SRegOffset(rl_dest.s_reg_low), rl_dest.reg);
+ }
MarkClean(rl_dest);
def_end = last_lir_insn_;
if (!rl_dest.ref) {