c1_Compiler.cpp revision 1472
0N/A/*
1472N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/A#include "incls/_precompiled.incl"
0N/A#include "incls/_c1_Compiler.cpp.incl"
0N/A
0N/Avolatile int Compiler::_runtimes = uninitialized;
0N/A
0N/Avolatile bool Compiler::_compiling = false;
0N/A
0N/A
0N/ACompiler::Compiler() {
0N/A}
0N/A
0N/A
0N/ACompiler::~Compiler() {
0N/A Unimplemented();
0N/A}
0N/A
0N/A
0N/Avoid Compiler::initialize() {
0N/A if (_runtimes != initialized) {
0N/A initialize_runtimes( Runtime1::initialize, &_runtimes);
0N/A }
0N/A mark_initialized();
0N/A}
0N/A
0N/A
0N/Avoid Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
0N/A
0N/A if (!is_initialized()) {
0N/A initialize();
0N/A }
0N/A // invoke compilation
0N/A#ifdef TIERED
0N/A // We are thread in native here...
0N/A CompilerThread* thread = CompilerThread::current();
0N/A {
0N/A ThreadInVMfromNative tv(thread);
0N/A MutexLocker only_one (C1_lock, thread);
0N/A while ( _compiling) {
0N/A C1_lock->wait();
0N/A }
0N/A _compiling = true;
0N/A }
0N/A#endif // TIERED
0N/A {
0N/A // We are nested here because we need for the destructor
0N/A // of Compilation to occur before we release the any
0N/A // competing compiler thread
0N/A ResourceMark rm;
0N/A Compilation c(this, env, method, entry_bci);
0N/A }
0N/A#ifdef TIERED
0N/A {
0N/A ThreadInVMfromNative tv(thread);
0N/A MutexLocker only_one (C1_lock, thread);
0N/A _compiling = false;
0N/A C1_lock->notify();
0N/A }
0N/A#endif // TIERED
0N/A}
0N/A
0N/A
0N/Avoid Compiler::print_timers() {
0N/A Compilation::print_timers();
0N/A}