File tree Expand file tree Collapse file tree 4 files changed +29
-15
lines changed
compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp Expand file tree Collapse file tree 4 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -73,4 +73,11 @@ public interface CompilationProxies {
73
73
* @return a debug closeable object representing the debug context
74
74
*/
75
75
DebugCloseable withDebugContext (DebugContext debugContext );
76
+
77
+ /**
78
+ * Enters the context of a method compilation.
79
+ *
80
+ * @return a scope for the context
81
+ */
82
+ DebugCloseable enterCompilationContext ();
76
83
}
Original file line number Diff line number Diff line change @@ -139,11 +139,7 @@ public List<OperationRecorder.RecordedOperation> collectOperationsForSerializati
139
139
return recorder .getCurrentRecordedOperations ();
140
140
}
141
141
142
- /**
143
- * Enters the context of a method compilation for the current compilation thread.
144
- *
145
- * @return a scope for the context
146
- */
142
+ @ Override
147
143
public DebugCloseable enterCompilationContext () {
148
144
return recorder .enterCompilationContext ();
149
145
}
Original file line number Diff line number Diff line change 41
41
import jdk .graal .compiler .debug .GlobalMetrics ;
42
42
import jdk .graal .compiler .debug .GraalError ;
43
43
import jdk .graal .compiler .debug .TimerKey ;
44
+ import jdk .graal .compiler .hotspot .CompilationContext ;
45
+ import jdk .graal .compiler .hotspot .HotSpotGraalServices ;
44
46
import jdk .graal .compiler .hotspot .Platform ;
45
47
import jdk .graal .compiler .hotspot .replaycomp .proxy .CompilationProxy ;
46
48
import jdk .graal .compiler .hotspot .replaycomp .proxy .CompilationProxyBase ;
@@ -222,6 +224,17 @@ public DebugCloseable withDebugContext(DebugContext debugContext) {
222
224
};
223
225
}
224
226
227
+ @ Override
228
+ public DebugCloseable enterCompilationContext () {
229
+ // The handles created during replay are cached across compilations.
230
+ CompilationContext context = HotSpotGraalServices .enterGlobalCompilationContext ();
231
+ if (context == null ) {
232
+ return DebugCloseable .VOID_CLOSEABLE ;
233
+ } else {
234
+ return context ::close ;
235
+ }
236
+ }
237
+
225
238
/**
226
239
* Loads the recorded operations from a collection.
227
240
*
Original file line number Diff line number Diff line change @@ -263,18 +263,16 @@ public DebugCloseable withDebugContext(DebugContext debug) {
263
263
* @return a debug closeable that should be closed after the compilation
264
264
*/
265
265
public DebugCloseable enterCompilationContext (HotSpotCompilationRequest originalRequest , OptionValues initialOptions ) {
266
- if ( proxies instanceof RecordingCompilationProxies recordingCompilationProxies ) {
267
- DebugCloseable context = recordingCompilationProxies . enterCompilationContext ();
268
- return () -> {
269
- try {
266
+ DebugCloseable context = proxies . enterCompilationContext ();
267
+ return () -> {
268
+ try {
269
+ if ( proxies instanceof RecordingCompilationProxies ) {
270
270
serializeRecordedCompilation (originalRequest , initialOptions );
271
- } finally {
272
- context .close ();
273
271
}
274
- };
275
- } else {
276
- return DebugCloseable . VOID_CLOSEABLE ;
277
- }
272
+ } finally {
273
+ context . close ();
274
+ }
275
+ };
278
276
}
279
277
280
278
private void serializeRecordedCompilation (HotSpotCompilationRequest originalRequest , OptionValues initialOptions ) {
You can’t perform that action at this time.
0 commit comments