changeset 14757:91c88fc2157c

make scheduling in IdealGraphPrinter optional
author Erik Eckstein <erik.eckstein@oracle.com>
date Wed, 26 Mar 2014 10:10:12 +0100
parents 3e1e83287128
children c612c2742a4f
files graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Mar 26 10:08:31 2014 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Mar 26 10:10:12 2014 +0100
@@ -115,7 +115,7 @@
             if (PrintBinaryGraphs.getValue()) {
                 printer = new BinaryGraphPrinter(FileChannel.open(file.toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW));
             } else {
-                printer = new IdealGraphPrinter(new FileOutputStream(file));
+                printer = new IdealGraphPrinter(new FileOutputStream(file), true);
             }
             TTY.println("Dumping IGV graphs to %s", file.getName());
         } catch (IOException e) {
@@ -132,7 +132,7 @@
             if (PrintBinaryGraphs.getValue()) {
                 printer = new BinaryGraphPrinter(SocketChannel.open(new InetSocketAddress(host, port)));
             } else {
-                IdealGraphPrinter xmlPrinter = new IdealGraphPrinter(new Socket(host, port).getOutputStream());
+                IdealGraphPrinter xmlPrinter = new IdealGraphPrinter(new Socket(host, port).getOutputStream(), true);
                 printer = xmlPrinter;
             }
             TTY.println("Connected to the IGV on %s:%d", host, port);
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Wed Mar 26 10:08:31 2014 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Wed Mar 26 10:10:12 2014 +0100
@@ -42,12 +42,18 @@
  */
 public class IdealGraphPrinter extends BasicIdealGraphPrinter implements GraphPrinter {
 
+    private final boolean tryToSchedule;
+
     /**
      * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
+     * 
+     * @param tryToSchedule If false, no scheduling is done, which avoids exceptions for
+     *            non-schedulable graphs.
      */
-    public IdealGraphPrinter(OutputStream stream) {
+    public IdealGraphPrinter(OutputStream stream, boolean tryToSchedule) {
         super(stream);
         this.begin();
+        this.tryToSchedule = tryToSchedule;
     }
 
     /**
@@ -80,7 +86,7 @@
         beginGraph(title);
         Set<Node> noBlockNodes = new HashSet<>();
         SchedulePhase schedule = predefinedSchedule;
-        if (schedule == null) {
+        if (schedule == null && tryToSchedule) {
             try {
                 schedule = new SchedulePhase();
                 schedule.apply((StructuredGraph) graph);