Mercurial > hg > graal-compiler
changeset 12712:882a0aadfed6
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 07 Nov 2013 20:55:13 +0100 |
parents | fb4658e16b5d (current diff) 3b2b8a71d10d (diff) |
children | 8716b7ceef94 71991b7a0f14 |
files | |
diffstat | 5 files changed, 68 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Thu Nov 07 20:47:11 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Thu Nov 07 20:55:13 2013 +0100 @@ -54,6 +54,8 @@ public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name"); @Option(help = "Omit reporting 0-value metrics") public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(false); + @Option(help = "Report and reset metrics after bootstrapping") + public static final OptionValue<Boolean> ResetDebugValuesAfterBootstrap = new OptionValue<>(true); @Option(help = "Send Graal IR to dump handlers on error") public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false); @Option(help = "Enable expensive assertions")
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java Thu Nov 07 20:47:11 2013 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java Thu Nov 07 20:55:13 2013 +0100 @@ -55,6 +55,15 @@ } } + public void reset() { + Arrays.fill(values, 0L); + if (children != null) { + for (DebugValueMap child : children) { + child.reset(); + } + } + } + private void ensureSize(int index) { if (values == null) { values = new long[index + 1];
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Nov 07 20:47:11 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Nov 07 20:55:13 2013 +0100 @@ -323,6 +323,9 @@ } } while ((System.currentTimeMillis() - startTime) <= TimedBootstrap.getValue()); + if (ResetDebugValuesAfterBootstrap.getValue()) { + printDebugValues("bootstrap", true); + } phaseTransition("bootstrap"); bootstrapRunning = false; @@ -368,6 +371,25 @@ CompilationTask.withinEnqueue.set(Boolean.FALSE); } + printDebugValues(ResetDebugValuesAfterBootstrap.getValue() ? "application" : null, false); + phaseTransition("final"); + + if (runtime.getConfig().ciTime) { + parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond", System.out); + inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond", System.out); + } + + SnippetCounter.printGroups(TTY.out().out()); + BenchmarkCounters.shutdown(runtime.getCompilerToVM(), compilerStartTime); + } + + private void printDebugValues(String phase, boolean reset) throws GraalInternalError { + TTY.println(); + if (phase != null) { + TTY.println("<DebugValues:" + phase + ">"); + } else { + TTY.println("<DebugValues>"); + } if (Debug.isEnabled() && areMetricsOrTimersEnabled()) { List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps(); List<DebugValue> debugValues = KeyRegistry.getDebugValues(); @@ -414,16 +436,17 @@ throw new GraalInternalError("Unknown summary type: %s", summary); } } + if (reset) { + for (DebugValueMap topLevelMap : topLevelMaps) { + topLevelMap.reset(); + } + } + if (phase != null) { + TTY.println("</DebugValues:" + phase + ">"); + } else { + TTY.println("</DebugValues>"); + } } - phaseTransition("final"); - - if (runtime.getConfig().ciTime) { - parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond", System.out); - inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond", System.out); - } - - SnippetCounter.printGroups(TTY.out().out()); - BenchmarkCounters.shutdown(runtime.getCompilerToVM(), compilerStartTime); } private void flattenChildren(DebugValueMap map, DebugValueMap globalMap) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Nov 07 20:47:11 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Nov 07 20:55:13 2013 +0100 @@ -79,14 +79,21 @@ this.snippetTemplateCache = new HashMap<>(); } + private static final boolean UseSnippetGraphCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetGraphCache", "true")); + public StructuredGraph getSnippet(ResolvedJavaMethod method) { assert method.getAnnotation(Snippet.class) != null : "Snippet must be annotated with @" + Snippet.class.getSimpleName(); assert !Modifier.isAbstract(method.getModifiers()) && !Modifier.isNative(method.getModifiers()) : "Snippet must not be abstract or native"; - StructuredGraph graph = graphs.get(method); + StructuredGraph graph = UseSnippetGraphCache ? graphs.get(method) : null; if (graph == null) { - graphs.putIfAbsent(method, makeGraph(method, null, inliningPolicy(method), method.getAnnotation(Snippet.class).removeAllFrameStates())); + StructuredGraph newGraph = makeGraph(method, null, inliningPolicy(method), method.getAnnotation(Snippet.class).removeAllFrameStates()); + if (UseSnippetGraphCache) { + return newGraph; + } + graphs.putIfAbsent(method, newGraph); graph = graphs.get(method); + } return graph; }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Nov 07 20:47:11 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Nov 07 20:55:13 2013 +0100 @@ -335,6 +335,10 @@ private static final DebugTimer SnippetCreationAndSpecialization = Debug.timer("SnippetCreationAndSpecialization"); private static final DebugMetric SnippetSpecializations = Debug.metric("SnippetSpecializations"); + private static final DebugMetric SnippetSpecializationsNodeCount = Debug.metric("SnippetSpecializationsNodeCount"); + private static final DebugMetric SnippetGraphsNodeCount = Debug.metric("SnippetGraphsNodeCount"); + + private static final boolean UseSnippetTemplateCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetTemplateCache", "true")); /** * Base class for snippet classes. It provides a cache for {@link SnippetTemplate}s. @@ -348,7 +352,11 @@ protected AbstractTemplates(Providers providers, TargetDescription target) { this.providers = providers; this.target = target; - this.templates = new ConcurrentHashMap<>(); + if (UseSnippetTemplateCache) { + this.templates = new ConcurrentHashMap<>(); + } else { + this.templates = null; + } } /** @@ -372,7 +380,7 @@ * Gets a template for a given key, creating it first if necessary. */ protected SnippetTemplate template(final Arguments args) { - SnippetTemplate template = templates.get(args.cacheKey); + SnippetTemplate template = UseSnippetTemplateCache ? templates.get(args.cacheKey) : null; if (template == null) { SnippetSpecializations.increment(); try (TimerCloseable a = SnippetCreationAndSpecialization.start()) { @@ -383,7 +391,9 @@ return new SnippetTemplate(providers, args); } }); - templates.put(args.cacheKey, template); + if (UseSnippetTemplateCache) { + templates.put(args.cacheKey, template); + } } } return template; @@ -410,6 +420,7 @@ */ protected SnippetTemplate(final Providers providers, Arguments args) { StructuredGraph snippetGraph = providers.getReplacements().getSnippet(args.info.method); + SnippetGraphsNodeCount.add(snippetGraph.getNodeCount()); ResolvedJavaMethod method = snippetGraph.method(); Signature signature = method.getSignature(); @@ -596,6 +607,8 @@ this.deoptNodes = curDeoptNodes; this.stampNodes = curStampNodes; this.returnNode = retNode; + + SnippetSpecializationsNodeCount.add(nodes.size()); } private static boolean checkAllVarargPlaceholdersAreDeleted(int parameterCount, VarargsPlaceholderNode[] placeholders) {