changeset 5817:74eb5feba8dc

Make sure the right port is used for dumping
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 11 Jul 2012 15:28:28 +0200
parents b3d3a2fcba3d
children ade4014aa895
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java
diffstat 2 files changed, 7 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java	Wed Jul 11 14:41:22 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java	Wed Jul 11 15:28:28 2012 +0200
@@ -64,11 +64,7 @@
         if (logFilter != null || meterFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
             TTY.println(Thread.currentThread().getName() + ": " + toString());
         }
-        if (GraalOptions.PrintIdealGraphFile) {
-            dumpHandlers.add(new GraphPrinterDumpHandler());
-        } else {
-            dumpHandlers.add(new GraphPrinterDumpHandler(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintBinaryGraphPort));
-        }
+        dumpHandlers.add(new GraphPrinterDumpHandler());
         if (GraalOptions.PrintCFG) {
             dumpHandlers.add(new CFGPrinterObserver());
         }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Jul 11 14:41:22 2012 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Jul 11 15:28:28 2012 +0200
@@ -42,23 +42,14 @@
     private static final SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm");
 
     private GraphPrinter printer;
-    private List<String> previousInlineContext = new ArrayList<>();
-    private String host;
-    private int port;
+    private List<String> previousInlineContext;
     private int failuresCount;
 
     /**
-     * Creates a new {@link GraphPrinterDumpHandler} that writes output to a file.
+     * Creates a new {@link GraphPrinterDumpHandler}.
      */
     public GraphPrinterDumpHandler() {
-    }
-
-    /**
-     * Creates a new {@link GraphPrinterDumpHandler} that sends output to a remote IdealGraphVisualizer instance.
-     */
-    public GraphPrinterDumpHandler(String host, int port) {
-        this.host = host;
-        this.port = port;
+        previousInlineContext = new ArrayList<>();
     }
 
     private void ensureInitialized() {
@@ -67,7 +58,7 @@
                 return;
             }
             previousInlineContext.clear();
-            if (host == null) {
+            if (GraalOptions.PrintIdealGraphAddress == null) {
                 initializeFilePrinter();
             } else {
                 initializeNetworkPrinter();
@@ -97,8 +88,9 @@
     }
 
     private void initializeNetworkPrinter() {
+        String host = GraalOptions.PrintIdealGraphAddress;
+        int port = GraalOptions.PrintBinaryGraphs ? GraalOptions.PrintBinaryGraphPort : GraalOptions.PrintIdealGraphPort;
         try {
-
             if (GraalOptions.PrintBinaryGraphs) {
                 printer = new BinaryGraphPrinter(SocketChannel.open(new InetSocketAddress(host, port)));
             } else {