changeset 12745:31ed7cd96914

made SnippetGraphNodeCount count the right thing; re-enable prepared snippet graph caching by default
author Doug Simon <doug.simon@oracle.com>
date Sun, 10 Nov 2013 17:55:12 +0100
parents 41f0bd213b51
children a7eee87c7897
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sun Nov 10 14:37:39 2013 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sun Nov 10 17:55:12 2013 +0100
@@ -83,6 +83,8 @@
     private static final boolean UseSnippetGraphCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetGraphCache", "true"));
     private static final DebugTimer SnippetPreparationTime = Debug.timer("SnippetPreparationTime");
 
+    private static final DebugMetric SnippetGraphsNodeCount = Debug.metric("SnippetGraphsNodeCount");
+
     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";
@@ -91,7 +93,8 @@
         if (graph == null) {
             try (TimerCloseable a = SnippetPreparationTime.start()) {
                 StructuredGraph newGraph = makeGraph(method, null, inliningPolicy(method), method.getAnnotation(Snippet.class).removeAllFrameStates());
-                if (UseSnippetGraphCache) {
+                SnippetGraphsNodeCount.add(newGraph.getNodeCount());
+                if (!UseSnippetGraphCache) {
                     return newGraph;
                 }
                 graphs.putIfAbsent(method, newGraph);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sun Nov 10 14:37:39 2013 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sun Nov 10 17:55:12 2013 +0100
@@ -361,7 +361,6 @@
     private static final DebugTimer SnippetTemplateCreationTime = Debug.timer("SnippetTemplateCreationTime");
     private static final DebugMetric SnippetTemplates = Debug.metric("SnippetTemplateCount");
     private static final DebugMetric SnippetTemplatesNodeCount = Debug.metric("SnippetTemplatesNodeCount");
-    private static final DebugMetric SnippetGraphsNodeCount = Debug.metric("SnippetGraphsNodeCount");
 
     private static final String MAX_TEMPLATES_PER_SNIPPET_PROPERTY_NAME = "graal.maxTemplatesPerSnippet";
     private static final boolean UseSnippetTemplateCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetTemplateCache", "true"));
@@ -472,7 +471,6 @@
      */
     protected SnippetTemplate(final Providers providers, Arguments args) {
         StructuredGraph snippetGraph = providers.getReplacements().getSnippet(args.info.method);
-        SnippetGraphsNodeCount.add(snippetGraph.getNodeCount());
         instantiationTimer = Debug.timer(debugValueName("SnippetTemplateInstantiationTime", args));
         instantiationCounter = Debug.metric(debugValueName("SnippetTemplateInstantiationCount", args));