changeset 11406:1688781c0238

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 23 Aug 2013 16:08:46 +0200
parents 25161615539b 37446655527c
children 821ed0a436f2
files
diffstat 2 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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);
         }
     }
--- 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));