diff src/cpu/x86/vm/templateTable_x86_64.cpp @ 10102:f2e682ef3156

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>
author johnc
date Wed, 17 Apr 2013 10:57:02 -0700
parents db9981fd3124
children 9500809ceead
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon Apr 01 10:50:30 2013 -0700
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Wed Apr 17 10:57:02 2013 -0700
@@ -158,14 +158,19 @@
         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 */,
-                                   val /* new_val */,
+                                   new_val /* new_val */,
                                    r15_thread /* thread */,
                                    r8 /* tmp */,
                                    rbx /* tmp2 */);
         }
-
       }
       break;
 #endif // INCLUDE_ALL_GCS