# HG changeset patch # User Christian Wimmer # Date 1329169661 28800 # Node ID a1c86aaef8f591ea5d2569dc6404048d22a87eda # Parent 854145ec986679d4938d101eef2a0d71e3c797c7 make Dump option work when IdealGraphVisualizer is not running. Print a warning message that connection is not possible instead of exiting the VM. diff -r 854145ec9866 -r a1c86aaef8f5 graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java Mon Feb 13 17:01:14 2012 +0100 +++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java Mon Feb 13 13:47:41 2012 -0800 @@ -27,6 +27,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; +import com.oracle.max.criutils.*; import com.oracle.max.graal.alloc.util.*; import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.alloc.*; @@ -80,6 +81,7 @@ } catch (FileNotFoundException e) { throw new InternalError("Could not open " + file.getAbsolutePath()); } + TTY.println("CFGPrinter: Output to file %s", file); } RiRuntime runtime = cfgPrinter.runtime; @@ -92,6 +94,7 @@ cfgPrinter.lir = null; cfgPrinter.lirGenerator = null; schedule = null; + TTY.println("CFGPrinter: Dumping method %s", method); } else if (object instanceof BciBlockMapping) { BciBlockMapping blockMap = (BciBlockMapping) object; diff -r 854145ec9866 -r a1c86aaef8f5 graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java --- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java Mon Feb 13 17:01:14 2012 +0100 +++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java Mon Feb 13 13:47:41 2012 -0800 @@ -70,7 +70,6 @@ } else { initializeNetworkPrinter(); } - printer.begin(); } } @@ -78,8 +77,9 @@ try { FileOutputStream stream = new FileOutputStream(fileName); printer = new IdealGraphPrinter(stream); + printer.begin(); } catch (IOException e) { - throw new RuntimeException(e); + printer = null; } } @@ -88,9 +88,11 @@ Socket socket = new Socket(host, port); BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream(), 0x4000); printer = new IdealGraphPrinter(stream); + printer.begin(); TTY.println("Connected to the IGV on port %d", port); } catch (IOException e) { - throw new RuntimeException(e); + TTY.println("Could not connect to the IGV on port %d: %s", port, e); + printer = null; } } @@ -100,7 +102,7 @@ ensureInitialized(); final Graph graph = (Graph) object; - if (printer.isValid()) { + if (printer != null && printer.isValid()) { // Get all current RiResolvedMethod instances in the context. List inlineContext = getInlineContext(); Debug.contextSnapshot(RiResolvedMethod.class); @@ -140,9 +142,6 @@ } }); - } else { - TTY.println("Fatal error: Printer invalid!"); - System.exit(-1); } } }