comparison src/share/vm/gc_implementation/g1/satbQueue.cpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents e5d78f318aec
children 52b4284cb496
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
89 bool retain = g1h->is_obj_ill(obj); 89 bool retain = g1h->is_obj_ill(obj);
90 if (retain) { 90 if (retain) {
91 assert(new_index > 0, "we should not have already filled up the buffer"); 91 assert(new_index > 0, "we should not have already filled up the buffer");
92 new_index -= oopSize; 92 new_index -= oopSize;
93 assert(new_index >= i, 93 assert(new_index >= i,
94 "new_index should never be below i, as we always compact 'up'"); 94 "new_index should never be below i, as we alwaysr compact 'up'");
95 oop* new_p = (oop*) &buf[byte_index_to_index((int) new_index)]; 95 oop* new_p = (oop*) &buf[byte_index_to_index((int) new_index)];
96 assert(new_p >= p, "the destination location should never be below " 96 assert(new_p >= p, "the destination location should never be below "
97 "the source as we always compact 'up'"); 97 "the source as we always compact 'up'");
98 assert(*new_p == NULL, 98 assert(*new_p == NULL,
99 "we should have already cleared the destination location"); 99 "we should have already cleared the destination location");
217 DEBUG_ONLY(t->satb_mark_queue().verify_oops_in_buffer();) 217 DEBUG_ONLY(t->satb_mark_queue().verify_oops_in_buffer();)
218 t->satb_mark_queue().handle_zero_index(); 218 t->satb_mark_queue().handle_zero_index();
219 } 219 }
220 220
221 #ifdef ASSERT 221 #ifdef ASSERT
222 void SATBMarkQueueSet::dump_active_states(bool expected_active) { 222 void SATBMarkQueueSet::dump_active_values(JavaThread* first,
223 gclog_or_tty->print_cr("Expected SATB active state: %s", 223 bool expected_active) {
224 expected_active ? "ACTIVE" : "INACTIVE"); 224 gclog_or_tty->print_cr("SATB queue active values for Java Threads");
225 gclog_or_tty->print_cr("Actual SATB active states:"); 225 gclog_or_tty->print_cr(" SATB queue set: active is %s",
226 gclog_or_tty->print_cr(" Queue set: %s", is_active() ? "ACTIVE" : "INACTIVE"); 226 (is_active()) ? "TRUE" : "FALSE");
227 for (JavaThread* t = Threads::first(); t; t = t->next()) { 227 gclog_or_tty->print_cr(" expected_active is %s",
228 gclog_or_tty->print_cr(" Thread \"%s\" queue: %s", t->name(), 228 (expected_active) ? "TRUE" : "FALSE");
229 t->satb_mark_queue().is_active() ? "ACTIVE" : "INACTIVE"); 229 for (JavaThread* t = first; t; t = t->next()) {
230 } 230 bool active = t->satb_mark_queue().is_active();
231 gclog_or_tty->print_cr(" Shared queue: %s", 231 gclog_or_tty->print_cr(" thread %s, active is %s",
232 shared_satb_queue()->is_active() ? "ACTIVE" : "INACTIVE"); 232 t->name(), (active) ? "TRUE" : "FALSE");
233 }
234
235 void SATBMarkQueueSet::verify_active_states(bool expected_active) {
236 // Verify queue set state
237 if (is_active() != expected_active) {
238 dump_active_states(expected_active);
239 guarantee(false, "SATB queue set has an unexpected active state");
240 }
241
242 // Verify thread queue states
243 for (JavaThread* t = Threads::first(); t; t = t->next()) {
244 if (t->satb_mark_queue().is_active() != expected_active) {
245 dump_active_states(expected_active);
246 guarantee(false, "Thread SATB queue has an unexpected active state");
247 }
248 }
249
250 // Verify shared queue state
251 if (shared_satb_queue()->is_active() != expected_active) {
252 dump_active_states(expected_active);
253 guarantee(false, "Shared SATB queue has an unexpected active state");
254 } 233 }
255 } 234 }
256 #endif // ASSERT 235 #endif // ASSERT
257 236
258 void SATBMarkQueueSet::set_active_all_threads(bool active, bool expected_active) { 237 void SATBMarkQueueSet::set_active_all_threads(bool b,
238 bool expected_active) {
259 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); 239 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
240 JavaThread* first = Threads::first();
241
260 #ifdef ASSERT 242 #ifdef ASSERT
261 verify_active_states(expected_active); 243 if (_all_active != expected_active) {
244 dump_active_values(first, expected_active);
245
246 // I leave this here as a guarantee, instead of an assert, so
247 // that it will still be compiled in if we choose to uncomment
248 // the #ifdef ASSERT in a product build. The whole block is
249 // within an #ifdef ASSERT so the guarantee will not be compiled
250 // in a product build anyway.
251 guarantee(false,
252 "SATB queue set has an unexpected active value");
253 }
262 #endif // ASSERT 254 #endif // ASSERT
263 _all_active = active; 255 _all_active = b;
264 for (JavaThread* t = Threads::first(); t; t = t->next()) { 256
265 t->satb_mark_queue().set_active(active); 257 for (JavaThread* t = first; t; t = t->next()) {
266 } 258 #ifdef ASSERT
267 shared_satb_queue()->set_active(active); 259 bool active = t->satb_mark_queue().is_active();
260 if (active != expected_active) {
261 dump_active_values(first, expected_active);
262
263 // I leave this here as a guarantee, instead of an assert, so
264 // that it will still be compiled in if we choose to uncomment
265 // the #ifdef ASSERT in a product build. The whole block is
266 // within an #ifdef ASSERT so the guarantee will not be compiled
267 // in a product build anyway.
268 guarantee(false,
269 "thread has an unexpected active value in its SATB queue");
270 }
271 #endif // ASSERT
272 t->satb_mark_queue().set_active(b);
273 }
268 } 274 }
269 275
270 void SATBMarkQueueSet::filter_thread_buffers() { 276 void SATBMarkQueueSet::filter_thread_buffers() {
271 for(JavaThread* t = Threads::first(); t; t = t->next()) { 277 for(JavaThread* t = Threads::first(); t; t = t->next()) {
272 t->satb_mark_queue().filter(); 278 t->satb_mark_queue().filter();