< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.cpp

Print this page
rev 54116 : [mq]: JDK-8220671.patch


 148   // If we are creating the thread during a marking cycle, we should
 149   // set the active field of the SATB queue to true.  That involves
 150   // copying the global is_active value to this thread's queue, which
 151   // is done without any direct synchronization here.
 152   //
 153   // The activation and deactivation of the SATB queues occurs at the
 154   // beginning / end of a marking cycle, and is done during
 155   // safepoints.  This function is called just before a thread is
 156   // added to its corresponding threads list (for Java or non-Java
 157   // threads, respectively).
 158   //
 159   // For Java threads, that's done while holding the Threads_lock,
 160   // which ensures we're not at a safepoint, so reading the global
 161   // is_active state is synchronized against update.
 162   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 163          "Should not be at a safepoint");
 164   // For non-Java threads, thread creation (and list addition) may,
 165   // and indeed usually does, occur during a safepoint.  But such
 166   // creation isn't concurrent with updating the global SATB active
 167   // state.

 168   bool is_satb_active = _satb_mark_queue_set.is_active();
 169   G1ThreadLocalData::satb_mark_queue(thread).set_active(is_satb_active);
 170 }
 171 
 172 void G1BarrierSet::on_thread_detach(Thread* thread) {
 173   // Flush any deferred card marks.
 174   CardTableBarrierSet::on_thread_detach(thread);
 175   G1ThreadLocalData::satb_mark_queue(thread).flush();
 176   G1ThreadLocalData::dirty_card_queue(thread).flush();
 177 }
 178 
 179 BufferNode::Allocator& G1BarrierSet::satb_mark_queue_buffer_allocator() {
 180   return _satb_mark_queue_buffer_allocator;
 181 }
 182 
 183 BufferNode::Allocator& G1BarrierSet::dirty_card_queue_buffer_allocator() {
 184   return _dirty_card_queue_buffer_allocator;
 185 }


 148   // If we are creating the thread during a marking cycle, we should
 149   // set the active field of the SATB queue to true.  That involves
 150   // copying the global is_active value to this thread's queue, which
 151   // is done without any direct synchronization here.
 152   //
 153   // The activation and deactivation of the SATB queues occurs at the
 154   // beginning / end of a marking cycle, and is done during
 155   // safepoints.  This function is called just before a thread is
 156   // added to its corresponding threads list (for Java or non-Java
 157   // threads, respectively).
 158   //
 159   // For Java threads, that's done while holding the Threads_lock,
 160   // which ensures we're not at a safepoint, so reading the global
 161   // is_active state is synchronized against update.
 162   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 163          "Should not be at a safepoint");
 164   // For non-Java threads, thread creation (and list addition) may,
 165   // and indeed usually does, occur during a safepoint.  But such
 166   // creation isn't concurrent with updating the global SATB active
 167   // state.
 168   SuspendibleThreadSetJoiner sts_join(!thread->is_Java_thread());
 169   bool is_satb_active = _satb_mark_queue_set.is_active();
 170   G1ThreadLocalData::satb_mark_queue(thread).set_active(is_satb_active);
 171 }
 172 
 173 void G1BarrierSet::on_thread_detach(Thread* thread) {
 174   // Flush any deferred card marks.
 175   CardTableBarrierSet::on_thread_detach(thread);
 176   G1ThreadLocalData::satb_mark_queue(thread).flush();
 177   G1ThreadLocalData::dirty_card_queue(thread).flush();
 178 }
 179 
 180 BufferNode::Allocator& G1BarrierSet::satb_mark_queue_buffer_allocator() {
 181   return _satb_mark_queue_buffer_allocator;
 182 }
 183 
 184 BufferNode::Allocator& G1BarrierSet::dirty_card_queue_buffer_allocator() {
 185   return _dirty_card_queue_buffer_allocator;
 186 }
< prev index next >