hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp
changeset 5082 19e725a3d2eb
parent 4481 de92ec484f5e
child 5547 f4b087cbb361
equal deleted inserted replaced
5081:41cf61730680 5082:19e725a3d2eb
    80 void SATBMarkQueueSet::handle_zero_index_for_thread(JavaThread* t) {
    80 void SATBMarkQueueSet::handle_zero_index_for_thread(JavaThread* t) {
    81   DEBUG_ONLY(t->satb_mark_queue().verify_oops_in_buffer();)
    81   DEBUG_ONLY(t->satb_mark_queue().verify_oops_in_buffer();)
    82   t->satb_mark_queue().handle_zero_index();
    82   t->satb_mark_queue().handle_zero_index();
    83 }
    83 }
    84 
    84 
    85 void SATBMarkQueueSet::set_active_all_threads(bool b) {
    85 #ifdef ASSERT
       
    86 void SATBMarkQueueSet::dump_active_values(JavaThread* first,
       
    87                                           bool expected_active) {
       
    88   gclog_or_tty->print_cr("SATB queue active values for Java Threads");
       
    89   gclog_or_tty->print_cr(" SATB queue set: active is %s",
       
    90                          (is_active()) ? "TRUE" : "FALSE");
       
    91   gclog_or_tty->print_cr(" expected_active is %s",
       
    92                          (expected_active) ? "TRUE" : "FALSE");
       
    93   for (JavaThread* t = first; t; t = t->next()) {
       
    94     bool active = t->satb_mark_queue().is_active();
       
    95     gclog_or_tty->print_cr("  thread %s, active is %s",
       
    96                            t->name(), (active) ? "TRUE" : "FALSE");
       
    97   }
       
    98 }
       
    99 #endif // ASSERT
       
   100 
       
   101 void SATBMarkQueueSet::set_active_all_threads(bool b,
       
   102                                               bool expected_active) {
       
   103   assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
       
   104   JavaThread* first = Threads::first();
       
   105 
       
   106 #ifdef ASSERT
       
   107   if (_all_active != expected_active) {
       
   108     dump_active_values(first, expected_active);
       
   109 
       
   110     // I leave this here as a guarantee, instead of an assert, so
       
   111     // that it will still be compiled in if we choose to uncomment
       
   112     // the #ifdef ASSERT in a product build. The whole block is
       
   113     // within an #ifdef ASSERT so the guarantee will not be compiled
       
   114     // in a product build anyway.
       
   115     guarantee(false,
       
   116               "SATB queue set has an unexpected active value");
       
   117   }
       
   118 #endif // ASSERT
    86   _all_active = b;
   119   _all_active = b;
    87   for(JavaThread* t = Threads::first(); t; t = t->next()) {
   120 
       
   121   for (JavaThread* t = first; t; t = t->next()) {
       
   122 #ifdef ASSERT
       
   123     bool active = t->satb_mark_queue().is_active();
       
   124     if (active != expected_active) {
       
   125       dump_active_values(first, expected_active);
       
   126 
       
   127       // I leave this here as a guarantee, instead of an assert, so
       
   128       // that it will still be compiled in if we choose to uncomment
       
   129       // the #ifdef ASSERT in a product build. The whole block is
       
   130       // within an #ifdef ASSERT so the guarantee will not be compiled
       
   131       // in a product build anyway.
       
   132       guarantee(false,
       
   133                 "thread has an unexpected active value in its SATB queue");
       
   134     }
       
   135 #endif // ASSERT
    88     t->satb_mark_queue().set_active(b);
   136     t->satb_mark_queue().set_active(b);
    89   }
   137   }
    90 }
   138 }
    91 
   139 
    92 void SATBMarkQueueSet::set_closure(ObjectClosure* closure) {
   140 void SATBMarkQueueSet::set_closure(ObjectClosure* closure) {