Mercurial > hg > truffle
annotate src/share/vm/c1/c1_Compiler.cpp @ 10325:01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
Summary: Disable client compiler and switch to interpreter if there is not enough free space in the code cache.
Reviewed-by: kvn, twisti
author | anoll |
---|---|
date | Thu, 23 May 2013 14:11:09 +0200 |
parents | b9a9ed0f8eeb |
children | 836a62f43af9 469216acdb28 |
rev | line source |
---|---|
0 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6197
diff
changeset
|
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "c1/c1_Compilation.hpp" | |
27 #include "c1/c1_Compiler.hpp" | |
28 #include "c1/c1_FrameMap.hpp" | |
29 #include "c1/c1_GraphBuilder.hpp" | |
30 #include "c1/c1_LinearScan.hpp" | |
31 #include "c1/c1_MacroAssembler.hpp" | |
32 #include "c1/c1_Runtime1.hpp" | |
33 #include "c1/c1_ValueType.hpp" | |
34 #include "compiler/compileBroker.hpp" | |
35 #include "compiler/compilerOracle.hpp" | |
36 #include "interpreter/linkResolver.hpp" | |
37 #include "memory/allocation.hpp" | |
38 #include "memory/allocation.inline.hpp" | |
39 #include "memory/resourceArea.hpp" | |
40 #include "prims/nativeLookup.hpp" | |
41 #include "runtime/arguments.hpp" | |
42 #include "runtime/interfaceSupport.hpp" | |
43 #include "runtime/sharedRuntime.hpp" | |
0 | 44 |
45 volatile int Compiler::_runtimes = uninitialized; | |
46 | |
47 Compiler::Compiler() { | |
48 } | |
49 | |
50 | |
51 Compiler::~Compiler() { | |
52 Unimplemented(); | |
53 } | |
54 | |
55 | |
1584 | 56 void Compiler::initialize_all() { |
57 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); | |
6197 | 58 Arena* arena = new (mtCompiler) Arena(); |
1584 | 59 Runtime1::initialize(buffer_blob); |
60 FrameMap::initialize(); | |
61 // initialize data structures | |
62 ValueType::initialize(arena); | |
63 // Instruction::initialize(); | |
64 // BlockBegin::initialize(); | |
65 GraphBuilder::initialize(); | |
66 // note: to use more than one instance of LinearScan at a time this function call has to | |
67 // be moved somewhere outside of this constructor: | |
68 Interval::initialize(arena); | |
69 } | |
70 | |
71 | |
0 | 72 void Compiler::initialize() { |
73 if (_runtimes != initialized) { | |
1584 | 74 initialize_runtimes( initialize_all, &_runtimes); |
0 | 75 } |
76 mark_initialized(); | |
77 } | |
78 | |
79 | |
10325
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
80 BufferBlob* Compiler::get_buffer_blob(ciEnv* env) { |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
81 // Allocate buffer blob once at startup since allocation for each |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
82 // compilation seems to be too expensive (at least on Intel win32). |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
83 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
84 if (buffer_blob != NULL) { |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
85 return buffer_blob; |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
86 } |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
87 |
1584 | 88 // setup CodeBuffer. Preallocate a BufferBlob of size |
89 // NMethodSizeLimit plus some extra space for constants. | |
90 int code_buffer_size = Compilation::desired_max_code_buffer_size() + | |
91 Compilation::desired_max_constant_size(); | |
10325
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
92 |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
93 buffer_blob = BufferBlob::create("Compiler1 temporary CodeBuffer", |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
94 code_buffer_size); |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
95 if (buffer_blob == NULL) { |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
96 CompileBroker::handle_full_code_cache(); |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
97 env->record_failure("CodeCache is full"); |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
98 } else { |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
99 CompilerThread::current()->set_buffer_blob(buffer_blob); |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
100 } |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
101 |
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
102 return buffer_blob; |
1584 | 103 } |
104 | |
105 | |
0 | 106 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { |
10325
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
107 BufferBlob* buffer_blob = Compiler::get_buffer_blob(env); |
1584 | 108 if (buffer_blob == NULL) { |
10325
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
109 return; |
1584 | 110 } |
0 | 111 |
112 if (!is_initialized()) { | |
113 initialize(); | |
114 } | |
10325
01e51113b4f5
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
6842
diff
changeset
|
115 |
0 | 116 // invoke compilation |
117 { | |
118 // We are nested here because we need for the destructor | |
119 // of Compilation to occur before we release the any | |
120 // competing compiler thread | |
121 ResourceMark rm; | |
1584 | 122 Compilation c(this, env, method, entry_bci, buffer_blob); |
0 | 123 } |
124 } | |
125 | |
126 | |
127 void Compiler::print_timers() { | |
128 Compilation::print_timers(); | |
129 } |