annotate src/share/vm/c1/c1_Compiler.cpp @ 17467:55fb97c4c58d hs25-b65

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
author mikael
date Tue, 24 Dec 2013 11:48:39 -0800
parents 469216acdb28
children 16e101c8691f 833b0f92429a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12880
diff changeset
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
26 #include "c1/c1_Compilation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
27 #include "c1/c1_Compiler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
28 #include "c1/c1_FrameMap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
29 #include "c1/c1_GraphBuilder.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
30 #include "c1/c1_LinearScan.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
31 #include "c1/c1_MacroAssembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
32 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
33 #include "c1/c1_ValueType.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
34 #include "compiler/compileBroker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
35 #include "compiler/compilerOracle.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
36 #include "interpreter/linkResolver.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
37 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
38 #include "memory/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
39 #include "memory/resourceArea.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
40 #include "prims/nativeLookup.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
41 #include "runtime/arguments.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
42 #include "runtime/interfaceSupport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
43 #include "runtime/sharedRuntime.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
46 Compiler::Compiler () {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
47
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
48 void Compiler::init_c1_runtime() {
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
49 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
50 Arena* arena = new (mtCompiler) Arena();
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
51 Runtime1::initialize(buffer_blob);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
52 FrameMap::initialize();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
53 // initialize data structures
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
54 ValueType::initialize(arena);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
55 GraphBuilder::initialize();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
56 // note: to use more than one instance of LinearScan at a time this function call has to
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
57 // be moved somewhere outside of this constructor:
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
58 Interval::initialize(arena);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
59 }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
60
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
61
0
a61af66fc99e Initial load
duke
parents:
diff changeset
62 void Compiler::initialize() {
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
63 // Buffer blob must be allocated per C1 compiler thread at startup
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
64 BufferBlob* buffer_blob = init_buffer_blob();
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
65
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
66 if (should_perform_init()) {
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
67 if (buffer_blob == NULL) {
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
68 // When we come here we are in state 'initializing'; entire C1 compilation
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
69 // can be shut down.
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
70 set_state(failed);
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
71 } else {
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
72 init_c1_runtime();
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
73 set_state(initialized);
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
74 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
78 BufferBlob* Compiler::init_buffer_blob() {
10325
01e51113b4f5 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 6842
diff changeset
79 // 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
80 // compilation seems to be too expensive (at least on Intel win32).
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
81 assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
10325
01e51113b4f5 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 6842
diff changeset
82
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
83 // setup CodeBuffer. Preallocate a BufferBlob of size
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
84 // NMethodSizeLimit plus some extra space for constants.
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
85 int code_buffer_size = Compilation::desired_max_code_buffer_size() +
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
86 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
87
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
88 BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
89 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
90 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
91 }
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 return buffer_blob;
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
94 }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
95
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
96
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
12880
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
98 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
469216acdb28 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 10325
diff changeset
99 assert(buffer_blob != NULL, "Must exist");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // invoke compilation
a61af66fc99e Initial load
duke
parents:
diff changeset
101 {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // We are nested here because we need for the destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // of Compilation to occur before we release the any
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // competing compiler thread
a61af66fc99e Initial load
duke
parents:
diff changeset
105 ResourceMark rm;
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
106 Compilation c(this, env, method, entry_bci, buffer_blob);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void Compiler::print_timers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 Compilation::print_timers();
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }