Mercurial > hg > graal-compiler
changeset 16231:a47528fb2ea0
slight change to semantics of -G:NDCV option
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 25 Jun 2014 16:57:12 +0200 |
parents | 5f72421928e0 |
children | e34bb128f227 |
files | graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java Wed Jun 25 16:56:45 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java Wed Jun 25 16:57:12 2014 +0200 @@ -42,19 +42,22 @@ // The options below will be removed once all phases clean up their own dead code. + private static final int OFF = 0; + private static final int INFO = 1; + private static final int VERBOSE = 2; + private static final int FATAL = 3; + static class Options { // @formatter:off - @Option(help = "Enable NoDeadCodeVerifyHandler") - public static final OptionValue<Boolean> NDCV = new OptionValue<>(false); - @Option(help = "Issues caught by NoDeadCodeVerifyHandler raise an error") - public static final OptionValue<Boolean> NDCVFatal = new OptionValue<>(false); + @Option(help = "Run level for NoDeadCodeVerifyHandler (0 = off, 1 = info, 2 = verbose, 3 = fatal)") + public static final OptionValue<Integer> NDCV = new OptionValue<>(0); // @formatter:on } private static final Map<Class<?>, Boolean> discovered = new ConcurrentHashMap<>(); public void verify(Object object, Object... context) { - if (NDCV.getValue()) { + if (NDCV.getValue() != OFF) { StructuredGraph graph = extract(StructuredGraph.class, object); BasePhase<?> phase = extract(BasePhase.class, context); if (graph != null) { @@ -64,15 +67,19 @@ assert after.size() <= before.size(); if (before.size() != after.size()) { before.removeAll(after); - if (NDCVFatal.getValue() || discovered.put(phase.getClass(), Boolean.TRUE) == null) { + if (discovered.put(phase.getClass(), Boolean.TRUE) == null) { String message = extract(String.class, context); String prefix = message == null ? "" : message + ": "; String phaseClass = phase == null ? null : phase.getClass().getName(); GraalInternalError error = new GraalInternalError("%sfound dead nodes in %s (phase class=%s): %s", prefix, graph, phaseClass, before); - if (NDCVFatal.getValue()) { + 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; } - error.printStackTrace(System.out); } } }