comparison src/share/vm/utilities/taskqueue.hpp @ 1025:1ee412f7fec9

6866190: Remove SIMPLE_STACK code from TaskQueue Summary: What the title says. We don't use SIMPLE_STACK any more. Reviewed-by: ysr
author tonyp
date Wed, 07 Oct 2009 19:01:55 -0400
parents 2c03ce058f55
children 5f1f51edaff6
comparison
equal deleted inserted replaced
1024:2c03ce058f55 1025:1ee412f7fec9
463 static uint total_peeks() { return _total_peeks; } 463 static uint total_peeks() { return _total_peeks; }
464 static void print_termination_counts(); 464 static void print_termination_counts();
465 #endif 465 #endif
466 }; 466 };
467 467
468 #define SIMPLE_STACK 0
469
470 template<class E> inline bool GenericTaskQueue<E>::push(E t) { 468 template<class E> inline bool GenericTaskQueue<E>::push(E t) {
471 #if SIMPLE_STACK
472 uint localBot = _bottom;
473 if (_bottom < max_elems()) {
474 _elems[localBot] = t;
475 _bottom = localBot + 1;
476 return true;
477 } else {
478 return false;
479 }
480 #else
481 uint localBot = _bottom; 469 uint localBot = _bottom;
482 assert((localBot >= 0) && (localBot < N), "_bottom out of range."); 470 assert((localBot >= 0) && (localBot < N), "_bottom out of range.");
483 idx_t top = _age.top(); 471 idx_t top = _age.top();
484 uint dirty_n_elems = dirty_size(localBot, top); 472 uint dirty_n_elems = dirty_size(localBot, top);
485 assert((dirty_n_elems >= 0) && (dirty_n_elems < N), "n_elems out of range."); 473 assert((dirty_n_elems >= 0) && (dirty_n_elems < N), "n_elems out of range.");
488 OrderAccess::release_store(&_bottom, increment_index(localBot)); 476 OrderAccess::release_store(&_bottom, increment_index(localBot));
489 return true; 477 return true;
490 } else { 478 } else {
491 return push_slow(t, dirty_n_elems); 479 return push_slow(t, dirty_n_elems);
492 } 480 }
493 #endif
494 } 481 }
495 482
496 template<class E> inline bool GenericTaskQueue<E>::pop_local(E& t) { 483 template<class E> inline bool GenericTaskQueue<E>::pop_local(E& t) {
497 #if SIMPLE_STACK
498 uint localBot = _bottom;
499 assert(localBot > 0, "precondition.");
500 localBot--;
501 t = _elems[localBot];
502 _bottom = localBot;
503 return true;
504 #else
505 uint localBot = _bottom; 484 uint localBot = _bottom;
506 // This value cannot be N-1. That can only occur as a result of 485 // This value cannot be N-1. That can only occur as a result of
507 // the assignment to bottom in this method. If it does, this method 486 // the assignment to bottom in this method. If it does, this method
508 // resets the size( to 0 before the next call (which is sequential, 487 // resets the size( to 0 before the next call (which is sequential,
509 // since this is pop_local.) 488 // since this is pop_local.)
527 } else { 506 } else {
528 // Otherwise, the queue contained exactly one element; we take the slow 507 // Otherwise, the queue contained exactly one element; we take the slow
529 // path. 508 // path.
530 return pop_local_slow(localBot, _age.get()); 509 return pop_local_slow(localBot, _age.get());
531 } 510 }
532 #endif
533 } 511 }
534 512
535 typedef oop Task; 513 typedef oop Task;
536 typedef GenericTaskQueue<Task> OopTaskQueue; 514 typedef GenericTaskQueue<Task> OopTaskQueue;
537 typedef GenericTaskQueueSet<Task> OopTaskQueueSet; 515 typedef GenericTaskQueueSet<Task> OopTaskQueueSet;