taskqueue.hpp 19.0 KB
Newer Older
D
duke 已提交
1
/*
X
xdono 已提交
2
 * Copyright 2001-2009 Sun Microsystems, Inc.  All Rights Reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 *
 */

class TaskQueueSuper: public CHeapObj {
protected:
27 28 29 30
  // Internal type for indexing the queue; also used for the tag.
  typedef NOT_LP64(uint16_t) LP64_ONLY(uint32_t) idx_t;

  // The first free element after the last one pushed (mod N).
31
  volatile uint _bottom;
D
duke 已提交
32

33 34 35
  enum {
    N = 1 << NOT_LP64(14) LP64_ONLY(17), // Queue size: 16K or 128K
    MOD_N_MASK = N - 1                   // To compute x mod N efficiently.
D
duke 已提交
36 37
  };

38 39 40 41 42
  class Age {
  public:
    Age(size_t data = 0)         { _data = data; }
    Age(const Age& age)          { _data = age._data; }
    Age(idx_t top, idx_t tag)    { _fields._top = top; _fields._tag = tag; }
D
duke 已提交
43

44 45
    Age   get()        const volatile { return _data; }
    void  set(Age age) volatile       { _data = age._data; }
D
duke 已提交
46

47 48
    idx_t top()        const volatile { return _fields._top; }
    idx_t tag()        const volatile { return _fields._tag; }
D
duke 已提交
49

50 51 52 53 54
    // Increment top; if it wraps, increment tag also.
    void increment() {
      _fields._top = increment_index(_fields._top);
      if (_fields._top == 0) ++_fields._tag;
    }
D
duke 已提交
55

56 57 58 59
    Age cmpxchg(const Age new_age, const Age old_age) volatile {
      return (size_t) Atomic::cmpxchg_ptr((intptr_t)new_age._data,
                                          (volatile intptr_t *)&_data,
                                          (intptr_t)old_age._data);
D
duke 已提交
60
    }
61 62 63 64 65 66 67 68 69 70 71 72

    bool operator ==(const Age& other) const { return _data == other._data; }

  private:
    struct fields {
      idx_t _top;
      idx_t _tag;
    };
    union {
      size_t _data;
      fields _fields;
    };
D
duke 已提交
73 74
  };

75
  volatile Age _age;
D
duke 已提交
76

77 78 79
  // These both operate mod N.
  static uint increment_index(uint ind) {
    return (ind + 1) & MOD_N_MASK;
D
duke 已提交
80
  }
81 82
  static uint decrement_index(uint ind) {
    return (ind - 1) & MOD_N_MASK;
D
duke 已提交
83 84
  }

85 86
  // Returns a number in the range [0..N).  If the result is "N-1", it should be
  // interpreted as 0.
87
  uint dirty_size(uint bot, uint top) {
88
    return (bot - top) & MOD_N_MASK;
D
duke 已提交
89 90 91
  }

  // Returns the size corresponding to the given "bot" and "top".
92 93
  uint size(uint bot, uint top) {
    uint sz = dirty_size(bot, top);
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
    // Has the queue "wrapped", so that bottom is less than top?  There's a
    // complicated special case here.  A pair of threads could perform pop_local
    // and pop_global operations concurrently, starting from a state in which
    // _bottom == _top+1.  The pop_local could succeed in decrementing _bottom,
    // and the pop_global in incrementing _top (in which case the pop_global
    // will be awarded the contested queue element.)  The resulting state must
    // be interpreted as an empty queue.  (We only need to worry about one such
    // event: only the queue owner performs pop_local's, and several concurrent
    // threads attempting to perform the pop_global will all perform the same
    // CAS, and only one can succeed.)  Any stealing thread that reads after
    // either the increment or decrement will see an empty queue, and will not
    // join the competitors.  The "sz == -1 || sz == N-1" state will not be
    // modified by concurrent queues, so the owner thread can reset the state to
    // _bottom == top so subsequent pushes will be performed normally.
    return (sz == N - 1) ? 0 : sz;
D
duke 已提交
109 110 111 112 113 114 115 116 117 118 119
  }

public:
  TaskQueueSuper() : _bottom(0), _age() {}

  // Return "true" if the TaskQueue contains any tasks.
  bool peek();

  // Return an estimate of the number of elements in the queue.
  // The "careful" version admits the possibility of pop_local/pop_global
  // races.
120
  uint size() {
121
    return size(_bottom, _age.top());
D
duke 已提交
122 123
  }

124
  uint dirty_size() {
125
    return dirty_size(_bottom, _age.top());
D
duke 已提交
126 127
  }

128 129
  void set_empty() {
    _bottom = 0;
130
    _age.set(0);
131 132
  }

D
duke 已提交
133 134
  // Maximum number of elements allowed in the queue.  This is two less
  // than the actual queue size, for somewhat complicated reasons.
135
  uint max_elems() { return N - 2; }
D
duke 已提交
136 137 138 139 140
};

template<class E> class GenericTaskQueue: public TaskQueueSuper {
private:
  // Slow paths for push, pop_local.  (pop_global has no fast path.)
141 142
  bool push_slow(E t, uint dirty_n_elems);
  bool pop_local_slow(uint localBot, Age oldAge);
D
duke 已提交
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166

public:
  // Initializes the queue to empty.
  GenericTaskQueue();

  void initialize();

  // Push the task "t" on the queue.  Returns "false" iff the queue is
  // full.
  inline bool push(E t);

  // If succeeds in claiming a task (from the 'local' end, that is, the
  // most recently pushed task), returns "true" and sets "t" to that task.
  // Otherwise, the queue is empty and returns false.
  inline bool pop_local(E& t);

  // If succeeds in claiming a task (from the 'global' end, that is, the
  // least recently pushed task), returns "true" and sets "t" to that task.
  // Otherwise, the queue is empty and returns false.
  bool pop_global(E& t);

  // Delete any resource associated with the queue.
  ~GenericTaskQueue();

167 168 169
  // apply the closure to all elements in the task queue
  void oops_do(OopClosure* f);

D
duke 已提交
170 171 172 173 174 175 176
private:
  // Element array.
  volatile E* _elems;
};

template<class E>
GenericTaskQueue<E>::GenericTaskQueue():TaskQueueSuper() {
177
  assert(sizeof(Age) == sizeof(size_t), "Depends on this.");
D
duke 已提交
178 179 180 181
}

template<class E>
void GenericTaskQueue<E>::initialize() {
182
  _elems = NEW_C_HEAP_ARRAY(E, N);
D
duke 已提交
183 184 185
  guarantee(_elems != NULL, "Allocation failed.");
}

186 187 188
template<class E>
void GenericTaskQueue<E>::oops_do(OopClosure* f) {
  // tty->print_cr("START OopTaskQueue::oops_do");
189 190 191
  uint iters = size();
  uint index = _bottom;
  for (uint i = 0; i < iters; ++i) {
192 193 194 195 196 197 198 199 200 201 202 203
    index = decrement_index(index);
    // tty->print_cr("  doing entry %d," INTPTR_T " -> " INTPTR_T,
    //            index, &_elems[index], _elems[index]);
    E* t = (E*)&_elems[index];      // cast away volatility
    oop* p = (oop*)t;
    assert((*t)->is_oop_or_null(), "Not an oop or null");
    f->do_oop(p);
  }
  // tty->print_cr("END OopTaskQueue::oops_do");
}


D
duke 已提交
204
template<class E>
205
bool GenericTaskQueue<E>::push_slow(E t, uint dirty_n_elems) {
206
  if (dirty_n_elems == N - 1) {
D
duke 已提交
207
    // Actually means 0, so do the push.
208
    uint localBot = _bottom;
D
duke 已提交
209 210 211
    _elems[localBot] = t;
    _bottom = increment_index(localBot);
    return true;
212 213
  }
  return false;
D
duke 已提交
214 215 216 217
}

template<class E>
bool GenericTaskQueue<E>::
218
pop_local_slow(uint localBot, Age oldAge) {
D
duke 已提交
219 220 221 222 223 224 225 226 227
  // This queue was observed to contain exactly one element; either this
  // thread will claim it, or a competing "pop_global".  In either case,
  // the queue will be logically empty afterwards.  Create a new Age value
  // that represents the empty queue for the given value of "_bottom".  (We
  // must also increment "tag" because of the case where "bottom == 1",
  // "top == 0".  A pop_global could read the queue element in that case,
  // then have the owner thread do a pop followed by another push.  Without
  // the incrementing of "tag", the pop_global's CAS could succeed,
  // allowing it to believe it has claimed the stale element.)
228
  Age newAge((idx_t)localBot, oldAge.tag() + 1);
D
duke 已提交
229 230 231 232 233
  // Perhaps a competing pop_global has already incremented "top", in which
  // case it wins the element.
  if (localBot == oldAge.top()) {
    // No competing pop_global has yet incremented "top"; we'll try to
    // install new_age, thus claiming the element.
234
    Age tempAge = _age.cmpxchg(newAge, oldAge);
D
duke 已提交
235 236
    if (tempAge == oldAge) {
      // We win.
237
      assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
D
duke 已提交
238 239 240
      return true;
    }
  }
241 242 243 244 245
  // We lose; a completing pop_global gets the element.  But the queue is empty
  // and top is greater than bottom.  Fix this representation of the empty queue
  // to become the canonical one.
  _age.set(newAge);
  assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
D
duke 已提交
246 247 248 249 250
  return false;
}

template<class E>
bool GenericTaskQueue<E>::pop_global(E& t) {
251
  Age oldAge = _age.get();
252 253
  uint localBot = _bottom;
  uint n_elems = size(localBot, oldAge.top());
D
duke 已提交
254 255 256
  if (n_elems == 0) {
    return false;
  }
257

D
duke 已提交
258
  t = _elems[oldAge.top()];
259 260 261 262
  Age newAge(oldAge);
  newAge.increment();
  Age resAge = _age.cmpxchg(newAge, oldAge);

D
duke 已提交
263 264
  // Note that using "_bottom" here might fail, since a pop_local might
  // have decremented it.
265 266
  assert(dirty_size(localBot, newAge.top()) != N - 1, "sanity");
  return resAge == oldAge;
D
duke 已提交
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
}

template<class E>
GenericTaskQueue<E>::~GenericTaskQueue() {
  FREE_C_HEAP_ARRAY(E, _elems);
}

// Inherits the typedef of "Task" from above.
class TaskQueueSetSuper: public CHeapObj {
protected:
  static int randomParkAndMiller(int* seed0);
public:
  // Returns "true" if some TaskQueue in the set contains a task.
  virtual bool peek() = 0;
};

template<class E> class GenericTaskQueueSet: public TaskQueueSetSuper {
private:
285
  uint _n;
D
duke 已提交
286 287 288 289 290 291 292 293 294 295 296 297
  GenericTaskQueue<E>** _queues;

public:
  GenericTaskQueueSet(int n) : _n(n) {
    typedef GenericTaskQueue<E>* GenericTaskQueuePtr;
    _queues = NEW_C_HEAP_ARRAY(GenericTaskQueuePtr, n);
    guarantee(_queues != NULL, "Allocation failure.");
    for (int i = 0; i < n; i++) {
      _queues[i] = NULL;
    }
  }

298 299 300
  bool steal_1_random(uint queue_num, int* seed, E& t);
  bool steal_best_of_2(uint queue_num, int* seed, E& t);
  bool steal_best_of_all(uint queue_num, int* seed, E& t);
D
duke 已提交
301

302
  void register_queue(uint i, GenericTaskQueue<E>* q);
D
duke 已提交
303

304
  GenericTaskQueue<E>* queue(uint n);
D
duke 已提交
305 306 307 308 309 310

  // The thread with queue number "queue_num" (and whose random number seed
  // is at "seed") is trying to steal a task from some other queue.  (It
  // may try several queues, according to some configuration parameter.)
  // If some steal succeeds, returns "true" and sets "t" the stolen task,
  // otherwise returns false.
311
  bool steal(uint queue_num, int* seed, E& t);
D
duke 已提交
312 313 314 315 316

  bool peek();
};

template<class E>
317 318
void GenericTaskQueueSet<E>::register_queue(uint i, GenericTaskQueue<E>* q) {
  assert(i < _n, "index out of range.");
D
duke 已提交
319 320 321 322
  _queues[i] = q;
}

template<class E>
323
GenericTaskQueue<E>* GenericTaskQueueSet<E>::queue(uint i) {
D
duke 已提交
324 325 326 327
  return _queues[i];
}

template<class E>
328 329
bool GenericTaskQueueSet<E>::steal(uint queue_num, int* seed, E& t) {
  for (uint i = 0; i < 2 * _n; i++)
D
duke 已提交
330 331 332 333 334 335
    if (steal_best_of_2(queue_num, seed, t))
      return true;
  return false;
}

template<class E>
336
bool GenericTaskQueueSet<E>::steal_best_of_all(uint queue_num, int* seed, E& t) {
D
duke 已提交
337 338
  if (_n > 2) {
    int best_k;
339 340
    uint best_sz = 0;
    for (uint k = 0; k < _n; k++) {
D
duke 已提交
341
      if (k == queue_num) continue;
342
      uint sz = _queues[k]->size();
D
duke 已提交
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
      if (sz > best_sz) {
        best_sz = sz;
        best_k = k;
      }
    }
    return best_sz > 0 && _queues[best_k]->pop_global(t);
  } else if (_n == 2) {
    // Just try the other one.
    int k = (queue_num + 1) % 2;
    return _queues[k]->pop_global(t);
  } else {
    assert(_n == 1, "can't be zero.");
    return false;
  }
}

template<class E>
360
bool GenericTaskQueueSet<E>::steal_1_random(uint queue_num, int* seed, E& t) {
D
duke 已提交
361
  if (_n > 2) {
362
    uint k = queue_num;
D
duke 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375
    while (k == queue_num) k = randomParkAndMiller(seed) % _n;
    return _queues[2]->pop_global(t);
  } else if (_n == 2) {
    // Just try the other one.
    int k = (queue_num + 1) % 2;
    return _queues[k]->pop_global(t);
  } else {
    assert(_n == 1, "can't be zero.");
    return false;
  }
}

template<class E>
376
bool GenericTaskQueueSet<E>::steal_best_of_2(uint queue_num, int* seed, E& t) {
D
duke 已提交
377
  if (_n > 2) {
378
    uint k1 = queue_num;
D
duke 已提交
379
    while (k1 == queue_num) k1 = randomParkAndMiller(seed) % _n;
380
    uint k2 = queue_num;
D
duke 已提交
381 382
    while (k2 == queue_num || k2 == k1) k2 = randomParkAndMiller(seed) % _n;
    // Sample both and try the larger.
383 384
    uint sz1 = _queues[k1]->size();
    uint sz2 = _queues[k2]->size();
D
duke 已提交
385 386 387 388
    if (sz2 > sz1) return _queues[k2]->pop_global(t);
    else return _queues[k1]->pop_global(t);
  } else if (_n == 2) {
    // Just try the other one.
389
    uint k = (queue_num + 1) % 2;
D
duke 已提交
390 391 392 393 394 395 396 397 398 399
    return _queues[k]->pop_global(t);
  } else {
    assert(_n == 1, "can't be zero.");
    return false;
  }
}

template<class E>
bool GenericTaskQueueSet<E>::peek() {
  // Try all the queues.
400
  for (uint j = 0; j < _n; j++) {
D
duke 已提交
401 402 403 404 405 406
    if (_queues[j]->peek())
      return true;
  }
  return false;
}

407 408 409 410 411 412
// When to terminate from the termination protocol.
class TerminatorTerminator: public CHeapObj {
public:
  virtual bool should_exit_termination() = 0;
};

D
duke 已提交
413 414 415
// A class to aid in the termination of a set of parallel tasks using
// TaskQueueSet's for work stealing.

416 417
#undef TRACESPINNING

D
duke 已提交
418 419 420 421
class ParallelTaskTerminator: public StackObj {
private:
  int _n_threads;
  TaskQueueSetSuper* _queue_set;
422
  int _offered_termination;
D
duke 已提交
423

424 425 426 427 428 429
#ifdef TRACESPINNING
  static uint _total_yields;
  static uint _total_spins;
  static uint _total_peeks;
#endif

D
duke 已提交
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
  bool peek_in_queue_set();
protected:
  virtual void yield();
  void sleep(uint millis);

public:

  // "n_threads" is the number of threads to be terminated.  "queue_set" is a
  // queue sets of work queues of other threads.
  ParallelTaskTerminator(int n_threads, TaskQueueSetSuper* queue_set);

  // The current thread has no work, and is ready to terminate if everyone
  // else is.  If returns "true", all threads are terminated.  If returns
  // "false", available work has been observed in one of the task queues,
  // so the global task is not complete.
445 446 447 448
  bool offer_termination() {
    return offer_termination(NULL);
  }

449
  // As above, but it also terminates if the should_exit_termination()
450 451 452
  // method of the terminator parameter returns true. If terminator is
  // NULL, then it is ignored.
  bool offer_termination(TerminatorTerminator* terminator);
D
duke 已提交
453 454 455 456 457 458 459

  // Reset the terminator, so that it may be reused again.
  // The caller is responsible for ensuring that this is done
  // in an MT-safe manner, once the previous round of use of
  // the terminator is finished.
  void reset_for_reuse();

460 461 462 463 464 465
#ifdef TRACESPINNING
  static uint total_yields() { return _total_yields; }
  static uint total_spins() { return _total_spins; }
  static uint total_peeks() { return _total_peeks; }
  static void print_termination_counts();
#endif
D
duke 已提交
466 467 468 469 470 471
};

#define SIMPLE_STACK 0

template<class E> inline bool GenericTaskQueue<E>::push(E t) {
#if SIMPLE_STACK
472
  uint localBot = _bottom;
D
duke 已提交
473 474 475 476 477 478 479 480
  if (_bottom < max_elems()) {
    _elems[localBot] = t;
    _bottom = localBot + 1;
    return true;
  } else {
    return false;
  }
#else
481
  uint localBot = _bottom;
482 483
  assert((localBot >= 0) && (localBot < N), "_bottom out of range.");
  idx_t top = _age.top();
484
  uint dirty_n_elems = dirty_size(localBot, top);
485
  assert((dirty_n_elems >= 0) && (dirty_n_elems < N), "n_elems out of range.");
D
duke 已提交
486 487 488 489 490 491 492 493 494 495 496 497
  if (dirty_n_elems < max_elems()) {
    _elems[localBot] = t;
    _bottom = increment_index(localBot);
    return true;
  } else {
    return push_slow(t, dirty_n_elems);
  }
#endif
}

template<class E> inline bool GenericTaskQueue<E>::pop_local(E& t) {
#if SIMPLE_STACK
498
  uint localBot = _bottom;
D
duke 已提交
499 500 501 502 503 504
  assert(localBot > 0, "precondition.");
  localBot--;
  t = _elems[localBot];
  _bottom = localBot;
  return true;
#else
505
  uint localBot = _bottom;
506
  // This value cannot be N-1.  That can only occur as a result of
D
duke 已提交
507 508 509
  // the assignment to bottom in this method.  If it does, this method
  // resets the size( to 0 before the next call (which is sequential,
  // since this is pop_local.)
510 511
  uint dirty_n_elems = dirty_size(localBot, _age.top());
  assert(dirty_n_elems != N - 1, "Shouldn't be possible...");
D
duke 已提交
512 513 514 515 516 517 518 519 520 521 522
  if (dirty_n_elems == 0) return false;
  localBot = decrement_index(localBot);
  _bottom = localBot;
  // This is necessary to prevent any read below from being reordered
  // before the store just above.
  OrderAccess::fence();
  t = _elems[localBot];
  // This is a second read of "age"; the "size()" above is the first.
  // If there's still at least one element in the queue, based on the
  // "_bottom" and "age" we've read, then there can be no interference with
  // a "pop_global" operation, and we're done.
523
  idx_t tp = _age.top();    // XXX
D
duke 已提交
524
  if (size(localBot, tp) > 0) {
525
    assert(dirty_size(localBot, tp) != N - 1, "sanity");
D
duke 已提交
526 527 528 529
    return true;
  } else {
    // Otherwise, the queue contained exactly one element; we take the slow
    // path.
530
    return pop_local_slow(localBot, _age.get());
D
duke 已提交
531 532 533 534 535 536 537 538
  }
#endif
}

typedef oop Task;
typedef GenericTaskQueue<Task>         OopTaskQueue;
typedef GenericTaskQueueSet<Task>      OopTaskQueueSet;

539 540 541 542 543 544 545 546 547

#define COMPRESSED_OOP_MASK  1

// This is a container class for either an oop* or a narrowOop*.
// Both are pushed onto a task queue and the consumer will test is_narrow()
// to determine which should be processed.
class StarTask {
  void*  _holder;        // either union oop* or narrowOop*
 public:
548 549 550 551 552 553 554 555
  StarTask(narrowOop* p) {
    assert(((uintptr_t)p & COMPRESSED_OOP_MASK) == 0, "Information loss!");
    _holder = (void *)((uintptr_t)p | COMPRESSED_OOP_MASK);
  }
  StarTask(oop* p)       {
    assert(((uintptr_t)p & COMPRESSED_OOP_MASK) == 0, "Information loss!");
    _holder = (void*)p;
  }
556 557 558 559 560 561 562 563 564 565 566 567 568 569
  StarTask()             { _holder = NULL; }
  operator oop*()        { return (oop*)_holder; }
  operator narrowOop*()  {
    return (narrowOop*)((uintptr_t)_holder & ~COMPRESSED_OOP_MASK);
  }

  // Operators to preserve const/volatile in assignments required by gcc
  void operator=(const volatile StarTask& t) volatile { _holder = t._holder; }

  bool is_narrow() const {
    return (((uintptr_t)_holder & COMPRESSED_OOP_MASK) != 0);
  }
};

D
duke 已提交
570 571 572
typedef GenericTaskQueue<StarTask>     OopStarTaskQueue;
typedef GenericTaskQueueSet<StarTask>  OopStarTaskQueueSet;

573 574 575
typedef size_t RegionTask;  // index for region
typedef GenericTaskQueue<RegionTask>    RegionTaskQueue;
typedef GenericTaskQueueSet<RegionTask> RegionTaskQueueSet;
D
duke 已提交
576

577
class RegionTaskQueueWithOverflow: public CHeapObj {
D
duke 已提交
578
 protected:
579 580
  RegionTaskQueue              _region_queue;
  GrowableArray<RegionTask>*   _overflow_stack;
D
duke 已提交
581 582

 public:
583
  RegionTaskQueueWithOverflow() : _overflow_stack(NULL) {}
D
duke 已提交
584 585 586
  // Initialize both stealable queue and overflow
  void initialize();
  // Save first to stealable queue and then to overflow
587
  void save(RegionTask t);
D
duke 已提交
588
  // Retrieve first from overflow and then from stealable queue
589
  bool retrieve(RegionTask& region_index);
D
duke 已提交
590
  // Retrieve from stealable queue
591
  bool retrieve_from_stealable_queue(RegionTask& region_index);
D
duke 已提交
592
  // Retrieve from overflow
593
  bool retrieve_from_overflow(RegionTask& region_index);
D
duke 已提交
594 595 596
  bool is_empty();
  bool stealable_is_empty();
  bool overflow_is_empty();
597
  uint stealable_size() { return _region_queue.size(); }
598
  RegionTaskQueue* task_queue() { return &_region_queue; }
D
duke 已提交
599 600
};

601
#define USE_RegionTaskQueueWithOverflow