< prev index next >

src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page

        

@@ -36,14 +36,18 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.inline.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/top.hpp"
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
+#if INCLUDE_ALL_GCS
+#include "shenandoahBarrierSetAssembler_x86.hpp"
+#endif
 
 // Declaration and definition of StubGenerator (no .hpp file).
 // For a more detailed description of the stub routine structure
 // see the comment in stubRoutines.hpp
 

@@ -1176,11 +1180,11 @@
   //     count   -  element count
   //     tmp     - scratch register
   //
   //     Destroy no registers!
   //
-  void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
+  void  gen_write_ref_array_pre_barrier(Register src, Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
       case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         // With G1, don't generate the call if we statically know that the target in uninitialized

@@ -1204,10 +1208,15 @@
          break;
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
       case BarrierSet::ModRef:
         break;
+#if INCLUDE_ALL_GCS
+      case BarrierSet::ShenandoahBarrierSet:
+        ShenandoahBarrierSetAssembler::bsasm()->arraycopy_prologue(_masm, dest_uninitialized, src, addr, count);
+        break;
+#endif
       default:
         ShouldNotReachHere();
 
     }
   }

@@ -1265,10 +1274,14 @@
           __ movb(Address(start, count, Address::times_1), 0);
           __ decrement(count);
           __ jcc(Assembler::greaterEqual, L_loop);
         }
         break;
+#if INCLUDE_ALL_GCS
+      case BarrierSet::ShenandoahBarrierSet:
+        break;
+#endif
       default:
         ShouldNotReachHere();
 
     }
   }

@@ -1882,11 +1895,11 @@
 
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
     if (is_oop) {
       __ movq(saved_to, to);
-      gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
+      gen_write_ref_array_pre_barrier(from, to, count, dest_uninitialized);
     }
 
     // 'from', 'to' and 'count' are now valid
     __ movptr(dword_count, count);
     __ shrptr(count, 1); // count => qword_count

@@ -1970,11 +1983,11 @@
     setup_arg_regs(); // from => rdi, to => rsi, count => rdx
                       // r9 and r10 may be used to save non-volatile registers
 
     if (is_oop) {
       // no registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
+      gen_write_ref_array_pre_barrier(from, to, count, dest_uninitialized);
     }
 
     assert_clean_int(count, rax); // Make sure 'count' is clean int.
     // 'from', 'to' and 'count' are now valid
     __ movptr(dword_count, count);

@@ -2068,11 +2081,11 @@
     // 'from', 'to' and 'qword_count' are now valid
     if (is_oop) {
       // Save to and count for store barrier
       __ movptr(saved_count, qword_count);
       // no registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(to, qword_count, dest_uninitialized);
+      gen_write_ref_array_pre_barrier(from, to, qword_count, dest_uninitialized);
     }
 
     // Copy from low to high addresses.  Use 'to' as scratch.
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));

@@ -2155,11 +2168,11 @@
     // 'from', 'to' and 'qword_count' are now valid
     if (is_oop) {
       // Save to and count for store barrier
       __ movptr(saved_count, qword_count);
       // No registers are destroyed by this call
-      gen_write_ref_array_pre_barrier(to, saved_count, dest_uninitialized);
+      gen_write_ref_array_pre_barrier(from, to, saved_count, dest_uninitialized);
     }
 
     __ jmp(L_copy_bytes);
 
     // Copy trailing qwords

@@ -2329,11 +2342,11 @@
     Address   end_to_addr(to,   length, TIMES_OOP, 0);
     // Loop-variant addresses.  They assume post-incremented count < 0.
     Address from_element_addr(end_from, count, TIMES_OOP, 0);
     Address   to_element_addr(end_to,   count, TIMES_OOP, 0);
 
-    gen_write_ref_array_pre_barrier(to, count, dest_uninitialized);
+    gen_write_ref_array_pre_barrier(from, to, count, dest_uninitialized);
 
     // Copy from low to high addresses, indexed from the end of each array.
     __ lea(end_from, end_from_addr);
     __ lea(end_to,   end_to_addr);
     __ movptr(r14_length, length);        // save a copy of the length
< prev index next >