< prev index next >

src/cpu/x86/vm/c1_Runtime1_x86.cpp

Print this page
rev 8209 : 8013171: G1: C1 x86_64 barriers use 32-bit accesses to 64-bit PtrQueue::_index
Reviewed-by:

@@ -1639,40 +1639,36 @@
         const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
         const Register tmp = rdx;
 
         NOT_LP64(__ get_thread(thread);)
 
-        Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                             PtrQueue::byte_offset_of_active()));
-
         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                              PtrQueue::byte_offset_of_index()));
         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                         PtrQueue::byte_offset_of_buf()));
 
-
         Label done;
         Label runtime;
 
         // Can we store original value in the thread's buffer?
 
 #ifdef _LP64
-        __ movslq(tmp, queue_index);
+        __ movq(tmp, queue_index);
         __ cmpq(tmp, 0);
 #else
-        __ cmpl(queue_index, 0);
+        __ movl(tmp, queue_index);
+        __ cmpl(tmp, 0);
 #endif
         __ jcc(Assembler::equal, runtime);
 #ifdef _LP64
         __ subq(tmp, wordSize);
-        __ movl(queue_index, tmp);
-        __ addq(tmp, buffer);
+        __ movq(queue_index, tmp);
 #else
-        __ subl(queue_index, wordSize);
-        __ movl(tmp, buffer);
-        __ addl(tmp, queue_index);
+        __ subl(tmp, wordSize);
+        __ movl(queue_index, tmp);
 #endif
+        __ addptr(tmp, buffer);
 
         // prev_val (rax)
         f.load_argument(0, pre_val);
         __ movptr(Address(tmp, 0), pre_val);
         __ jmp(done);

@@ -1735,13 +1731,15 @@
         Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
                                         PtrQueue::byte_offset_of_buf()));
 
         __ push(rax);
         __ push(rcx);
+        __ push(rdx);
 
         const Register cardtable = rax;
         const Register card_addr = rcx;
+        const Register tmp = rdx;
 
         f.load_argument(0, card_addr);
         __ shrptr(card_addr, CardTableModRefBS::card_shift);
         // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
         // a valid address and therefore is not properly handled by the relocation code.

@@ -1760,32 +1758,30 @@
         // storing region crossing non-NULL, card is clean.
         // dirty card and log.
 
         __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
 
-        __ cmpl(queue_index, 0);
+#ifdef _LP64
+        __ movq(tmp, queue_index);
+        __ cmpq(tmp, 0);
+#else
+        __ movl(tmp, queue_index);
+        __ cmpl(tmp, 0);
+#endif
         __ jcc(Assembler::equal, runtime);
-        __ subl(queue_index, wordSize);
-
-        const Register buffer_addr = rbx;
-        __ push(rbx);
-
-        __ movptr(buffer_addr, buffer);
-
 #ifdef _LP64
-        __ movslq(rscratch1, queue_index);
-        __ addptr(buffer_addr, rscratch1);
+        __ subq(tmp, wordSize);
+        __ movq(queue_index, tmp);
 #else
-        __ addptr(buffer_addr, queue_index);
+        __ subl(tmp, wordSize);
+        __ movl(queue_index, tmp);
 #endif
-        __ movptr(Address(buffer_addr, 0), card_addr);
-
-        __ pop(rbx);
+        __ addptr(tmp, buffer);
+        __ movptr(Address(tmp, 0), card_addr);
         __ jmp(done);
 
         __ bind(runtime);
-        __ push(rdx);
 #ifdef _LP64
         __ push(r8);
         __ push(r9);
         __ push(r10);
         __ push(r11);

@@ -1803,16 +1799,15 @@
         __ pop(r11);
         __ pop(r10);
         __ pop(r9);
         __ pop(r8);
 #endif
-        __ pop(rdx);
         __ bind(done);
 
+        __ pop(rdx);
         __ pop(rcx);
         __ pop(rax);
-
       }
       break;
 #endif // INCLUDE_ALL_GCS
 
     case predicate_failed_trap_id:
< prev index next >