Mercurial > hg > graal-jvmci-8
changeset 17273:43655130d0ab
Truffle: added a performance warning for number of nodes in a single Truffle cache entry.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 30 Sep 2014 19:00:46 +0200 |
parents | 9eb112c9337d |
children | 5c55441b4c62 |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetLog.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java |
diffstat | 4 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetLog.java Tue Sep 30 15:26:07 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetLog.java Tue Sep 30 19:00:46 2014 +0200 @@ -270,6 +270,10 @@ } + public static void logPerformanceWarning(String details, Map<String, Object> properties) { + log(0, "perf warn", details, properties); + } + static void log(int indent, String msg, String details, Map<String, Object> properties) { StringBuilder sb = new StringBuilder(); sb.append(String.format("[truffle] %-16s ", msg));
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Tue Sep 30 15:26:07 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Tue Sep 30 19:00:46 2014 +0200 @@ -61,6 +61,7 @@ import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.nodes.Node.Child; import com.oracle.truffle.api.nodes.Node.Children; +import static com.oracle.graal.truffle.OptimizedCallTargetLog.*; /** * Class performing the partial evaluation starting from the root node of an AST. @@ -280,8 +281,7 @@ InliningDecision decision = inlining.findByCall(callNode); if (decision == null) { if (TruffleCompilerOptions.PrintTrufflePerformanceWarnings.getValue()) { - OptimizedCallTargetLog.log(0, "perf warn", String.format( - "%s '%s' is reached using partial evaluation but it is not reachable in the Truffle AST. Did you miss @%s or @%s annotation on a node field?. ", + logPerformanceWarning(String.format("%s '%s' is reached using partial evaluation but it is not reachable in the Truffle AST. Did you miss @%s or @%s annotation on a node field?. ", DirectCallNode.class.getSimpleName(), callNode, Child.class.getSimpleName(), Children.class.getSimpleName()), callNode.getRootNode().getDebugProperties()); } return null; @@ -296,7 +296,7 @@ OptimizedCallTarget currentTarget = decision.getProfile().getCallNode().getCurrentCallTarget(); if (decision.getTarget() != currentTarget) { if (TruffleCompilerOptions.PrintTrufflePerformanceWarnings.getValue()) { - OptimizedCallTargetLog.log(0, "perf warn", + logPerformanceWarning( String.format("CallTarget '%s' changed to '%s' during compilation for call node '%s'. Call node was not inlined.", decision.getTarget(), currentTarget, callNode), null); }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Tue Sep 30 15:26:07 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Tue Sep 30 19:00:46 2014 +0200 @@ -196,6 +196,16 @@ } } + if (TruffleCompilerOptions.PrintTrufflePerformanceWarnings.getValue()) { + int warnNodeCount = TruffleCompilerOptions.TrufflePerformanceWarningGraalNodeCount.getValue(); + if (graph.getNodeCount() > warnNodeCount) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("nodeCount", graph.getNodeCount()); + map.put("method", method.toString()); + OptimizedCallTargetLog.logPerformanceWarning(String.format("Method on fast path contains more than %d graal nodes.", warnNodeCount), map); + } + } + cache.put(key, graph); if (TruffleCompilerOptions.TraceTruffleCacheDetails.getValue()) { TTY.println(String.format("[truffle] added to graph cache method %s with %d nodes.", method, graph.getNodeCount()));
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Tue Sep 30 15:26:07 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Tue Sep 30 19:00:46 2014 +0200 @@ -68,6 +68,9 @@ @Option(help = "Allow inlining of less hot candidates if tree size is small") public static final OptionValue<Integer> TruffleInliningTrivialSize = new OptionValue<>(10); + @Option(help = "Defines the number of graal nodes that triggers a performance warning.") + public static final OptionValue<Integer> TrufflePerformanceWarningGraalNodeCount = new OptionValue<>(1000); + @Option(help = "Enable call target splitting") public static final OptionValue<Boolean> TruffleSplitting = new OptionValue<>(true); @Option(help = "Experimental: Enable the new version of truffle splitting.")