changeset 11380:d9bcf8789d57

Merge.
author Doug Simon <doug.simon@oracle.com>
date Tue, 20 Aug 2013 20:04:33 +0200
parents 0942e34b6c7d (current diff) 1a110b7c03e1 (diff)
children 001c41b01d13
files
diffstat 2 files changed, 45 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java	Tue Aug 20 18:23:43 2013 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java	Tue Aug 20 20:04:33 2013 +0200
@@ -48,7 +48,7 @@
  */
 public class ComputeProbabilityClosure {
 
-    private static final double EPSILON = 1d / Integer.MAX_VALUE;
+    private static final double EPSILON = Math.nextUp(0);
 
     private final StructuredGraph graph;
     private final NodesToDoubles nodeProbabilities;
@@ -191,11 +191,12 @@
                     }
                     backEdgeProb += nodeProbabilities.get(le) * factor;
                 }
-                double d = nodeProbabilities.get(loopBegin) - backEdgeProb;
-                if (d < EPSILON) {
+                double entryProb = nodeProbabilities.get(loopBegin);
+                double d = entryProb - backEdgeProb;
+                if (d <= EPSILON) {
                     d = EPSILON;
                 }
-                loopFrequency = nodeProbabilities.get(loopBegin) / d;
+                loopFrequency = entryProb / d;
                 loopBegin.setLoopFrequency(loopFrequency);
             }
             return loopFrequency;
--- a/mxtool/mx.py	Tue Aug 20 18:23:43 2013 +0200
+++ b/mxtool/mx.py	Tue Aug 20 20:04:33 2013 +0200
@@ -202,6 +202,9 @@
 
     def isLibrary(self):
         return isinstance(self, Library)
+    
+    def isProject(self):
+        return isinstance(self, Project)
 
 class Project(Dependency):
     def __init__(self, suite, name, srcDirs, deps, javaCompliance, workingSets, d):
@@ -233,18 +236,9 @@
             return deps
         for name in childDeps:
             assert name != self.name
-            dep = _libs.get(name, None)
-            if dep is not None:
-                if includeLibs and not dep in deps:
-                    deps.append(dep)
-            else:
-                dep = _projects.get(name, None)
-                if dep is None:
-                    if name in _opts.ignored_projects:
-                        abort('project named ' + name + ' required by ' + self.name + ' is ignored')
-                    abort('dependency named ' + name + ' required by ' + self.name + ' is not found')
-                if not dep in deps:
-                    dep.all_deps(deps, includeLibs=includeLibs, includeAnnotationProcessors=includeAnnotationProcessors)
+            dep = dependency(name)
+            if not dep in deps and (includeLibs or not dep.isLibrary()):
+                dep.all_deps(deps, includeLibs=includeLibs, includeAnnotationProcessors=includeAnnotationProcessors)
         if not self in deps and includeSelf:
             deps.append(self)
         return deps
@@ -468,6 +462,12 @@
         path = self.get_path(resolve)
         if exists(path) or not resolve:
             cp.append(path)
+            
+    def all_deps(self, deps, includeLibs, includeSelf=True, includeAnnotationProcessors=False):
+        if not includeLibs or not includeSelf:
+            return deps
+        deps.append(self)
+        return deps
 
 class Suite:
     def __init__(self, d, primary):
@@ -762,10 +762,12 @@
     """
     global _annotationProcessors
     if _annotationProcessors is None:
-        ap = set()
+        aps = set()
         for p in projects():
-            ap.update(p.annotation_processors())
-        _annotationProcessors = list(ap)
+            for ap in p.annotation_processors():
+                if project(ap, False):
+                    aps.add(ap)
+        _annotationProcessors = list(aps)
     return _annotationProcessors
 
 def distribution(name, fatalIfMissing=True):
@@ -778,6 +780,20 @@
         abort('distribution named ' + name + ' not found')
     return d
 
+def dependency(name, fatalIfMissing=True):
+    """
+    Get the project or library for a given name. This will abort if a project  or library does
+    not exist for 'name' and 'fatalIfMissing' is true.
+    """
+    d = _projects.get(name)
+    if d is None:
+        d = _libs.get(name)
+    if d is None and fatalIfMissing:
+        if name in _opts.ignored_projects:
+            abort('project named ' + name + ' is ignored')
+        abort('project or library named ' + name + ' not found')
+    return d
+
 def project(name, fatalIfMissing=True):
     """
     Get the project for a given name. This will abort if the named project does
@@ -812,7 +828,7 @@
 
 def classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=False):
     """
-    Get the class path for a list of given projects, resolving each entry in the
+    Get the class path for a list of given dependencies, resolving each entry in the
     path (e.g. downloading a missing library) if 'resolve' is true.
     """
     if names is None:
@@ -820,10 +836,9 @@
     else:
         deps = []
         if isinstance(names, types.StringTypes):
-            project(names).all_deps(deps, True, includeSelf)
-        else:
-            for n in names:
-                project(n).all_deps(deps, True, includeSelf)
+            names = [names]
+        for n in names:
+            dependency(n).all_deps(deps, True, includeSelf)
         result = _as_classpath(deps, resolve)
     if includeBootClasspath:
         result = os.pathsep.join([java().bootclasspath(), result])
@@ -2445,8 +2460,7 @@
             out.open('factorypath')
             out.element('factorypathentry', {'kind' : 'PLUGIN', 'id' : 'org.eclipse.jst.ws.annotations.core', 'enabled' : 'true', 'runInBatchMode' : 'false'})
             for ap in p.annotation_processors():
-                apProject = project(ap)
-                for dep in apProject.all_deps([], True):
+                for dep in dependency(ap).all_deps([], True):
                     if dep.isLibrary():
                         if not hasattr(dep, 'eclipse.container') and not hasattr(dep, 'eclipse.project'):
                             if dep.mustExist:
@@ -2817,10 +2831,10 @@
         annotationProcessorOnlyDeps = []
         if len(p.annotation_processors()) > 0:
             for ap in p.annotation_processors():
-                apProject = project(ap)
-                if not apProject in deps:
-                    deps.append(apProject)
-                    annotationProcessorOnlyDeps.append(apProject)
+                apDep = dependency(ap)
+                if not apDep in deps:
+                    deps.append(apDep)
+                    annotationProcessorOnlyDeps.append(apDep)
         
         annotationProcessorReferences = [];