src/share/vm/utilities/yieldingWorkgroup.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 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 # include "incls/_precompiled.incl"
  26 # include "incls/_yieldingWorkgroup.cpp.incl"


  27 
  28 // Forward declaration of classes declared here.
  29 
  30 class GangWorker;
  31 class WorkData;
  32 
  33 YieldingFlexibleWorkGang::YieldingFlexibleWorkGang(
  34   const char* name, int workers, bool are_GC_task_threads) :
  35   AbstractWorkGang(name, are_GC_task_threads, false) {
  36   // Save arguments.
  37   _total_workers = workers;
  38   assert(_total_workers > 0, "Must have more than 1 worker");
  39 
  40   _yielded_workers = 0;
  41 
  42   if (TraceWorkGang) {
  43     tty->print_cr("Constructing work gang %s with %d threads", name, workers);
  44   }
  45   _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, workers);
  46   assert(gang_workers() != NULL, "Failed to allocate gang workers");


   1 /*
   2  * Copyright (c) 2005, 2010, 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 #include "precompiled.hpp"
  26 #ifndef SERIALGC
  27 #include "utilities/yieldingWorkgroup.hpp"
  28 #endif
  29 
  30 // Forward declaration of classes declared here.
  31 
  32 class GangWorker;
  33 class WorkData;
  34 
  35 YieldingFlexibleWorkGang::YieldingFlexibleWorkGang(
  36   const char* name, int workers, bool are_GC_task_threads) :
  37   AbstractWorkGang(name, are_GC_task_threads, false) {
  38   // Save arguments.
  39   _total_workers = workers;
  40   assert(_total_workers > 0, "Must have more than 1 worker");
  41 
  42   _yielded_workers = 0;
  43 
  44   if (TraceWorkGang) {
  45     tty->print_cr("Constructing work gang %s with %d threads", name, workers);
  46   }
  47   _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, workers);
  48   assert(gang_workers() != NULL, "Failed to allocate gang workers");