src/cpu/x86/vm/templateTable_x86_64.cpp
Print this page
rev 4482 : G1: Fix bug with compressed oops in template interpreter on x86 and sparc.
In do_oop_store an uncompressed oop needs to be preserved and passed to
g1_write_barrier_post. This is necessary for the heap region cross
check which did not work correctly.
*** 156,168 ****
val != noreg /* tosca_live */,
false /* expand_call */);
if (val == noreg) {
__ store_heap_oop_null(Address(rdx, 0));
} else {
__ store_heap_oop(Address(rdx, 0), val);
__ g1_write_barrier_post(rdx /* store_adr */,
! val /* new_val */,
r15_thread /* thread */,
r8 /* tmp */,
rbx /* tmp2 */);
}
--- 156,174 ----
val != noreg /* tosca_live */,
false /* expand_call */);
if (val == noreg) {
__ store_heap_oop_null(Address(rdx, 0));
} else {
+ // G1 barrier needs uncompressed oop for region cross check.
+ Register new_val = val;
+ if (UseCompressedOops) {
+ new_val = rbx;
+ __ movptr(new_val, val);
+ }
__ store_heap_oop(Address(rdx, 0), val);
__ g1_write_barrier_post(rdx /* store_adr */,
! new_val /* new_val */,
r15_thread /* thread */,
r8 /* tmp */,
rbx /* tmp2 */);
}