changeset 22683:d55ce2fbf5f1

Configure lazy/eager snippets via system property to allow customization without source code change
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 22 Sep 2015 17:41:50 -0700
parents 015f88d8c03f
children f36a430db1c2
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Tue Sep 22 17:39:52 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Tue Sep 22 17:41:50 2015 -0700
@@ -74,10 +74,7 @@
  */
 public class SnippetTemplate {
 
-    // Checkstyle: stop
-    public static boolean LAZY_SNIPPETS = true;
-
-    // Checkstyle: resume
+    private static final boolean EAGER_SNIPPETS = Boolean.getBoolean("graal.snippets.eager");
 
     /**
      * Holds the {@link ResolvedJavaMethod} of the snippet, together with some information about the
@@ -528,10 +525,10 @@
             assert findMethod(declaringClass, methodName, method) == null : "found more than one method named " + methodName + " in " + declaringClass;
             ResolvedJavaMethod javaMethod = providers.getMetaAccess().lookupJavaMethod(method);
             providers.getReplacements().registerSnippet(javaMethod);
-            if (LAZY_SNIPPETS) {
+            if (EAGER_SNIPPETS) {
+                return new EagerSnippetInfo(javaMethod, privateLocations);
+            } else {
                 return new LazySnippetInfo(javaMethod, privateLocations);
-            } else {
-                return new EagerSnippetInfo(javaMethod, privateLocations);
             }
         }