# HG changeset patch # User Doug Simon # Date 1383845682 -3600 # Node ID bb5fa27daa2038b2f21c1776bb509b81a759ce02 # Parent 001b8429afc38c3a7cc24aa3154302607f5b2eaf added ability to disable snippet graph preparation cache (-Dgraal.useSnippetGraphCache=false) diff -r 001b8429afc3 -r bb5fa27daa20 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Nov 07 18:33:01 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Nov 07 18:34:42 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; }