< prev index next >

src/hotspot/share/gc/cms/parNewGeneration.cpp

Print this page

        

*** 1294,1304 **** from_space_obj->set_klass_to_list_ptr(cur_overflow_list); } else { from_space_obj->set_klass_to_list_ptr(NULL); } observed_overflow_list = ! (oop)Atomic::cmpxchg_ptr(from_space_obj, &_overflow_list, cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); } } bool ParNewGeneration::take_from_overflow_list(ParScanThreadState* par_scan_state) { --- 1294,1304 ---- from_space_obj->set_klass_to_list_ptr(cur_overflow_list); } else { from_space_obj->set_klass_to_list_ptr(NULL); } observed_overflow_list = ! Atomic::cmpxchg((oopDesc*)from_space_obj, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); } } bool ParNewGeneration::take_from_overflow_list(ParScanThreadState* par_scan_state) {
*** 1337,1347 **** assert(!UseCompressedOops, "Error"); assert(par_scan_state->overflow_stack() == NULL, "Error"); if (_overflow_list == NULL) return false; // Otherwise, there was something there; try claiming the list. ! oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); // Trim off a prefix of at most objsFromOverflow items Thread* tid = Thread::current(); size_t spin_count = ParallelGCThreads; size_t sleep_time_millis = MAX2((size_t)1, objsFromOverflow/100); for (size_t spin = 0; prefix == BUSY && spin < spin_count; spin++) { --- 1337,1347 ---- assert(!UseCompressedOops, "Error"); assert(par_scan_state->overflow_stack() == NULL, "Error"); if (_overflow_list == NULL) return false; // Otherwise, there was something there; try claiming the list. ! oop prefix = cast_to_oop(Atomic::xchg((oopDesc*)BUSY, &_overflow_list)); // Trim off a prefix of at most objsFromOverflow items Thread* tid = Thread::current(); size_t spin_count = ParallelGCThreads; size_t sleep_time_millis = MAX2((size_t)1, objsFromOverflow/100); for (size_t spin = 0; prefix == BUSY && spin < spin_count; spin++) {
*** 1351,1369 **** if (_overflow_list == NULL) { // nothing left to take return false; } else if (_overflow_list != BUSY) { // try and grab the prefix ! prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); } } if (prefix == NULL || prefix == BUSY) { // Nothing to take or waited long enough if (prefix == NULL) { // Write back the NULL in case we overwrote it with BUSY above // and it is still the same value. ! (void) Atomic::cmpxchg_ptr(NULL, &_overflow_list, BUSY); } return false; } assert(prefix != NULL && prefix != BUSY, "Error"); oop cur = prefix; --- 1351,1369 ---- if (_overflow_list == NULL) { // nothing left to take return false; } else if (_overflow_list != BUSY) { // try and grab the prefix ! prefix = cast_to_oop(Atomic::xchg((oopDesc*)BUSY, &_overflow_list)); } } if (prefix == NULL || prefix == BUSY) { // Nothing to take or waited long enough if (prefix == NULL) { // Write back the NULL in case we overwrote it with BUSY above // and it is still the same value. ! (void) Atomic::cmpxchg((oopDesc*)NULL, &_overflow_list, (oopDesc*)BUSY); } return false; } assert(prefix != NULL && prefix != BUSY, "Error"); oop cur = prefix;
*** 1378,1388 **** oop suffix = cur->list_ptr_from_klass(); if (suffix == NULL) { // Write back the NULL in lieu of the BUSY we wrote // above and it is still the same value. if (_overflow_list == BUSY) { ! (void) Atomic::cmpxchg_ptr(NULL, &_overflow_list, BUSY); } } else { assert(suffix != BUSY, "Error"); // suffix will be put back on global list cur->set_klass_to_list_ptr(NULL); // break off suffix --- 1378,1388 ---- oop suffix = cur->list_ptr_from_klass(); if (suffix == NULL) { // Write back the NULL in lieu of the BUSY we wrote // above and it is still the same value. if (_overflow_list == BUSY) { ! (void) Atomic::cmpxchg((oopDesc*)NULL, &_overflow_list, (oopDesc*)BUSY); } } else { assert(suffix != BUSY, "Error"); // suffix will be put back on global list cur->set_klass_to_list_ptr(NULL); // break off suffix
*** 1392,1402 **** oop observed_overflow_list = _overflow_list; oop cur_overflow_list = observed_overflow_list; bool attached = false; while (observed_overflow_list == BUSY || observed_overflow_list == NULL) { observed_overflow_list = ! (oop) Atomic::cmpxchg_ptr(suffix, &_overflow_list, cur_overflow_list); if (cur_overflow_list == observed_overflow_list) { attached = true; break; } else cur_overflow_list = observed_overflow_list; } --- 1392,1402 ---- oop observed_overflow_list = _overflow_list; oop cur_overflow_list = observed_overflow_list; bool attached = false; while (observed_overflow_list == BUSY || observed_overflow_list == NULL) { observed_overflow_list = ! Atomic::cmpxchg((oopDesc*)suffix, &_overflow_list, (oopDesc*)cur_overflow_list); if (cur_overflow_list == observed_overflow_list) { attached = true; break; } else cur_overflow_list = observed_overflow_list; }
*** 1418,1428 **** last->set_klass_to_list_ptr(cur_overflow_list); } else { // cur_overflow_list == BUSY last->set_klass_to_list_ptr(NULL); } observed_overflow_list = ! (oop)Atomic::cmpxchg_ptr(suffix, &_overflow_list, cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); } } // Push objects on prefix list onto this thread's work queue --- 1418,1428 ---- last->set_klass_to_list_ptr(cur_overflow_list); } else { // cur_overflow_list == BUSY last->set_klass_to_list_ptr(NULL); } observed_overflow_list = ! Atomic::cmpxchg((oopDesc*)suffix, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); } } // Push objects on prefix list onto this thread's work queue
*** 1450,1460 **** n++; } TASKQUEUE_STATS_ONLY(par_scan_state->note_overflow_refill(n)); #ifndef PRODUCT assert(_num_par_pushes >= n, "Too many pops?"); ! Atomic::add_ptr(-(intptr_t)n, &_num_par_pushes); #endif return true; } #undef BUSY --- 1450,1460 ---- n++; } TASKQUEUE_STATS_ONLY(par_scan_state->note_overflow_refill(n)); #ifndef PRODUCT assert(_num_par_pushes >= n, "Too many pops?"); ! Atomic::sub(n, &_num_par_pushes); #endif return true; } #undef BUSY
< prev index next >