8012335: G1: Fix bug with compressed oops in template interpreter on x86 and sparc

In do_oop_store the uncompressed value of the oop being stored needs to be preserved and passed to g1_write_barrier_post. This is necessary for the heap region cross check to work correctly.

Reviewed-by: coleenp, johnc
This commit is contained in:
Martin Doerr 2013-04-17 10:57:02 -07:00 committed by John Cuthbertson
parent 7f78a7f475
commit d61a4656e4
2 changed files with 15 additions and 3 deletions

View file

@ -63,6 +63,13 @@ static void do_oop_store(InterpreterMacroAssembler* _masm,
noreg /* pre_val */,
tmp, true /*preserve_o_regs*/);
// G1 barrier needs uncompressed oop for region cross check.
Register new_val = val;
if (UseCompressedOops && val != G0) {
new_val = tmp;
__ mov(val, new_val);
}
if (index == noreg ) {
assert(Assembler::is_simm13(offset), "fix this code");
__ store_heap_oop(val, base, offset);
@ -79,7 +86,7 @@ static void do_oop_store(InterpreterMacroAssembler* _masm,
__ add(base, index, base);
}
}
__ g1_write_barrier_post(base, val, tmp);
__ g1_write_barrier_post(base, new_val, tmp);
}
}
break;