src/cpu/sparc/vm/c1_Runtime1_sparc.cpp

Print this page

        

@@ -837,35 +837,56 @@
       }
       break;
 
 #if INCLUDE_ALL_GCS
     case g1_pre_barrier_slow_id:
+    case g1_pre_barrier_slow_with_recheck_id:
       { // G4: previous value of memory
         BarrierSet* bs = Universe::heap()->barrier_set();
         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
           __ save_frame(0);
           __ set((int)id, O1);
           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
           __ should_not_reach_here();
           break;
         }
 
+        if (id == g1_pre_barrier_slow_id) {
         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
+        } else {
+          __ set_info("g1_pre_barrier_slow_with_recheck_id", dont_gc_arguments);
+        }
 
         Register pre_val = G4;
         Register tmp  = G1_scratch;
         Register tmp2 = G3_scratch;
 
         Label refill, restart;
-        bool with_frame = false; // I don't know if we can do with-frame.
+        int satb_q_active_byte_offset =
+          in_bytes(JavaThread::satb_mark_queue_offset() +
+                   SATBMarkQueue::byte_offset_of_active());
         int satb_q_index_byte_offset =
           in_bytes(JavaThread::satb_mark_queue_offset() +
                    SATBMarkQueue::byte_offset_of_index());
         int satb_q_buf_byte_offset =
           in_bytes(JavaThread::satb_mark_queue_offset() +
                    SATBMarkQueue::byte_offset_of_buf());
 
+        if (id == g1_pre_barrier_slow_with_recheck_id) {
+          // Is marking still active?
+          if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
+            __ ld(G2_thread, satb_q_active_byte_offset, tmp);
+          } else {
+            guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
+                     "Assumption");
+            __ ldsb(G2_thread, satb_q_active_byte_offset, tmp);
+          }
+          __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, restart);
+          __ retl();
+          __ delayed()->nop();
+        }
+
         __ bind(restart);
         // Load the index into the SATB buffer. SATBMarkQueue::_index is a
         // size_t so ld_ptr is appropriate
         __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);