< prev index next >

src/share/vm/gc/shared/taskqueue.inline.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP
  26 #define SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP
  27 

  28 #include "memory/allocation.inline.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "utilities/debug.hpp"
  31 #include "utilities/taskqueue.hpp"
  32 #include "utilities/stack.inline.hpp"
  33 #include "runtime/atomic.inline.hpp"
  34 #include "runtime/orderAccess.inline.hpp"


  35 
  36 template <class T, MEMFLAGS F>
  37 inline GenericTaskQueueSet<T, F>::GenericTaskQueueSet(int n) : _n(n) {
  38   typedef T* GenericTaskQueuePtr;
  39   _queues = NEW_C_HEAP_ARRAY(GenericTaskQueuePtr, n, F);
  40   for (int i = 0; i < n; i++) {
  41     _queues[i] = NULL;
  42   }
  43 }
  44 
  45 template<class E, MEMFLAGS F, unsigned int N>
  46 inline void GenericTaskQueue<E, F, N>::initialize() {
  47   _elems = _array_allocator.allocate(N);
  48 }
  49 
  50 template<class E, MEMFLAGS F, unsigned int N>
  51 inline GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
  52   FREE_C_HEAP_ARRAY(E, _elems);
  53 }
  54 


 259 }
 260 
 261 template<class E, MEMFLAGS F, unsigned int N>
 262 inline void GenericTaskQueue<E, F, N>::oops_do(OopClosure* f) {
 263   // tty->print_cr("START OopTaskQueue::oops_do");
 264   uint iters = size();
 265   uint index = _bottom;
 266   for (uint i = 0; i < iters; ++i) {
 267     index = decrement_index(index);
 268     // tty->print_cr("  doing entry %d," INTPTR_T " -> " INTPTR_T,
 269     //            index, &_elems[index], _elems[index]);
 270     E* t = (E*)&_elems[index];      // cast away volatility
 271     oop* p = (oop*)t;
 272     assert((*t)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(*t)));
 273     f->do_oop(p);
 274   }
 275   // tty->print_cr("END OopTaskQueue::oops_do");
 276 }
 277 
 278 
 279 #endif // SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP
  26 #define SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP
  27 
  28 #include "gc/shared/taskqueue.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "oops/oop.inline.hpp"



  31 #include "runtime/atomic.inline.hpp"
  32 #include "runtime/orderAccess.inline.hpp"
  33 #include "utilities/debug.hpp"
  34 #include "utilities/stack.inline.hpp"
  35 
  36 template <class T, MEMFLAGS F>
  37 inline GenericTaskQueueSet<T, F>::GenericTaskQueueSet(int n) : _n(n) {
  38   typedef T* GenericTaskQueuePtr;
  39   _queues = NEW_C_HEAP_ARRAY(GenericTaskQueuePtr, n, F);
  40   for (int i = 0; i < n; i++) {
  41     _queues[i] = NULL;
  42   }
  43 }
  44 
  45 template<class E, MEMFLAGS F, unsigned int N>
  46 inline void GenericTaskQueue<E, F, N>::initialize() {
  47   _elems = _array_allocator.allocate(N);
  48 }
  49 
  50 template<class E, MEMFLAGS F, unsigned int N>
  51 inline GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
  52   FREE_C_HEAP_ARRAY(E, _elems);
  53 }
  54 


 259 }
 260 
 261 template<class E, MEMFLAGS F, unsigned int N>
 262 inline void GenericTaskQueue<E, F, N>::oops_do(OopClosure* f) {
 263   // tty->print_cr("START OopTaskQueue::oops_do");
 264   uint iters = size();
 265   uint index = _bottom;
 266   for (uint i = 0; i < iters; ++i) {
 267     index = decrement_index(index);
 268     // tty->print_cr("  doing entry %d," INTPTR_T " -> " INTPTR_T,
 269     //            index, &_elems[index], _elems[index]);
 270     E* t = (E*)&_elems[index];      // cast away volatility
 271     oop* p = (oop*)t;
 272     assert((*t)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(*t)));
 273     f->do_oop(p);
 274   }
 275   // tty->print_cr("END OopTaskQueue::oops_do");
 276 }
 277 
 278 
 279 #endif // SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP
< prev index next >