author | dholmes |
Mon, 12 May 2014 20:25:53 -0400 | |
changeset 24436 | c91bfb1a91a7 |
parent 22236 | 44508442b8da |
child 25946 | 1572c9f03fb9 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22236 | 2 |
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 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" |
|
1 | 44 |
|
45 |
||
22236 | 46 |
Compiler::Compiler() : AbstractCompiler(c1) { |
47 |
} |
|
1 | 48 |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
49 |
void Compiler::init_c1_runtime() { |
5707 | 50 |
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); |
13195 | 51 |
Arena* arena = new (mtCompiler) Arena(); |
5707 | 52 |
Runtime1::initialize(buffer_blob); |
53 |
FrameMap::initialize(); |
|
54 |
// initialize data structures |
|
55 |
ValueType::initialize(arena); |
|
56 |
GraphBuilder::initialize(); |
|
57 |
// note: to use more than one instance of LinearScan at a time this function call has to |
|
58 |
// be moved somewhere outside of this constructor: |
|
59 |
Interval::initialize(arena); |
|
60 |
} |
|
61 |
||
62 |
||
1 | 63 |
void Compiler::initialize() { |
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
64 |
// Buffer blob must be allocated per C1 compiler thread at startup |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
65 |
BufferBlob* buffer_blob = init_buffer_blob(); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
66 |
|
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
67 |
if (should_perform_init()) { |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
68 |
if (buffer_blob == NULL) { |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
69 |
// When we come here we are in state 'initializing'; entire C1 compilation |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
70 |
// can be shut down. |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
71 |
set_state(failed); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
72 |
} else { |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
73 |
init_c1_runtime(); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
74 |
set_state(initialized); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
75 |
} |
1 | 76 |
} |
77 |
} |
|
78 |
||
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
79 |
BufferBlob* Compiler::init_buffer_blob() { |
17623
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
80 |
// Allocate buffer blob once at startup since allocation for each |
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
81 |
// compilation seems to be too expensive (at least on Intel win32). |
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
82 |
assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once"); |
17623
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
83 |
|
5707 | 84 |
// setup CodeBuffer. Preallocate a BufferBlob of size |
85 |
// NMethodSizeLimit plus some extra space for constants. |
|
86 |
int code_buffer_size = Compilation::desired_max_code_buffer_size() + |
|
87 |
Compilation::desired_max_constant_size(); |
|
17623
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
88 |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
89 |
BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
90 |
if (buffer_blob != NULL) { |
17623
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
91 |
CompilerThread::current()->set_buffer_blob(buffer_blob); |
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
92 |
} |
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
93 |
|
6295813086d0
8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents:
13963
diff
changeset
|
94 |
return buffer_blob; |
5707 | 95 |
} |
96 |
||
97 |
||
1 | 98 |
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { |
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
99 |
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
17623
diff
changeset
|
100 |
assert(buffer_blob != NULL, "Must exist"); |
1 | 101 |
// invoke compilation |
102 |
{ |
|
103 |
// We are nested here because we need for the destructor |
|
104 |
// of Compilation to occur before we release the any |
|
105 |
// competing compiler thread |
|
106 |
ResourceMark rm; |
|
5707 | 107 |
Compilation c(this, env, method, entry_bci, buffer_blob); |
1 | 108 |
} |
109 |
} |
|
110 |
||
111 |
||
112 |
void Compiler::print_timers() { |
|
113 |
Compilation::print_timers(); |
|
114 |
} |