< prev index next >

src/hotspot/share/compiler/compileTask.cpp

Print this page




  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 #include "compiler/compileTask.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "compiler/compilerDirectives.hpp"
  30 #include "logging/log.hpp"
  31 #include "logging/logStream.hpp"
  32 #include "memory/resourceArea.hpp"

  33 
  34 CompileTask*  CompileTask::_task_free_list = NULL;
  35 #ifdef ASSERT
  36 int CompileTask::_num_allocated_tasks = 0;
  37 #endif
  38 
  39 /**
  40  * Allocate a CompileTask, from the free list if possible.
  41  */
  42 CompileTask* CompileTask::allocate() {
  43   MutexLocker locker(CompileTaskAlloc_lock);
  44   CompileTask* task = NULL;
  45 
  46   if (_task_free_list != NULL) {
  47     task = _task_free_list;
  48     _task_free_list = task->next();
  49     task->set_next(NULL);
  50   } else {
  51     task = new CompileTask();
  52     DEBUG_ONLY(_num_allocated_tasks++;)




  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 #include "compiler/compileTask.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "compiler/compilerDirectives.hpp"
  30 #include "logging/log.hpp"
  31 #include "logging/logStream.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 
  35 CompileTask*  CompileTask::_task_free_list = NULL;
  36 #ifdef ASSERT
  37 int CompileTask::_num_allocated_tasks = 0;
  38 #endif
  39 
  40 /**
  41  * Allocate a CompileTask, from the free list if possible.
  42  */
  43 CompileTask* CompileTask::allocate() {
  44   MutexLocker locker(CompileTaskAlloc_lock);
  45   CompileTask* task = NULL;
  46 
  47   if (_task_free_list != NULL) {
  48     task = _task_free_list;
  49     _task_free_list = task->next();
  50     task->set_next(NULL);
  51   } else {
  52     task = new CompileTask();
  53     DEBUG_ONLY(_num_allocated_tasks++;)


< prev index next >