comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 4725:3b2b58fb1425

7123165: G1: output during parallel verification can get messed up Summary: Serialize the worker threads that are generating output during parallel heap verification to make sure the output is consistent. Reviewed-by: brutisso, johnc, jmasa
author tonyp
date Tue, 20 Dec 2011 12:59:28 -0500
parents 53074c2c4600
children 2ace1c4ee8da
comparison
equal deleted inserted replaced
4712:e7dead7e90af 4725:3b2b58fb1425
92 #else // PRODUCT 92 #else // PRODUCT
93 obj->print_on(out); 93 obj->print_on(out);
94 #endif // PRODUCT 94 #endif // PRODUCT
95 } 95 }
96 96
97 template <class T> void do_oop_work(T* p) { 97 template <class T>
98 void do_oop_work(T* p) {
98 assert(_containing_obj != NULL, "Precondition"); 99 assert(_containing_obj != NULL, "Precondition");
99 assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo), 100 assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo),
100 "Precondition"); 101 "Precondition");
101 T heap_oop = oopDesc::load_heap_oop(p); 102 T heap_oop = oopDesc::load_heap_oop(p);
102 if (!oopDesc::is_null(heap_oop)) { 103 if (!oopDesc::is_null(heap_oop)) {
103 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 104 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
104 bool failed = false; 105 bool failed = false;
105 if (!_g1h->is_in_closed_subset(obj) || 106 if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
106 _g1h->is_obj_dead_cond(obj, _vo)) { 107 MutexLockerEx x(ParGCRareEvent_lock,
108 Mutex::_no_safepoint_check_flag);
109
107 if (!_failures) { 110 if (!_failures) {
108 gclog_or_tty->print_cr(""); 111 gclog_or_tty->print_cr("");
109 gclog_or_tty->print_cr("----------"); 112 gclog_or_tty->print_cr("----------");
110 } 113 }
111 if (!_g1h->is_in_closed_subset(obj)) { 114 if (!_g1h->is_in_closed_subset(obj)) {
131 "["PTR_FORMAT", "PTR_FORMAT")", 134 "["PTR_FORMAT", "PTR_FORMAT")",
132 (void*) obj, to->bottom(), to->end()); 135 (void*) obj, to->bottom(), to->end());
133 print_object(gclog_or_tty, obj); 136 print_object(gclog_or_tty, obj);
134 } 137 }
135 gclog_or_tty->print_cr("----------"); 138 gclog_or_tty->print_cr("----------");
139 gclog_or_tty->flush();
136 _failures = true; 140 _failures = true;
137 failed = true; 141 failed = true;
138 _n_failures++; 142 _n_failures++;
139 } 143 }
140 144
153 || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed 157 || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed
154 (_containing_obj->is_objArray() ? 158 (_containing_obj->is_objArray() ?
155 cv_field == dirty 159 cv_field == dirty
156 : cv_obj == dirty || cv_field == dirty)); 160 : cv_obj == dirty || cv_field == dirty));
157 if (is_bad) { 161 if (is_bad) {
162 MutexLockerEx x(ParGCRareEvent_lock,
163 Mutex::_no_safepoint_check_flag);
164
158 if (!_failures) { 165 if (!_failures) {
159 gclog_or_tty->print_cr(""); 166 gclog_or_tty->print_cr("");
160 gclog_or_tty->print_cr("----------"); 167 gclog_or_tty->print_cr("----------");
161 } 168 }
162 gclog_or_tty->print_cr("Missing rem set entry:"); 169 gclog_or_tty->print_cr("Missing rem set entry:");
172 HR_FORMAT_PARAMS(to)); 179 HR_FORMAT_PARAMS(to));
173 obj->print_on(gclog_or_tty); 180 obj->print_on(gclog_or_tty);
174 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", 181 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.",
175 cv_obj, cv_field); 182 cv_obj, cv_field);
176 gclog_or_tty->print_cr("----------"); 183 gclog_or_tty->print_cr("----------");
184 gclog_or_tty->flush();
177 _failures = true; 185 _failures = true;
178 if (!failed) _n_failures++; 186 if (!failed) _n_failures++;
179 } 187 }
180 } 188 }
181 } 189 }