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