Mercurial > hg > truffle
annotate src/share/vm/opto/c2compiler.cpp @ 1994:6cd6d394f280
7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed())
7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps
Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages.
Reviewed-by: johnc, tonyp
author | ysr |
---|---|
date | Tue, 07 Dec 2010 21:55:53 -0800 |
parents | f95d63e2154a |
children | b92c45f2bc75 |
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 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "opto/c2compiler.hpp" | |
27 #include "opto/runtime.hpp" | |
28 #ifdef TARGET_ARCH_MODEL_x86_32 | |
29 # include "adfiles/ad_x86_32.hpp" | |
30 #endif | |
31 #ifdef TARGET_ARCH_MODEL_x86_64 | |
32 # include "adfiles/ad_x86_64.hpp" | |
33 #endif | |
34 #ifdef TARGET_ARCH_MODEL_sparc | |
35 # include "adfiles/ad_sparc.hpp" | |
36 #endif | |
37 #ifdef TARGET_ARCH_MODEL_zero | |
38 # include "adfiles/ad_zero.hpp" | |
39 #endif | |
0 | 40 |
41 | |
42 volatile int C2Compiler::_runtimes = uninitialized; | |
43 | |
44 // register information defined by ADLC | |
45 extern const char register_save_policy[]; | |
46 extern const int register_save_type[]; | |
47 | |
48 const char* C2Compiler::retry_no_subsuming_loads() { | |
49 return "retry without subsuming loads"; | |
50 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
51 const char* C2Compiler::retry_no_escape_analysis() { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
52 return "retry without escape analysis"; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
53 } |
0 | 54 void C2Compiler::initialize_runtime() { |
55 | |
56 // Check assumptions used while running ADLC | |
57 Compile::adlc_verification(); | |
58 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts"); | |
59 | |
60 for (int i = 0; i < ConcreteRegisterImpl::number_of_registers ; i++ ) { | |
61 OptoReg::vm2opto[i] = OptoReg::Bad; | |
62 } | |
63 | |
64 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(REG_COUNT); i = OptoReg::add(i,1) ) { | |
65 VMReg r = OptoReg::as_VMReg(i); | |
66 if (r->is_valid()) { | |
67 OptoReg::vm2opto[r->value()] = i; | |
68 } | |
69 } | |
70 | |
71 // Check that runtime and architecture description agree on callee-saved-floats | |
72 bool callee_saved_floats = false; | |
73 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) { | |
74 // Is there a callee-saved float or double? | |
75 if( register_save_policy[i] == 'E' /* callee-saved */ && | |
76 (register_save_type[i] == Op_RegF || register_save_type[i] == Op_RegD) ) { | |
77 callee_saved_floats = true; | |
78 } | |
79 } | |
80 | |
81 DEBUG_ONLY( Node::init_NodeProperty(); ) | |
82 | |
83 Compile::pd_compiler2_init(); | |
84 | |
85 CompilerThread* thread = CompilerThread::current(); | |
86 | |
87 HandleMark handle_mark(thread); | |
88 | |
89 OptoRuntime::generate(thread->env()); | |
90 | |
91 } | |
92 | |
93 | |
94 void C2Compiler::initialize() { | |
95 | |
96 // This method can only be called once per C2Compiler object | |
97 // The first compiler thread that gets here will initialize the | |
98 // small amount of global state (and runtime stubs) that c2 needs. | |
99 | |
100 // There is a race possible once at startup and then we're fine | |
101 | |
102 // Note that this is being called from a compiler thread not the | |
103 // main startup thread. | |
104 | |
105 if (_runtimes != initialized) { | |
106 initialize_runtimes( initialize_runtime, &_runtimes); | |
107 } | |
108 | |
109 // Mark this compiler object as ready to roll | |
110 mark_initialized(); | |
111 } | |
112 | |
113 void C2Compiler::compile_method(ciEnv* env, | |
114 ciMethod* target, | |
115 int entry_bci) { | |
116 if (!is_initialized()) { | |
117 initialize(); | |
118 } | |
1685 | 119 bool subsume_loads = SubsumeLoads; |
818
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
196
diff
changeset
|
120 bool do_escape_analysis = DoEscapeAnalysis && |
1397
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
121 !env->jvmti_can_access_local_variables(); |
0 | 122 while (!env->failing()) { |
123 // 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
|
124 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis); |
0 | 125 |
1685 | 126 |
0 | 127 // Check result and retry if appropriate. |
128 if (C.failure_reason() != NULL) { | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
129 if (C.failure_reason_is(retry_no_subsuming_loads())) { |
0 | 130 assert(subsume_loads, "must make progress"); |
131 subsume_loads = false; | |
132 continue; // retry | |
133 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
134 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
|
135 assert(do_escape_analysis, "must make progress"); |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
136 do_escape_analysis = false; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
137 continue; // retry |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
138 } |
0 | 139 // Pass any other failure reason up to the ciEnv. |
140 // Note that serious, irreversible failures are already logged | |
141 // on the ciEnv via env->record_method_not_compilable(). | |
142 env->record_failure(C.failure_reason()); | |
143 } | |
1685 | 144 if (StressRecompilation) { |
145 if (subsume_loads) { | |
146 subsume_loads = false; | |
147 continue; // retry | |
148 } | |
149 if (do_escape_analysis) { | |
150 do_escape_analysis = false; | |
151 continue; // retry | |
152 } | |
153 } | |
0 | 154 |
155 // No retry; just break the loop. | |
156 break; | |
157 } | |
158 } | |
159 | |
160 | |
161 void C2Compiler::print_timers() { | |
162 // do nothing | |
163 } |