2327 // We only call this when the local queue is empty or under a
2328 // given target limit. So, we do not expect this push to fail.
2329 assert(success, "invariant");
2330 }
2331
2332 // This operation was quite expensive, so decrease the limits
2333 decrease_limits();
2334 return true;
2335 }
2336
2337 void G1CMTask::drain_local_queue(bool partially) {
2338 if (has_aborted()) {
2339 return;
2340 }
2341
2342 // Decide what the target size is, depending whether we're going to
2343 // drain it partially (so that other tasks can steal if they run out
2344 // of things to do) or totally (at the very end).
2345 size_t target_size;
2346 if (partially) {
2347 target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
2348 } else {
2349 target_size = 0;
2350 }
2351
2352 if (_task_queue->size() > target_size) {
2353 G1TaskQueueEntry entry;
2354 bool ret = _task_queue->pop_local(entry);
2355 while (ret) {
2356 scan_task_entry(entry);
2357 if (_task_queue->size() <= target_size || has_aborted()) {
2358 ret = false;
2359 } else {
2360 ret = _task_queue->pop_local(entry);
2361 }
2362 }
2363 }
2364 }
2365
2366 void G1CMTask::drain_global_stack(bool partially) {
2367 if (has_aborted()) {
|
2327 // We only call this when the local queue is empty or under a
2328 // given target limit. So, we do not expect this push to fail.
2329 assert(success, "invariant");
2330 }
2331
2332 // This operation was quite expensive, so decrease the limits
2333 decrease_limits();
2334 return true;
2335 }
2336
2337 void G1CMTask::drain_local_queue(bool partially) {
2338 if (has_aborted()) {
2339 return;
2340 }
2341
2342 // Decide what the target size is, depending whether we're going to
2343 // drain it partially (so that other tasks can steal if they run out
2344 // of things to do) or totally (at the very end).
2345 size_t target_size;
2346 if (partially) {
2347 target_size = MIN2((size_t)_task_queue->max_elems()/3, (size_t)GCDrainStackTargetSize);
2348 } else {
2349 target_size = 0;
2350 }
2351
2352 if (_task_queue->size() > target_size) {
2353 G1TaskQueueEntry entry;
2354 bool ret = _task_queue->pop_local(entry);
2355 while (ret) {
2356 scan_task_entry(entry);
2357 if (_task_queue->size() <= target_size || has_aborted()) {
2358 ret = false;
2359 } else {
2360 ret = _task_queue->pop_local(entry);
2361 }
2362 }
2363 }
2364 }
2365
2366 void G1CMTask::drain_global_stack(bool partially) {
2367 if (has_aborted()) {
|