src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java

Print this page

        

*** 25,40 **** import static jdk.vm.ci.common.InitTimer.timer; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; import static org.graalvm.compiler.core.common.GraalOptions.HotSpotPrintInlining; ! import static org.graalvm.compiler.debug.GraalDebugConfig.areScopedGlobalMetricsEnabled; ! import static org.graalvm.compiler.debug.GraalDebugConfig.Options.DebugValueSummary; ! import static org.graalvm.compiler.debug.GraalDebugConfig.Options.Dump; ! import static org.graalvm.compiler.debug.GraalDebugConfig.Options.Log; ! import static org.graalvm.compiler.debug.GraalDebugConfig.Options.MethodFilter; ! import static org.graalvm.compiler.debug.GraalDebugConfig.Options.Verify; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.lang.management.ManagementFactory; --- 25,35 ---- import static jdk.vm.ci.common.InitTimer.timer; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; import static org.graalvm.compiler.core.common.GraalOptions.HotSpotPrintInlining; ! import static org.graalvm.compiler.debug.DebugContext.DEFAULT_LOG_STREAM; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.lang.management.ManagementFactory;
*** 52,69 **** import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; import org.graalvm.compiler.api.runtime.GraalRuntime; import org.graalvm.compiler.core.common.GraalOptions; import org.graalvm.compiler.core.target.Backend; ! import org.graalvm.compiler.debug.Debug; ! import org.graalvm.compiler.debug.DebugEnvironment; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.debug.TTY; - import org.graalvm.compiler.debug.internal.DebugValuesPrinter; - import org.graalvm.compiler.debug.internal.method.MethodMetricsPrinter; import org.graalvm.compiler.hotspot.CompilationStatistics.Options; import org.graalvm.compiler.hotspot.CompilerConfigurationFactory.BackendMap; import org.graalvm.compiler.hotspot.debug.BenchmarkCounters; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.nodes.spi.StampProvider; --- 47,65 ---- import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; import org.graalvm.compiler.api.runtime.GraalRuntime; + import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.GraalOptions; import org.graalvm.compiler.core.target.Backend; ! import org.graalvm.compiler.debug.DebugHandlersFactory; ! import org.graalvm.compiler.debug.DebugContext; ! import org.graalvm.compiler.debug.DebugContext.Description; ! import org.graalvm.compiler.debug.GlobalMetrics; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.debug.TTY; import org.graalvm.compiler.hotspot.CompilationStatistics.Options; import org.graalvm.compiler.hotspot.CompilerConfigurationFactory.BackendMap; import org.graalvm.compiler.hotspot.debug.BenchmarkCounters; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.nodes.spi.StampProvider;
*** 102,112 **** assert getArrayIndexScale(JavaKind.Double) == 8; return true; } private final HotSpotBackend hostBackend; ! private DebugValuesPrinter debugValuesPrinter; private final List<SnippetCounter.Group> snippetCounterGroups; private final EconomicMap<Class<? extends Architecture>, HotSpotBackend> backends = EconomicMap.create(Equivalence.IDENTITY); private final GraalHotSpotVMConfig config; --- 98,108 ---- assert getArrayIndexScale(JavaKind.Double) == 8; return true; } private final HotSpotBackend hostBackend; ! private final GlobalMetrics metricValues = new GlobalMetrics(); private final List<SnippetCounter.Group> snippetCounterGroups; private final EconomicMap<Class<? extends Architecture>, HotSpotBackend> backends = EconomicMap.create(Equivalence.IDENTITY); private final GraalHotSpotVMConfig config;
*** 161,220 **** try (InitTimer t = timer("create backend:", gpuArchitecture)) { registerBackend(factory.createBackend(this, compilerConfiguration, null, hostBackend)); } } - if (Log.getValue(options) == null && !areScopedGlobalMetricsEnabled(options) && Dump.getValue(options) == null && Verify.getValue(options) == null) { - if (MethodFilter.getValue(options) != null && !Debug.isEnabled()) { - TTY.println("WARNING: Ignoring MethodFilter option since Log, Meter, Time, TrackMemUse, Dump and Verify options are all null"); - } - } - - if (Debug.isEnabled()) { - DebugEnvironment.ensureInitialized(options, hostBackend.getProviders().getSnippetReflection()); - - String summary = DebugValueSummary.getValue(options); - if (summary != null) { - switch (summary) { - case "Name": - case "Partial": - case "Complete": - case "Thread": - break; - default: - throw new GraalError("Unsupported value for DebugSummaryValue: %s", summary); - } - } - } - - if (Debug.areUnconditionalCountersEnabled() || Debug.areUnconditionalTimersEnabled() || Debug.areUnconditionalMethodMetricsEnabled() || - (Debug.isEnabled() && areScopedGlobalMetricsEnabled(options)) || (Debug.isEnabled() && Debug.isMethodFilteringEnabled())) { - // This must be created here to avoid loading the DebugValuesPrinter class - // during shutdown() which in turn can cause a deadlock - int mmPrinterType = 0; - mmPrinterType |= MethodMetricsPrinter.Options.MethodMeterPrintAscii.getValue(options) ? 1 : 0; - mmPrinterType |= MethodMetricsPrinter.Options.MethodMeterFile.getValue(options) != null ? 2 : 0; - switch (mmPrinterType) { - case 0: - debugValuesPrinter = new DebugValuesPrinter(); - break; - case 1: - debugValuesPrinter = new DebugValuesPrinter(new MethodMetricsPrinter.MethodMetricsASCIIPrinter(TTY.out)); - break; - case 2: - debugValuesPrinter = new DebugValuesPrinter(new MethodMetricsPrinter.MethodMetricsCSVFilePrinter()); - break; - case 3: - debugValuesPrinter = new DebugValuesPrinter( - new MethodMetricsPrinter.MethodMetricsCompositePrinter(new MethodMetricsPrinter.MethodMetricsCSVFilePrinter(), - new MethodMetricsPrinter.MethodMetricsASCIIPrinter(TTY.out))); - break; - default: - break; - } - } - // Complete initialization of backends try (InitTimer st = timer(hostBackend.getTarget().arch.getName(), ".completeInitialization")) { hostBackend.completeInitialization(jvmciRuntime, options); } for (HotSpotBackend backend : backends.getValues()) { --- 157,166 ----
*** 260,269 **** --- 206,221 ---- public GraalHotSpotVMConfig getVMConfig() { return config; } @Override + public DebugContext openDebugContext(OptionValues compilationOptions, CompilationIdentifier compilationId, Object compilable, Iterable<DebugHandlersFactory> factories) { + Description description = new Description(compilable, compilationId.toString(CompilationIdentifier.Verbosity.ID)); + return DebugContext.create(compilationOptions, description, metricValues, DEFAULT_LOG_STREAM, factories); + } + + @Override public OptionValues getOptions() { return mBean.optionsFor(options, null); } @Override
*** 328,340 **** } } void shutdown() { shutdown = true; ! if (debugValuesPrinter != null) { ! debugValuesPrinter.printDebugValues(options); ! } phaseTransition("final"); if (snippetCounterGroups != null) { for (Group group : snippetCounterGroups) { TTY.out().out().println(group); --- 280,291 ---- } } void shutdown() { shutdown = true; ! metricValues.print(options); ! phaseTransition("final"); if (snippetCounterGroups != null) { for (Group group : snippetCounterGroups) { TTY.out().out().println(group);
*** 343,356 **** BenchmarkCounters.shutdown(runtime(), options, runtimeStartTime); archiveAndDeleteOutputDirectory(); } ! void clearMeters() { ! if (debugValuesPrinter != null) { ! debugValuesPrinter.clearDebugValues(); ! } } private final boolean bootstrapJVMCI; private boolean bootstrapFinished; --- 294,305 ---- BenchmarkCounters.shutdown(runtime(), options, runtimeStartTime); archiveAndDeleteOutputDirectory(); } ! void clearMetrics() { ! metricValues.clear(); } private final boolean bootstrapJVMCI; private boolean bootstrapFinished;
*** 447,465 **** return FileVisitResult.CONTINUE; } }); TTY.println("Graal diagnostic output saved in %s", zip); } catch (IOException e) { ! TTY.printf("IO error archiving %s:%n", dir); ! e.printStackTrace(TTY.out); } for (Path p : toDelete) { try { Files.delete(p); } catch (IOException e) { ! TTY.printf("IO error deleting %s:%n", p); ! e.printStackTrace(TTY.out); } } } outputDirectory = DELETED_OUTPUT_DIRECTORY; } --- 396,412 ---- return FileVisitResult.CONTINUE; } }); TTY.println("Graal diagnostic output saved in %s", zip); } catch (IOException e) { ! TTY.printf("IO error archiving %s:%n%s%n", dir, e); } for (Path p : toDelete) { try { Files.delete(p); } catch (IOException e) { ! TTY.printf("IO error deleting %s:%n%s%n", p, e); } } } outputDirectory = DELETED_OUTPUT_DIRECTORY; }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File