annotate graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java @ 7869:cb7bab0fd666

use predefined schedule in GraphPrinterDumpHandler
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 26 Feb 2013 16:57:23 +0100
parents f180d2a1c3a4
children 0e008317f8ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
1 /*
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
4 *
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
8 *
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
13 * accompanied this code).
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
14 *
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
18 *
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
21 * questions.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
22 */
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
23 package com.oracle.graal.printer;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
24
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
25 import java.io.*;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
26 import java.net.*;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
27 import java.nio.channels.*;
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
28 import java.nio.file.*;
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
29 import java.text.*;
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
30 import java.util.*;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
31
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
32 import com.oracle.graal.api.meta.*;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
33 import com.oracle.graal.debug.*;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
34 import com.oracle.graal.graph.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
35 import com.oracle.graal.phases.*;
7869
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
36 import com.oracle.graal.phases.schedule.*;
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
37
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
38 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7153
diff changeset
39 * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7153
diff changeset
40 * that can be inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7153
diff changeset
41 * Visualizer</a>.
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
42 */
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
43 public class GraphPrinterDumpHandler implements DebugDumpHandler {
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
44
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
45 private GraphPrinter printer;
5817
74eb5feba8dc Make sure the right port is used for dumping
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
46 private List<String> previousInlineContext;
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
47 private int failuresCount;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
48
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
49 /**
5817
74eb5feba8dc Make sure the right port is used for dumping
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
50 * Creates a new {@link GraphPrinterDumpHandler}.
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
51 */
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
52 public GraphPrinterDumpHandler() {
5817
74eb5feba8dc Make sure the right port is used for dumping
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
53 previousInlineContext = new ArrayList<>();
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
54 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
55
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
56 private void ensureInitialized() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
57 if (printer == null) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
58 if (failuresCount > 8) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
59 return;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
60 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
61 previousInlineContext.clear();
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
62 if (GraalOptions.PrintIdealGraphFile) {
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
63 initializeFilePrinter();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
64 } else {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
65 initializeNetworkPrinter();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
66 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
67 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
68 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
69
7153
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
70 // This field must be lazily initialized as this class may be loaded in a version
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
71 // VM startup phase at which not all required features (such as system properties)
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
72 // are online.
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
73 private static SimpleDateFormat sdf;
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
74
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
75 private void initializeFilePrinter() {
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
76 String ext;
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
77 if (GraalOptions.PrintBinaryGraphs) {
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
78 ext = ".bgv";
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
79 } else {
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
80 ext = ".gv.xml";
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
81 }
7153
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
82 if (sdf == null) {
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
83 sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm");
c421c19b7bf8 made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
Doug Simon <doug.simon@oracle.com>
parents: 7032
diff changeset
84 }
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
85 String fileName = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date()) + ext;
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
86 try {
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
87 if (GraalOptions.PrintBinaryGraphs) {
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
88 printer = new BinaryGraphPrinter(FileChannel.open(new File(fileName).toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW));
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
89 } else {
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
90 printer = new IdealGraphPrinter(new FileOutputStream(fileName));
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
91 }
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
92 TTY.println("Dumping IGV graphs to %s", fileName);
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
93 } catch (IOException e) {
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5819
diff changeset
94 TTY.println("Failed to open %s to dump IGV graphs : %s", fileName, e);
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
95 failuresCount++;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
96 printer = null;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
97 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
98 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
99
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
100 private void initializeNetworkPrinter() {
5817
74eb5feba8dc Make sure the right port is used for dumping
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
101 String host = GraalOptions.PrintIdealGraphAddress;
74eb5feba8dc Make sure the right port is used for dumping
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
102 int port = GraalOptions.PrintBinaryGraphs ? GraalOptions.PrintBinaryGraphPort : GraalOptions.PrintIdealGraphPort;
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
103 try {
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
104 if (GraalOptions.PrintBinaryGraphs) {
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
105 printer = new BinaryGraphPrinter(SocketChannel.open(new InetSocketAddress(host, port)));
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
106 } else {
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
107 IdealGraphPrinter xmlPrinter = new IdealGraphPrinter(new Socket(host, port).getOutputStream());
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
108 printer = xmlPrinter;
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
109 }
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
110 TTY.println("Connected to the IGV on %s:%d", host, port);
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
111 } catch (IOException e) {
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
112 TTY.println("Could not connect to the IGV on %s:%d : %s", host, port, e);
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
113 failuresCount++;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
114 printer = null;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
115 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
116 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
117
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
118 @Override
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
119 public void dump(Object object, final String message) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
120 if (object instanceof Graph) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
121 ensureInitialized();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
122 if (printer == null) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
123 return;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
124 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
125 final Graph graph = (Graph) object;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
126
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
127 if (printer != null) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
128 // Get all current RiResolvedMethod instances in the context.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
129 List<String> inlineContext = getInlineContext();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
130
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
131 // Reverse list such that inner method comes after outer method.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
132 Collections.reverse(inlineContext);
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
133
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
134 // Check for method scopes that must be closed since the previous dump.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
135 for (int i = 0; i < previousInlineContext.size(); ++i) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
136 if (i >= inlineContext.size() || !inlineContext.get(i).equals(previousInlineContext.get(i))) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
137 for (int j = previousInlineContext.size() - 1; j >= i; --j) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
138 closeScope();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
139 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
140 break;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
141 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
142 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
143
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
144 // Check for method scopes that must be opened since the previous dump.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
145 for (int i = 0; i < inlineContext.size(); ++i) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
146 if (i >= previousInlineContext.size() || !inlineContext.get(i).equals(previousInlineContext.get(i))) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
147 for (int j = i; j < inlineContext.size(); ++j) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
148 openScope(inlineContext.get(j), j == 0);
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
149 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
150 break;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
151 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
152 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
153
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
154 // Save inline context for next dump.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
155 previousInlineContext = inlineContext;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
156
7869
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
157 final SchedulePhase predefinedSchedule = getPredefinedSchedule();
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
158 Debug.sandbox("PrintingGraph", new Runnable() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
159
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
160 @Override
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
161 public void run() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
162 // Finally, output the graph.
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
163 try {
7869
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
164 printer.print(graph, message, predefinedSchedule);
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
165 } catch (IOException e) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
166 failuresCount++;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
167 printer = null;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
168 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
169 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
170 });
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
171 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
172 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
173 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
174
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
175 private static List<String> getInlineContext() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
176 List<String> result = new ArrayList<>();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
177 for (Object o : Debug.context()) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
178 if (o instanceof ResolvedJavaMethod) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
179 ResolvedJavaMethod method = (ResolvedJavaMethod) o;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
180 result.add(MetaUtil.format("%H::%n(%p)", method));
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
181 } else if (o instanceof DebugDumpScope) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
182 DebugDumpScope debugDumpScope = (DebugDumpScope) o;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
183 if (debugDumpScope.decorator && !result.isEmpty()) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
184 result.set(result.size() - 1, debugDumpScope.name + ":" + result.get(result.size() - 1));
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
185 } else {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
186 result.add(debugDumpScope.name);
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
187 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
188 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
189 }
7785
f180d2a1c3a4 support graph dumping with being nested in a DebugScope
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
190 if (result.isEmpty()) {
f180d2a1c3a4 support graph dumping with being nested in a DebugScope
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
191 result.add("Top Scope");
f180d2a1c3a4 support graph dumping with being nested in a DebugScope
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
192 }
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
193 return result;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
194 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
195
7869
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
196 private static SchedulePhase getPredefinedSchedule() {
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
197 SchedulePhase result = null;
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
198 for (Object o : Debug.context()) {
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
199 if (o instanceof SchedulePhase) {
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
200 result = (SchedulePhase) o;
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
201 }
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
202 }
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
203 return result;
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
204 }
cb7bab0fd666 use predefined schedule in GraphPrinterDumpHandler
Lukas Stadler <lukas.stadler@jku.at>
parents: 7785
diff changeset
205
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
206 private void openScope(String name, boolean showThread) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
207 String prefix = showThread ? Thread.currentThread().getName() + ":" : "";
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
208 try {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
209 printer.beginGroup(prefix + name, name, Debug.contextLookup(ResolvedJavaMethod.class), -1);
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
210 } catch (IOException e) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
211 failuresCount++;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
212 printer = null;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
213 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
214 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
215
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
216 private void closeScope() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
217 try {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
218 printer.endGroup();
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
219 } catch (IOException e) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
220 failuresCount++;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
221 printer = null;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
222 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
223 }
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
224
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
225 @Override
7032
5a1f6e96e163 close() method for dump handlers should not throw IOException
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6695
diff changeset
226 public void close() {
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
227 for (int i = 0; i < previousInlineContext.size(); i++) {
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
228 closeScope();
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
229 }
6695
dc7cd6885f07 Avoid NullPointerException
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
230 if (printer != null) {
dc7cd6885f07 Avoid NullPointerException
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
231 printer.close();
dc7cd6885f07 Avoid NullPointerException
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
232 }
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5817
diff changeset
233 }
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
234 }