comparison src/share/vm/utilities/taskqueue.hpp @ 14422:2b8e28fdf503

Merge
author kvn
date Tue, 05 Nov 2013 17:38:04 -0800
parents e2722a66aba7 190899198332
children 4ca6dc0799b6 ce8f6bb717c9
comparison
equal deleted inserted replaced
14421:3068270ba476 14422:2b8e28fdf503
323 inline bool push(E t); 323 inline bool push(E t);
324 324
325 // Attempts to claim a task from the "local" end of the queue (the most 325 // Attempts to claim a task from the "local" end of the queue (the most
326 // recently pushed). If successful, returns true and sets t to the task; 326 // recently pushed). If successful, returns true and sets t to the task;
327 // otherwise, returns false (the queue is empty). 327 // otherwise, returns false (the queue is empty).
328 inline bool pop_local(E& t); 328 inline bool pop_local(volatile E& t);
329 329
330 // Like pop_local(), but uses the "global" end of the queue (the least 330 // Like pop_local(), but uses the "global" end of the queue (the least
331 // recently pushed). 331 // recently pushed).
332 bool pop_global(E& t); 332 bool pop_global(volatile E& t);
333 333
334 // Delete any resource associated with the queue. 334 // Delete any resource associated with the queue.
335 ~GenericTaskQueue(); 335 ~GenericTaskQueue();
336 336
337 // apply the closure to all elements in the task queue 337 // apply the closure to all elements in the task queue
425 assert(dirty_size(localBot, _age.top()) != N - 1, "sanity"); 425 assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
426 return false; 426 return false;
427 } 427 }
428 428
429 template<class E, MEMFLAGS F, unsigned int N> 429 template<class E, MEMFLAGS F, unsigned int N>
430 bool GenericTaskQueue<E, F, N>::pop_global(E& t) { 430 bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
431 Age oldAge = _age.get(); 431 Age oldAge = _age.get();
432 // Architectures with weak memory model require a barrier here 432 // Architectures with weak memory model require a barrier here
433 // to guarantee that bottom is not older than age, 433 // to guarantee that bottom is not older than age,
434 // which is crucial for the correctness of the algorithm. 434 // which is crucial for the correctness of the algorithm.
435 #if !(defined SPARC || defined IA32 || defined AMD64) 435 #if !(defined SPARC || defined IA32 || defined AMD64)
702 return push_slow(t, dirty_n_elems); 702 return push_slow(t, dirty_n_elems);
703 } 703 }
704 } 704 }
705 705
706 template<class E, MEMFLAGS F, unsigned int N> inline bool 706 template<class E, MEMFLAGS F, unsigned int N> inline bool
707 GenericTaskQueue<E, F, N>::pop_local(E& t) { 707 GenericTaskQueue<E, F, N>::pop_local(volatile E& t) {
708 uint localBot = _bottom; 708 uint localBot = _bottom;
709 // This value cannot be N-1. That can only occur as a result of 709 // This value cannot be N-1. That can only occur as a result of
710 // the assignment to bottom in this method. If it does, this method 710 // the assignment to bottom in this method. If it does, this method
711 // resets the size to 0 before the next call (which is sequential, 711 // resets the size to 0 before the next call (which is sequential,
712 // since this is pop_local.) 712 // since this is pop_local.)
800 _index = t._index; 800 _index = t._index;
801 return *this; 801 return *this;
802 } 802 }
803 volatile ObjArrayTask& 803 volatile ObjArrayTask&
804 operator =(const volatile ObjArrayTask& t) volatile { 804 operator =(const volatile ObjArrayTask& t) volatile {
805 _obj = t._obj; 805 (void)const_cast<oop&>(_obj = t._obj);
806 _index = t._index; 806 _index = t._index;
807 return *this; 807 return *this;
808 } 808 }
809 809
810 inline oop obj() const { return _obj; } 810 inline oop obj() const { return _obj; }