diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/ProfileReplaySupport.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/ProfileReplaySupport.java index 53634e89cb56..3b0dfd7d5060 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/ProfileReplaySupport.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/ProfileReplaySupport.java @@ -38,6 +38,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -202,7 +203,10 @@ public String formatLamdaName(ResolvedJavaMethod m) { throw GraalError.shouldNotReachHere(String.format("No file for method %s found in %s, strict profiles, abort", s, loadDir)); // ExcludeFromJacocoGeneratedReport } } catch (IOException e) { - e.printStackTrace(); + boolean wasSet = profileReplayPrologueExceptionPrinted.getAndSet(true); + if (!wasSet) { + e.printStackTrace(); + } } } return new ProfileReplaySupport(lambdaNameFormatter, expectedResult, expectedCodeSignature, expectedGraphSignature, profileFilter, profileSaveFilter); @@ -210,6 +214,12 @@ public String formatLamdaName(ResolvedJavaMethod m) { return null; } + /** + * Guard to prevent flood of stack traces when CTRL-C'ing tasks such as + * {@code mx benchmark compile-all:fuzzedClasses}. + */ + private static final AtomicBoolean profileReplayPrologueExceptionPrinted = new AtomicBoolean(); + /** * Finishes a previously started profile record/replay (see {@link #profileReplayPrologue}. * Both, for record and replay, the method validates various expectations (see diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java index 20f288c9efde..efbf6dbda574 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java @@ -124,7 +124,7 @@ public static long compileMethod(long methodHandle, boolean useProfilingInfo, HotSpotResolvedJavaMethod method = runtime.unhand(HotSpotResolvedJavaMethod.class, methodHandle); HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, 0L); try (CompilationContext ignored = HotSpotGraalServices.openLocalCompilationContext(request)) { - CompilationTask task = new CompilationTask(runtime, compiler, request, useProfilingInfo, false, eagerResolving, installAsDefault); + CompilationTask task = new CompilationTask(runtime, compiler, request, useProfilingInfo, false, false, eagerResolving, installAsDefault); long allocatedBytesBefore = 0; long timeBefore = 0; if (timeAndMemConsumer != null) {