src/share/vm/c1/c1_Compiler.cpp

Tue, 29 Dec 2009 19:08:54 +0100

author
roland
date
Tue, 29 Dec 2009 19:08:54 +0100
changeset 2174
f02a8bbe6ed4
parent 1939
b812ff5abc73
child 2314
f95d63e2154a
permissions
-rw-r--r--

6986046: C1 valuestack cleanup
Summary: fixes an historical oddity in C1 with inlining where all of the expression stacks are kept in the topmost ValueStack instead of being in their respective ValueStacks.
Reviewed-by: never
Contributed-by: Christian Wimmer <cwimmer@uci.edu>

duke@435 1 /*
trims@1907 2 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 #include "incls/_precompiled.incl"
duke@435 26 #include "incls/_c1_Compiler.cpp.incl"
duke@435 27
duke@435 28 volatile int Compiler::_runtimes = uninitialized;
duke@435 29
duke@435 30 Compiler::Compiler() {
duke@435 31 }
duke@435 32
duke@435 33
duke@435 34 Compiler::~Compiler() {
duke@435 35 Unimplemented();
duke@435 36 }
duke@435 37
duke@435 38
iveresov@1939 39 void Compiler::initialize_all() {
iveresov@1939 40 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
iveresov@1939 41 Arena* arena = new Arena();
iveresov@1939 42 Runtime1::initialize(buffer_blob);
iveresov@1939 43 FrameMap::initialize();
iveresov@1939 44 // initialize data structures
iveresov@1939 45 ValueType::initialize(arena);
iveresov@1939 46 // Instruction::initialize();
iveresov@1939 47 // BlockBegin::initialize();
iveresov@1939 48 GraphBuilder::initialize();
iveresov@1939 49 // note: to use more than one instance of LinearScan at a time this function call has to
iveresov@1939 50 // be moved somewhere outside of this constructor:
iveresov@1939 51 Interval::initialize(arena);
iveresov@1939 52 }
iveresov@1939 53
iveresov@1939 54
duke@435 55 void Compiler::initialize() {
duke@435 56 if (_runtimes != initialized) {
iveresov@1939 57 initialize_runtimes( initialize_all, &_runtimes);
duke@435 58 }
duke@435 59 mark_initialized();
duke@435 60 }
duke@435 61
duke@435 62
iveresov@1939 63 BufferBlob* Compiler::build_buffer_blob() {
iveresov@1939 64 // setup CodeBuffer. Preallocate a BufferBlob of size
iveresov@1939 65 // NMethodSizeLimit plus some extra space for constants.
iveresov@1939 66 int code_buffer_size = Compilation::desired_max_code_buffer_size() +
iveresov@1939 67 Compilation::desired_max_constant_size();
iveresov@1939 68 BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
iveresov@1939 69 code_buffer_size);
iveresov@1939 70 guarantee(blob != NULL, "must create initial code buffer");
iveresov@1939 71 return blob;
iveresov@1939 72 }
iveresov@1939 73
iveresov@1939 74
duke@435 75 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
iveresov@1939 76 // Allocate buffer blob once at startup since allocation for each
iveresov@1939 77 // compilation seems to be too expensive (at least on Intel win32).
iveresov@1939 78 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
iveresov@1939 79 if (buffer_blob == NULL) {
iveresov@1939 80 buffer_blob = build_buffer_blob();
iveresov@1939 81 CompilerThread::current()->set_buffer_blob(buffer_blob);
iveresov@1939 82 }
duke@435 83
duke@435 84 if (!is_initialized()) {
duke@435 85 initialize();
duke@435 86 }
duke@435 87 // invoke compilation
duke@435 88 {
duke@435 89 // We are nested here because we need for the destructor
duke@435 90 // of Compilation to occur before we release the any
duke@435 91 // competing compiler thread
duke@435 92 ResourceMark rm;
iveresov@1939 93 Compilation c(this, env, method, entry_bci, buffer_blob);
duke@435 94 }
duke@435 95 }
duke@435 96
duke@435 97
duke@435 98 void Compiler::print_timers() {
duke@435 99 Compilation::print_timers();
duke@435 100 }

mercurial