src/share/vm/gc_implementation/g1/satbQueue.cpp

changeset 1752
d4197f8d516a
parent 1546
44f61c24ddab
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/gc_implementation/g1/satbQueue.cpp	Mon Mar 22 02:40:53 2010 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/satbQueue.cpp	Thu Mar 18 12:14:59 2010 -0400
     1.3 @@ -82,9 +82,57 @@
     1.4    t->satb_mark_queue().handle_zero_index();
     1.5  }
     1.6  
     1.7 -void SATBMarkQueueSet::set_active_all_threads(bool b) {
     1.8 +#ifdef ASSERT
     1.9 +void SATBMarkQueueSet::dump_active_values(JavaThread* first,
    1.10 +                                          bool expected_active) {
    1.11 +  gclog_or_tty->print_cr("SATB queue active values for Java Threads");
    1.12 +  gclog_or_tty->print_cr(" SATB queue set: active is %s",
    1.13 +                         (is_active()) ? "TRUE" : "FALSE");
    1.14 +  gclog_or_tty->print_cr(" expected_active is %s",
    1.15 +                         (expected_active) ? "TRUE" : "FALSE");
    1.16 +  for (JavaThread* t = first; t; t = t->next()) {
    1.17 +    bool active = t->satb_mark_queue().is_active();
    1.18 +    gclog_or_tty->print_cr("  thread %s, active is %s",
    1.19 +                           t->name(), (active) ? "TRUE" : "FALSE");
    1.20 +  }
    1.21 +}
    1.22 +#endif // ASSERT
    1.23 +
    1.24 +void SATBMarkQueueSet::set_active_all_threads(bool b,
    1.25 +                                              bool expected_active) {
    1.26 +  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
    1.27 +  JavaThread* first = Threads::first();
    1.28 +
    1.29 +#ifdef ASSERT
    1.30 +  if (_all_active != expected_active) {
    1.31 +    dump_active_values(first, expected_active);
    1.32 +
    1.33 +    // I leave this here as a guarantee, instead of an assert, so
    1.34 +    // that it will still be compiled in if we choose to uncomment
    1.35 +    // the #ifdef ASSERT in a product build. The whole block is
    1.36 +    // within an #ifdef ASSERT so the guarantee will not be compiled
    1.37 +    // in a product build anyway.
    1.38 +    guarantee(false,
    1.39 +              "SATB queue set has an unexpected active value");
    1.40 +  }
    1.41 +#endif // ASSERT
    1.42    _all_active = b;
    1.43 -  for(JavaThread* t = Threads::first(); t; t = t->next()) {
    1.44 +
    1.45 +  for (JavaThread* t = first; t; t = t->next()) {
    1.46 +#ifdef ASSERT
    1.47 +    bool active = t->satb_mark_queue().is_active();
    1.48 +    if (active != expected_active) {
    1.49 +      dump_active_values(first, expected_active);
    1.50 +
    1.51 +      // I leave this here as a guarantee, instead of an assert, so
    1.52 +      // that it will still be compiled in if we choose to uncomment
    1.53 +      // the #ifdef ASSERT in a product build. The whole block is
    1.54 +      // within an #ifdef ASSERT so the guarantee will not be compiled
    1.55 +      // in a product build anyway.
    1.56 +      guarantee(false,
    1.57 +                "thread has an unexpected active value in its SATB queue");
    1.58 +    }
    1.59 +#endif // ASSERT
    1.60      t->satb_mark_queue().set_active(b);
    1.61    }
    1.62  }

mercurial