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