< prev index next >

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

Print this page




  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 #include "gc/g1/workerDataArray.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 
  28 template <typename T>
  29 WorkerDataArray<T>::WorkerDataArray(uint length,
  30                                     const char* title,
  31                                     bool print_sum,
  32                                     int log_level,
  33                                     uint indent_level) :
  34  _title(title),
  35  _length(0),
  36  _print_sum(print_sum),
  37  _log_level(log_level),
  38  _indent_level(indent_level),
  39  _thread_work_items(NULL),
  40  _enabled(true) {
  41   assert(length > 0, "Must have some workers to store data for");
  42   _length = length;
  43   _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  44   reset();
  45 }
  46 
  47 template <typename T>
  48 void WorkerDataArray<T>::set(uint worker_i, T value) {
  49   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  50   assert(_data[worker_i] == uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title);
  51   _data[worker_i] = value;
  52 }
  53 
  54 template <typename T>
  55 T WorkerDataArray<T>::get(uint worker_i) const {
  56   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  57   assert(_data[worker_i] != uninitialized(), "No data added for worker %d", worker_i);




  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 #include "gc/g1/workerDataArray.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 
  28 template <typename T>
  29 WorkerDataArray<T>::WorkerDataArray(uint length,
  30                                     const char* title,
  31                                     bool print_sum,

  32                                     uint indent_level) :
  33  _title(title),
  34  _length(0),
  35  _print_sum(print_sum),

  36  _indent_level(indent_level),
  37  _thread_work_items(NULL),
  38  _enabled(true) {
  39   assert(length > 0, "Must have some workers to store data for");
  40   _length = length;
  41   _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  42   reset();
  43 }
  44 
  45 template <typename T>
  46 void WorkerDataArray<T>::set(uint worker_i, T value) {
  47   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  48   assert(_data[worker_i] == uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title);
  49   _data[worker_i] = value;
  50 }
  51 
  52 template <typename T>
  53 T WorkerDataArray<T>::get(uint worker_i) const {
  54   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  55   assert(_data[worker_i] != uninitialized(), "No data added for worker %d", worker_i);


< prev index next >