Mercurial > hg > truffle
changeset 16301:b741f44cb277
filter out subsequent reports for phases that don't clean up their own dead nodes
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 30 Jun 2014 17:47:45 +0200 |
parents | 8da760bd1575 |
children | fb90ad461cdb |
files | graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java |
diffstat | 1 files changed, 21 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java Mon Jun 30 17:28:53 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java Mon Jun 30 17:47:45 2014 +0200 @@ -25,6 +25,7 @@ import static com.oracle.graal.printer.NoDeadCodeVerifyHandler.Options.*; import java.util.*; +import java.util.concurrent.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.debug.*; @@ -52,6 +53,12 @@ // @formatter:on } + /** + * Only the first instance of failure at any point is shown. This will also be removed once all + * phases clean up their own dead code. + */ + private static final Map<String, Boolean> discovered = new ConcurrentHashMap<>(); + public void verify(Object object, String message) { if (NDCV.getValue() != OFF && object instanceof StructuredGraph) { StructuredGraph graph = (StructuredGraph) object; @@ -60,16 +67,20 @@ List<Node> after = graph.getNodes().snapshot(); assert after.size() <= before.size(); if (before.size() != after.size()) { - before.removeAll(after); - String prefix = message == null ? "" : message + ": "; - GraalInternalError error = new GraalInternalError("%sfound dead nodes in %s: %s", prefix, graph, before); - if (NDCV.getValue() == INFO) { - System.out.println(error.getMessage()); - } else if (NDCV.getValue() == VERBOSE) { - error.printStackTrace(System.out); - } else { - assert NDCV.getValue() == FATAL; - throw error; + if (discovered.put(message, Boolean.TRUE) == null) { + System.out.println("MESSAGE: " + message); + + before.removeAll(after); + String prefix = message == null ? "" : message + ": "; + GraalInternalError error = new GraalInternalError("%sfound dead nodes in %s: %s", prefix, graph, before); + if (NDCV.getValue() == INFO) { + System.out.println(error.getMessage()); + } else if (NDCV.getValue() == VERBOSE) { + error.printStackTrace(System.out); + } else { + assert NDCV.getValue() == FATAL; + throw error; + } } } }