< prev index next >

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

Print this page
rev 13071 : [mq]: webrev.1
   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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_G1_WORKERDATAARRAY_INLINE_HPP
  26 #define SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
  27 
  28 #include "gc/g1/workerDataArray.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "utilities/ostream.hpp"
  31 
  32 template <typename T>
  33 WorkerDataArray<T>::WorkerDataArray(uint length, const char* title) :
  34  _title(title),
  35  _length(0),
  36  _thread_work_items(NULL) {
  37   assert(length > 0, "Must have some workers to store data for");
  38   _length = length;
  39   _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  40   reset();
  41 }
  42 
  43 template <typename T>
  44 void WorkerDataArray<T>::set(uint worker_i, T value) {
  45   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  46   assert(_data[worker_i] == uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title);
  47   _data[worker_i] = value;
  48 }


 136     out->print_cr(", Workers: %d", contributing_threads);
 137   } else {
 138     // No data for this phase.
 139     out->print_cr(" skipped");
 140   }
 141 }
 142 
 143 template <class T>
 144 void WorkerDataArray<T>::print_details_on(outputStream* out) const {
 145   WDAPrinter::details(this, out);
 146 }
 147 
 148 template <typename T>
 149 void WorkerDataArray<T>::reset() {
 150   set_all(uninitialized());
 151   if (_thread_work_items != NULL) {
 152     _thread_work_items->reset();
 153   }
 154 }
 155 
 156 #endif // SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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_WORKERDATAARRAY_INLINE_HPP
  26 #define SHARE_VM_GC_SHARED_WORKERDATAARRAY_INLINE_HPP
  27 
  28 #include "gc/shared/workerDataArray.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "utilities/ostream.hpp"
  31 
  32 template <typename T>
  33 WorkerDataArray<T>::WorkerDataArray(uint length, const char* title) :
  34  _title(title),
  35  _length(0),
  36  _thread_work_items(NULL) {
  37   assert(length > 0, "Must have some workers to store data for");
  38   _length = length;
  39   _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  40   reset();
  41 }
  42 
  43 template <typename T>
  44 void WorkerDataArray<T>::set(uint worker_i, T value) {
  45   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  46   assert(_data[worker_i] == uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title);
  47   _data[worker_i] = value;
  48 }


 136     out->print_cr(", Workers: %d", contributing_threads);
 137   } else {
 138     // No data for this phase.
 139     out->print_cr(" skipped");
 140   }
 141 }
 142 
 143 template <class T>
 144 void WorkerDataArray<T>::print_details_on(outputStream* out) const {
 145   WDAPrinter::details(this, out);
 146 }
 147 
 148 template <typename T>
 149 void WorkerDataArray<T>::reset() {
 150   set_all(uninitialized());
 151   if (_thread_work_items != NULL) {
 152     _thread_work_items->reset();
 153   }
 154 }
 155 
 156 #endif // SHARE_VM_GC_SHARED_WORKERDATAARRAY_INLINE_HPP
< prev index next >