Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 1317:d4197f8d516a
6935821: G1: threads created during marking do not active their SATB queues
Summary: Newly-created threads always had the active field of their SATB queue initialized to false, even if they were created during marking. As a result, updates from threads created during a marking cycle were never enqueued and never processed. The fix includes remaining a method from active() to is_active() for readability and naming consistency.
Reviewed-by: ysr, johnc
author | tonyp |
---|---|
date | Thu, 18 Mar 2010 12:14:59 -0400 |
parents | 3f0549ed0c98 |
children | 72f725c5a7be |
comparison
equal
deleted
inserted
replaced
1316:cc98cc548f51 | 1317:d4197f8d516a |
---|---|
758 rp->verify_no_references_recorded(); | 758 rp->verify_no_references_recorded(); |
759 rp->enable_discovery(); // enable ("weak") refs discovery | 759 rp->enable_discovery(); // enable ("weak") refs discovery |
760 rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle | 760 rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle |
761 | 761 |
762 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); | 762 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); |
763 satb_mq_set.set_active_all_threads(true); | 763 // This is the start of the marking cycle, we're expected all |
764 // threads to have SATB queues with active set to false. | |
765 satb_mq_set.set_active_all_threads(true, /* new active value */ | |
766 false /* expected_active */); | |
764 | 767 |
765 // update_g1_committed() will be called at the end of an evac pause | 768 // update_g1_committed() will be called at the end of an evac pause |
766 // when marking is on. So, it's also called at the end of the | 769 // when marking is on. So, it's also called at the end of the |
767 // initial-mark pause to update the heap end, if the heap expands | 770 // initial-mark pause to update the heap end, if the heap expands |
768 // during it. No need to call it here. | 771 // during it. No need to call it here. |
1077 clear_has_overflown(); | 1080 clear_has_overflown(); |
1078 if (G1TraceMarkStackOverflow) | 1081 if (G1TraceMarkStackOverflow) |
1079 gclog_or_tty->print_cr("\nRemark led to restart for overflow."); | 1082 gclog_or_tty->print_cr("\nRemark led to restart for overflow."); |
1080 } else { | 1083 } else { |
1081 // We're done with marking. | 1084 // We're done with marking. |
1082 JavaThread::satb_mark_queue_set().set_active_all_threads(false); | 1085 // This is the end of the marking cycle, we're expected all |
1086 // threads to have SATB queues with active set to true. | |
1087 JavaThread::satb_mark_queue_set().set_active_all_threads( | |
1088 false, /* new active value */ | |
1089 true /* expected_active */); | |
1083 | 1090 |
1084 if (VerifyDuringGC) { | 1091 if (VerifyDuringGC) { |
1085 HandleMark hm; // handle scope | 1092 HandleMark hm; // handle scope |
1086 gclog_or_tty->print(" VerifyDuringGC:(after)"); | 1093 gclog_or_tty->print(" VerifyDuringGC:(after)"); |
1087 Universe::heap()->prepare_for_verify(); | 1094 Universe::heap()->prepare_for_verify(); |
2584 _tasks[i]->clear_region_fields(); | 2591 _tasks[i]->clear_region_fields(); |
2585 _has_aborted = true; | 2592 _has_aborted = true; |
2586 | 2593 |
2587 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); | 2594 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); |
2588 satb_mq_set.abandon_partial_marking(); | 2595 satb_mq_set.abandon_partial_marking(); |
2589 satb_mq_set.set_active_all_threads(false); | 2596 // This can be called either during or outside marking, we'll read |
2597 // the expected_active value from the SATB queue set. | |
2598 satb_mq_set.set_active_all_threads( | |
2599 false, /* new active value */ | |
2600 satb_mq_set.is_active() /* expected_active */); | |
2590 } | 2601 } |
2591 | 2602 |
2592 static void print_ms_time_info(const char* prefix, const char* name, | 2603 static void print_ms_time_info(const char* prefix, const char* name, |
2593 NumberSeq& ns) { | 2604 NumberSeq& ns) { |
2594 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", | 2605 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", |