Mercurial > hg > graal-compiler
annotate src/share/vm/opto/c2compiler.cpp @ 1585:49fac4acd688
6958485: fix for 6879921 was insufficient
Reviewed-by: kvn
author | never |
---|---|
date | Mon, 07 Jun 2010 14:17:01 -0700 |
parents | c18cbe5936b8 |
children | 0e35fa8ebccd |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
2 * Copyright (c) 1999, 2010, 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:
1397
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
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:
1397
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_c2compiler.cpp.incl" | |
27 | |
28 | |
29 volatile int C2Compiler::_runtimes = uninitialized; | |
30 | |
31 // register information defined by ADLC | |
32 extern const char register_save_policy[]; | |
33 extern const int register_save_type[]; | |
34 | |
35 const char* C2Compiler::retry_no_subsuming_loads() { | |
36 return "retry without subsuming loads"; | |
37 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
38 const char* C2Compiler::retry_no_escape_analysis() { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
39 return "retry without escape analysis"; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
40 } |
0 | 41 void C2Compiler::initialize_runtime() { |
42 | |
43 // Check assumptions used while running ADLC | |
44 Compile::adlc_verification(); | |
45 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts"); | |
46 | |
47 for (int i = 0; i < ConcreteRegisterImpl::number_of_registers ; i++ ) { | |
48 OptoReg::vm2opto[i] = OptoReg::Bad; | |
49 } | |
50 | |
51 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(REG_COUNT); i = OptoReg::add(i,1) ) { | |
52 VMReg r = OptoReg::as_VMReg(i); | |
53 if (r->is_valid()) { | |
54 OptoReg::vm2opto[r->value()] = i; | |
55 } | |
56 } | |
57 | |
58 // Check that runtime and architecture description agree on callee-saved-floats | |
59 bool callee_saved_floats = false; | |
60 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) { | |
61 // Is there a callee-saved float or double? | |
62 if( register_save_policy[i] == 'E' /* callee-saved */ && | |
63 (register_save_type[i] == Op_RegF || register_save_type[i] == Op_RegD) ) { | |
64 callee_saved_floats = true; | |
65 } | |
66 } | |
67 | |
68 DEBUG_ONLY( Node::init_NodeProperty(); ) | |
69 | |
70 Compile::pd_compiler2_init(); | |
71 | |
72 CompilerThread* thread = CompilerThread::current(); | |
73 | |
74 HandleMark handle_mark(thread); | |
75 | |
76 OptoRuntime::generate(thread->env()); | |
77 | |
78 } | |
79 | |
80 | |
81 void C2Compiler::initialize() { | |
82 | |
83 // This method can only be called once per C2Compiler object | |
84 // The first compiler thread that gets here will initialize the | |
85 // small amount of global state (and runtime stubs) that c2 needs. | |
86 | |
87 // There is a race possible once at startup and then we're fine | |
88 | |
89 // Note that this is being called from a compiler thread not the | |
90 // main startup thread. | |
91 | |
92 if (_runtimes != initialized) { | |
93 initialize_runtimes( initialize_runtime, &_runtimes); | |
94 } | |
95 | |
96 // Mark this compiler object as ready to roll | |
97 mark_initialized(); | |
98 } | |
99 | |
100 void C2Compiler::compile_method(ciEnv* env, | |
101 ciMethod* target, | |
102 int entry_bci) { | |
103 if (!is_initialized()) { | |
104 initialize(); | |
105 } | |
106 bool subsume_loads = true; | |
818
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
196
diff
changeset
|
107 bool do_escape_analysis = DoEscapeAnalysis && |
1397
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
108 !env->jvmti_can_access_local_variables(); |
0 | 109 while (!env->failing()) { |
110 // Attempt to compile while subsuming loads into machine instructions. | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
111 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis); |
0 | 112 |
113 // Check result and retry if appropriate. | |
114 if (C.failure_reason() != NULL) { | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
115 if (C.failure_reason_is(retry_no_subsuming_loads())) { |
0 | 116 assert(subsume_loads, "must make progress"); |
117 subsume_loads = false; | |
118 continue; // retry | |
119 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
120 if (C.failure_reason_is(retry_no_escape_analysis())) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
121 assert(do_escape_analysis, "must make progress"); |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
122 do_escape_analysis = false; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
123 continue; // retry |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
124 } |
0 | 125 // Pass any other failure reason up to the ciEnv. |
126 // Note that serious, irreversible failures are already logged | |
127 // on the ciEnv via env->record_method_not_compilable(). | |
128 env->record_failure(C.failure_reason()); | |
129 } | |
130 | |
131 // No retry; just break the loop. | |
132 break; | |
133 } | |
134 } | |
135 | |
136 | |
137 void C2Compiler::print_timers() { | |
138 // do nothing | |
139 } |