24
24
*/
25
25
package jdk .graal .compiler .replacements ;
26
26
27
- import static jdk .graal .compiler .core .common .NativeImageSupport .inRuntimeCode ;
28
-
29
27
import java .util .concurrent .ConcurrentHashMap ;
30
28
import java .util .function .Supplier ;
31
29
@@ -118,14 +116,9 @@ public CachingPEGraphDecoder(Architecture architecture,
118
116
}
119
117
120
118
@ SuppressWarnings ("try" )
121
- private EncodedGraph createGraph (ResolvedJavaMethod method , BytecodeProvider intrinsicBytecodeProvider ) {
119
+ private EncodedGraph createGraph (ResolvedJavaMethod method ) {
122
120
CanonicalizerPhase canonicalizer = CanonicalizerPhase .create ();
123
- StructuredGraph graphToEncode ;
124
- if (graph .isSubstitution () && inRuntimeCode ()) {
125
- throw GraalError .shouldNotReachHere ("dead path" ); // ExcludeFromJacocoGeneratedReport
126
- } else {
127
- graphToEncode = buildGraph (method , intrinsicBytecodeProvider , canonicalizer );
128
- }
121
+ StructuredGraph graphToEncode = buildGraph (method , canonicalizer );
129
122
130
123
/*
131
124
* ConvertDeoptimizeToGuardPhase reduces the number of merges in the graph, so that fewer
@@ -145,7 +138,7 @@ private EncodedGraph createGraph(ResolvedJavaMethod method, BytecodeProvider int
145
138
}
146
139
147
140
@ SuppressWarnings ("try" )
148
- private StructuredGraph buildGraph (ResolvedJavaMethod method , BytecodeProvider intrinsicBytecodeProvider , CanonicalizerPhase canonicalizer ) {
141
+ private StructuredGraph buildGraph (ResolvedJavaMethod method , CanonicalizerPhase canonicalizer ) {
149
142
StructuredGraph graphToEncode ;
150
143
/*
151
144
* Always parse graphs without assumptions, this is required when graphs are cached across
@@ -163,9 +156,6 @@ private StructuredGraph buildGraph(ResolvedJavaMethod method, BytecodeProvider i
163
156
build ();
164
157
// @formatter:on
165
158
try (DebugContext .Scope scope = debug .scope ("buildGraph" , graphToEncode ); DebugCloseable a = BuildGraphTimer .start (debug )) {
166
- if (intrinsicBytecodeProvider != null ) {
167
- throw GraalError .shouldNotReachHere ("isn't this dead?" ); // ExcludeFromJacocoGeneratedReport
168
- }
169
159
graphBuilderPhaseInstance .apply (graphToEncode );
170
160
canonicalizer .apply (graphToEncode , graphCacheProviders );
171
161
if (postParsingPhase != null ) {
@@ -177,14 +167,14 @@ private StructuredGraph buildGraph(ResolvedJavaMethod method, BytecodeProvider i
177
167
return graphToEncode ;
178
168
}
179
169
180
- @ SuppressWarnings ({ "unused" , " try"} )
181
- private EncodedGraph lookupOrCreatePersistentEncodedGraph (ResolvedJavaMethod method , BytecodeProvider intrinsicBytecodeProvider ) {
170
+ @ SuppressWarnings (" try" )
171
+ private EncodedGraph lookupOrCreatePersistentEncodedGraph (ResolvedJavaMethod method ) {
182
172
EncodedGraph result = persistentGraphCache .get (method );
183
173
if (result == null && method .hasBytecodes ()) {
184
174
try (AutoCloseable scope = createPersistentCachedGraphScope .get ()) {
185
175
// Encoded graphs creation must be wrapped by "scopes" provided by
186
176
// createCachedGraphScope.
187
- result = createGraph (method , intrinsicBytecodeProvider );
177
+ result = createGraph (method );
188
178
} catch (Throwable ex ) {
189
179
throw debug .handle (ex );
190
180
}
@@ -195,17 +185,22 @@ private EncodedGraph lookupOrCreatePersistentEncodedGraph(ResolvedJavaMethod met
195
185
196
186
@ Override
197
187
protected EncodedGraph lookupEncodedGraph (ResolvedJavaMethod method , BytecodeProvider intrinsicBytecodeProvider ) {
188
+ if (intrinsicBytecodeProvider != null ) {
189
+ // intrinsicBytecodeProvider is read from InlineInvokePlugin.InlineInfo#getIntrinsicBytecodeProvider which is always null because the only source is PartialEvaluator#asInlineInfo
190
+ throw GraalError .shouldNotReachHere ("dead path" ); // ExcludeFromJacocoGeneratedReport
191
+ }
192
+
198
193
EncodedGraph result = localGraphCache .get (method );
199
194
if (result != null ) {
200
195
return result ;
201
196
}
202
197
203
- result = lookupOrCreatePersistentEncodedGraph (method , intrinsicBytecodeProvider );
198
+ result = lookupOrCreatePersistentEncodedGraph (method );
204
199
// Cached graph from previous compilation may not have source positions, re-parse and
205
200
// store in compilation-local cache.
206
201
if (result != null && !result .trackNodeSourcePosition () && graph .trackNodeSourcePosition ()) {
207
202
assert method .hasBytecodes ();
208
- result = createGraph (method , intrinsicBytecodeProvider );
203
+ result = createGraph (method );
209
204
assert result .trackNodeSourcePosition ();
210
205
}
211
206
0 commit comments