Wed, 17 Apr 2013 10:57:02 -0700
8012335: G1: Fix bug with compressed oops in template interpreter on x86 and sparc.
Summary: 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
Contributed-by: Martin Doerr <martin.doerr@sap.com>
src/cpu/sparc/vm/templateTable_sparc.cpp | file | annotate | diff | comparison | revisions | |
src/cpu/x86/vm/templateTable_x86_64.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp Mon Apr 01 10:50:30 2013 -0700 1.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Apr 17 10:57:02 2013 -0700 1.3 @@ -63,6 +63,13 @@ 1.4 noreg /* pre_val */, 1.5 tmp, true /*preserve_o_regs*/); 1.6 1.7 + // G1 barrier needs uncompressed oop for region cross check. 1.8 + Register new_val = val; 1.9 + if (UseCompressedOops && val != G0) { 1.10 + new_val = tmp; 1.11 + __ mov(val, new_val); 1.12 + } 1.13 + 1.14 if (index == noreg ) { 1.15 assert(Assembler::is_simm13(offset), "fix this code"); 1.16 __ store_heap_oop(val, base, offset); 1.17 @@ -79,7 +86,7 @@ 1.18 __ add(base, index, base); 1.19 } 1.20 } 1.21 - __ g1_write_barrier_post(base, val, tmp); 1.22 + __ g1_write_barrier_post(base, new_val, tmp); 1.23 } 1.24 } 1.25 break;
2.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp Mon Apr 01 10:50:30 2013 -0700 2.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Apr 17 10:57:02 2013 -0700 2.3 @@ -158,14 +158,19 @@ 2.4 if (val == noreg) { 2.5 __ store_heap_oop_null(Address(rdx, 0)); 2.6 } else { 2.7 + // G1 barrier needs uncompressed oop for region cross check. 2.8 + Register new_val = val; 2.9 + if (UseCompressedOops) { 2.10 + new_val = rbx; 2.11 + __ movptr(new_val, val); 2.12 + } 2.13 __ store_heap_oop(Address(rdx, 0), val); 2.14 __ g1_write_barrier_post(rdx /* store_adr */, 2.15 - val /* new_val */, 2.16 + new_val /* new_val */, 2.17 r15_thread /* thread */, 2.18 r8 /* tmp */, 2.19 rbx /* tmp2 */); 2.20 } 2.21 - 2.22 } 2.23 break; 2.24 #endif // INCLUDE_ALL_GCS