# HG changeset patch # User Doug Simon # Date 1377266926 -7200 # Node ID 1688781c02387eb309e52895be99212aa820f5e7 # Parent 25161615539bd214358162c5e1109907d1c5b7ea# Parent 37446655527c0800ec9272155a20852fe0b2ae8b Merge. diff -r 25161615539b -r 1688781c0238 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Fri Aug 23 13:25:57 2013 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Fri Aug 23 16:08:46 2013 +0200 @@ -32,23 +32,32 @@ private final class IndentImpl implements Indent { + private static final String INDENTATION_INCREMENT = " "; + final String indent; boolean enabled; final IndentImpl parentIndent; IndentImpl(IndentImpl parentIndent, boolean enabled) { this.parentIndent = parentIndent; - this.indent = (parentIndent == null ? "" : parentIndent.indent + " "); + this.indent = (parentIndent == null ? "" : parentIndent.indent + INDENTATION_INCREMENT); this.enabled = enabled; } + private void printScopeName() { + if (logScopeName) { + if (parentIndent != null) { + parentIndent.printScopeName(); + } + output.println(indent + "[thread:" + Thread.currentThread().getId() + "] scope: " + qualifiedName); + logScopeName = false; + } + } + @Override public void log(String msg, Object... args) { if (enabled) { - if (logScopeName) { - output.println(indent + "scope: " + qualifiedName); - logScopeName = false; - } + printScopeName(); output.println(indent + String.format(msg, args)); lastUsedIndent = this; } @@ -86,13 +95,13 @@ private static DebugTimer scopeTime = Debug.timer("ScopeTime"); private final DebugScope parent; - private IndentImpl lastUsedIndent = null; - private boolean logScopeName = false; + private IndentImpl lastUsedIndent; + private boolean logScopeName; private Object[] context; - private DebugValueMap valueMap; - private String qualifiedName; + private final DebugValueMap valueMap; + private final String qualifiedName; private static final char SCOPE_SEP = '.'; @@ -123,10 +132,10 @@ this.context = context; this.qualifiedName = qualifiedName; if (parent != null) { - this.lastUsedIndent = new IndentImpl(parent.lastUsedIndent, parent.isLogEnabled()); + lastUsedIndent = new IndentImpl(parent.lastUsedIndent, parent.isLogEnabled()); logScopeName = !parent.qualifiedName.equals(qualifiedName); } else { - this.lastUsedIndent = new IndentImpl(null, false); + lastUsedIndent = new IndentImpl(null, false); logScopeName = true; } @@ -175,10 +184,7 @@ public void printf(String msg, Object... args) { if (isLogEnabled()) { - if (logScopeName) { - output.println("scope: " + qualifiedName); - logScopeName = false; - } + lastUsedIndent.printScopeName(); output.printf(msg, args); } } diff -r 25161615539b -r 1688781c0238 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Fri Aug 23 13:25:57 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Fri Aug 23 16:08:46 2013 +0200 @@ -48,7 +48,7 @@ */ public class ComputeProbabilityClosure { - private static final double EPSILON = Math.nextUp(0); + private static final double EPSILON = Double.MIN_NORMAL; private final StructuredGraph graph; private final NodesToDoubles nodeProbabilities; @@ -237,6 +237,7 @@ return false; } probability *= loopFrequency; + assert probability >= 0; } } for (Probability other : withStates) { @@ -248,9 +249,11 @@ return false; } prob *= loopFrequency; + assert prob >= 0; } } probability += prob; + assert probability >= 0; } loops = intersection; mergeLoops.put(merge, new HashSet<>(intersection));