changeset 20015:ae0e4453df73

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 23 Mar 2015 13:33:18 -0700
parents dab7f071220a (diff) 2d51a92a301a (current diff)
children e7e868a42b3f
files
diffstat 10 files changed, 72 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Assumptions.java	Mon Mar 23 20:57:21 2015 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Assumptions.java	Mon Mar 23 13:33:18 2015 -0700
@@ -57,7 +57,7 @@
 
         public AssumptionResult(T result, Assumption... assumptions) {
             this.result = result;
-            this.assumptions = assumptions.clone();
+            this.assumptions = assumptions;
         }
 
         public AssumptionResult(T result) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Mon Mar 23 20:57:21 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Mon Mar 23 13:33:18 2015 -0700
@@ -75,8 +75,10 @@
                        "The format for each option is the same as on the command line just without the '-G:' prefix.", type = OptionType.Debug)
         public static final OptionValue<String> CompileTheWorldConfig = new OptionValue<>(null);
 
-        @Option(help = "Last class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
+        @Option(help = "Run CTW using as many threads as there are processors on the system", type = OptionType.Debug)
         public static final OptionValue<Boolean> CompileTheWorldMultiThreaded = new OptionValue<>(false);
+        @Option(help = "Number of threads to use for multithreaded CTW.  Defaults to Runtime.getRuntime().availableProcessors()", type = OptionType.Debug)
+        public static final OptionValue<Integer> CompileTheWorldThreads = new OptionValue<>(0);
         // @formatter:on
 
         /**
@@ -158,6 +160,11 @@
     private boolean verbose;
     private final Config config;
 
+    /**
+     * Signal that the threads should start compiling in multithreaded mode.
+     */
+    private boolean running;
+
     private ThreadPoolExecutor threadPool;
 
     /**
@@ -240,8 +247,11 @@
                     return DebugEnvironment.initialize(System.out);
                 }
             });
-            int availableProcessors = Runtime.getRuntime().availableProcessors();
-            threadPool = new ThreadPoolExecutor(availableProcessors, availableProcessors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
+            int threadCount = Options.CompileTheWorldThreads.getValue();
+            if (threadCount == 0) {
+                threadCount = Runtime.getRuntime().availableProcessors();
+            }
+            threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
         }
 
         try (OverrideScope s = config.apply()) {
@@ -322,6 +332,7 @@
         }
 
         if (threadPool != null) {
+            startThreads();
             while (threadPool.getCompletedTaskCount() != threadPool.getTaskCount()) {
                 System.out.println("CompileTheWorld : Waiting for " + (threadPool.getTaskCount() - threadPool.getCompletedTaskCount()) + " compiles");
                 try {
@@ -339,6 +350,21 @@
                         compileTime.get(), memoryUsed.get());
     }
 
+    private synchronized void startThreads() {
+        running = true;
+        // Wake up any waiting threads
+        notifyAll();
+    }
+
+    private synchronized void waitToRun() {
+        while (!running) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
     class CTWCompilationTask extends CompilationTask {
 
         CTWCompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method) {
@@ -359,6 +385,7 @@
         if (threadPool != null) {
             threadPool.submit(new Runnable() {
                 public void run() {
+                    waitToRun();
                     try (OverrideScope s = config.apply()) {
                         compileMethod(method, classFileCounter);
                     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java	Mon Mar 23 20:57:21 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java	Mon Mar 23 13:33:18 2015 -0700
@@ -160,8 +160,9 @@
                 if (leafConcreteSubtype != null) {
                     assert !leafConcreteSubtype.getResult().equals(implementor);
                     AssumptionResult<ResolvedJavaType> newResult = new AssumptionResult<>(leafConcreteSubtype.getResult(), new ConcreteSubtype(this, implementor));
+                    // Accumulate leaf assumptions and return the combined result.
                     newResult.add(leafConcreteSubtype);
-                    return leafConcreteSubtype;
+                    return newResult;
                 }
                 return null;
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Mon Mar 23 20:57:21 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Mon Mar 23 13:33:18 2015 -0700
@@ -781,6 +781,8 @@
                 }
             }
         }
+        transferProxies(trueSuccessor(), trueMerge);
+        transferProxies(falseSuccessor(), falseMerge);
 
         cleanupMerge(tool, merge);
         cleanupMerge(tool, trueMerge);
@@ -789,6 +791,14 @@
         return true;
     }
 
+    private static void transferProxies(AbstractBeginNode successor, MergeNode falseMerge) {
+        if (falseMerge != null) {
+            for (ProxyNode proxy : successor.proxies().snapshot()) {
+                proxy.replaceFirstInput(successor, falseMerge);
+            }
+        }
+    }
+
     private void cleanupMerge(SimplifierTool tool, MergeNode merge) {
         if (merge != null && merge.isAlive()) {
             if (merge.forwardEndCount() == 0) {
--- a/mx/mx_graal.py	Mon Mar 23 20:57:21 2015 +0100
+++ b/mx/mx_graal.py	Mon Mar 23 13:33:18 2015 -0700
@@ -1434,7 +1434,7 @@
     def __init__(self, title, tasks=None):
         self.tasks = tasks
         self.title = title
-        self.skipped = Task.filters is not None and not any([f in title for f in Task.filters])
+        self.skipped = tasks is not None and Task.filters is not None and not any([f in title for f in Task.filters])
         if not self.skipped:
             self.start = time.time()
             self.end = None
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml	Mon Mar 23 20:57:21 2015 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml	Mon Mar 23 13:33:18 2015 -0700
@@ -40,6 +40,14 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.39.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
                     <code-name-base>org.openide.explorer</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/genfiles.properties	Mon Mar 23 20:57:21 2015 +0100
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/genfiles.properties	Mon Mar 23 13:33:18 2015 -0700
@@ -1,5 +1,5 @@
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=09ba2a87
+nbproject/build-impl.xml.data.CRC32=5b8e8a60
 nbproject/build-impl.xml.script.CRC32=e4293f0e
 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/project.xml	Mon Mar 23 20:57:21 2015 +0100
+++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/project.xml	Mon Mar 23 13:33:18 2015 -0700
@@ -47,6 +47,14 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.39.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
                     <code-name-base>org.openide.dialogs</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
--- a/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties	Mon Mar 23 20:57:21 2015 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties	Mon Mar 23 13:33:18 2015 -0700
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=79002a09
+build.xml.data.CRC32=92ea213f
 build.xml.script.CRC32=3534d355
-build.xml.stylesheet.CRC32=a56c6a5b@2.62.1
+build.xml.stylesheet.CRC32=a56c6a5b@2.67.1
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=79002a09
+nbproject/build-impl.xml.data.CRC32=92ea213f
 nbproject/build-impl.xml.script.CRC32=2867f2d5
 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
--- a/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml	Mon Mar 23 20:57:21 2015 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml	Mon Mar 23 13:33:18 2015 -0700
@@ -23,6 +23,14 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.39.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
                     <code-name-base>org.openide.nodes</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>