# HG changeset patch # User Tom Rodriguez # Date 1427142798 25200 # Node ID ae0e4453df73ffcbeac1f59f463da0b8cf30f73e # Parent dab7f071220a7b0cc723d57eb4a8de3f240bad6c# Parent 2d51a92a301abb85b64444b988c37887a2e314ec Merge diff -r 2d51a92a301a -r ae0e4453df73 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Assumptions.java --- 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) { diff -r 2d51a92a301a -r ae0e4453df73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- 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 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 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 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(), factory); + int threadCount = Options.CompileTheWorldThreads.getValue(); + if (threadCount == 0) { + threadCount = Runtime.getRuntime().availableProcessors(); + } + threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), 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); } diff -r 2d51a92a301a -r ae0e4453df73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java --- 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 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; } diff -r 2d51a92a301a -r ae0e4453df73 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- 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) { diff -r 2d51a92a301a -r ae0e4453df73 mx/mx_graal.py --- 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 diff -r 2d51a92a301a -r ae0e4453df73 src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml --- 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 @@ + org.openide.awt + + + + 7.39.1 + + + org.openide.explorer diff -r 2d51a92a301a -r ae0e4453df73 src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/genfiles.properties --- 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 diff -r 2d51a92a301a -r ae0e4453df73 src/share/tools/IdealGraphVisualizer/FilterWindow/nbproject/project.xml --- 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 @@ + org.openide.awt + + + + 7.39.1 + + + org.openide.dialogs diff -r 2d51a92a301a -r ae0e4453df73 src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties --- 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 diff -r 2d51a92a301a -r ae0e4453df73 src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml --- 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 @@ + org.openide.awt + + + + 7.39.1 + + + org.openide.nodes