Mercurial > hg > graal-compiler
changeset 4580:a1c86aaef8f5
make Dump option work when IdealGraphVisualizer is not running. Print a warning message that connection is not possible instead of exiting the VM.
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Mon, 13 Feb 2012 13:47:41 -0800 |
parents | 854145ec9866 |
children | 8f985001dc27 |
files | graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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<String> inlineContext = getInlineContext(); Debug.contextSnapshot(RiResolvedMethod.class); @@ -140,9 +142,6 @@ } }); - } else { - TTY.println("Fatal error: Printer invalid!"); - System.exit(-1); } } }