Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java @ 21780:3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Wed, 03 Jun 2015 15:47:54 +0200 |
parents | edafbaef3059 |
children | e26913e5bc3c |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.printer; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.io.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 import java.util.*; |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
27 import java.util.concurrent.atomic.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
29 import com.oracle.graal.code.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.compiler.gen.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.java.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.lir.*; |
19168
39e99cf01468
Move LinearScan to c.o.g.lir.alloc.lsra.
Josef Eisl <josef.eisl@jku.at>
parents:
19031
diff
changeset
|
34 import com.oracle.graal.lir.alloc.lsra.*; |
19031
beb7c10b7747
Move StackSlotAllocators into a package.
Josef Eisl <josef.eisl@jku.at>
parents:
19029
diff
changeset
|
35 import com.oracle.graal.lir.stackslotalloc.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.nodes.*; |
6529
2e96dc4eb8e2
renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents:
6526
diff
changeset
|
37 import com.oracle.graal.nodes.cfg.*; |
14594
3eda945af90a
dump final HIR schedule to c1visualizer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14145
diff
changeset
|
38 import com.oracle.graal.phases.schedule.*; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
39 import com.oracle.jvmci.code.*; |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19168
diff
changeset
|
40 import com.oracle.jvmci.common.*; |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
41 import com.oracle.jvmci.debug.*; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
42 import com.oracle.jvmci.meta.*; |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
43 import com.oracle.jvmci.service.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7032
diff
changeset
|
46 * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7032
diff
changeset
|
47 * <a href="http://java.net/projects/c1visualizer/">C1 Visualizer</a>. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 */ |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
49 public class CFGPrinterObserver implements DebugDumpHandler { |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
50 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
51 private CFGPrinter cfgPrinter; |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
52 private File cfgFile; |
9658
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
53 private JavaMethod curMethod; |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
54 private List<String> curDecorators = Collections.emptyList(); |
11379
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
55 private final boolean dumpFrontend; |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
56 |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
57 public CFGPrinterObserver(boolean dumpFrontend) { |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
58 this.dumpFrontend = dumpFrontend; |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
59 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 @Override |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
62 public void dump(Object object, String message) { |
5029
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
63 try { |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
64 dumpSandboxed(object, message); |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
65 } catch (Throwable ex) { |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
66 TTY.println("CFGPrinter: Exception during output of " + message + ": " + ex); |
8150
b66f831ac5ab
Fix CFG printer output. Clean up after making the compiler class all-static.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
67 ex.printStackTrace(); |
5029
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
68 } |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
69 } |
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
70 |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
71 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7032
diff
changeset
|
72 * Looks for the outer most method and its {@link DebugDumpScope#decorator}s in the current |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7032
diff
changeset
|
73 * debug scope and opens a new compilation scope if this pair does not match the current method |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7032
diff
changeset
|
74 * and decorator pair. |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
75 */ |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
76 private boolean checkMethodScope() { |
9658
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
77 JavaMethod method = null; |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
78 ArrayList<String> decorators = new ArrayList<>(); |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
79 for (Object o : Debug.context()) { |
9658
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
80 if (o instanceof JavaMethod) { |
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
81 method = (JavaMethod) o; |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
82 decorators.clear(); |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
83 } else if (o instanceof StructuredGraph) { |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
84 StructuredGraph graph = (StructuredGraph) o; |
9658
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
85 if (graph.method() != null) { |
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
86 method = graph.method(); |
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
87 decorators.clear(); |
d64083db3c11
changed CFGPrinterObserver to use JavaMethod instead of ResolvedJavaMethod for method scope
Doug Simon <doug.simon@oracle.com>
parents:
9234
diff
changeset
|
88 } |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
89 } else if (o instanceof DebugDumpScope) { |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
90 DebugDumpScope debugDumpScope = (DebugDumpScope) o; |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
91 if (debugDumpScope.decorator) { |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
92 decorators.add(debugDumpScope.name); |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
93 } |
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
94 } |
5275
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5249
diff
changeset
|
95 } |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
96 |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
97 if (method == null) { |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
98 return false; |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
99 } |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
100 |
12570
af39ea2dc39d
made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
101 if (!method.equals(curMethod) || !curDecorators.equals(decorators)) { |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
102 cfgPrinter.printCompilation(method); |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
103 TTY.println("CFGPrinter: Dumping method %s to %s", method, cfgFile); |
5432
50598118cd0a
added support for decorator dump scopes so that the visualizers can distinguish between multiple compilations of the same method
Doug Simon <doug.simon@oracle.com>
parents:
5275
diff
changeset
|
104 } |
18642
133d5a98c547
generalized semantics of DebugDumpHandler.close() to mean reset so that closing a handler flushes and releases all its resources but leaves it operational (i.e. subsequent uses will (re)create and (re)open the required resources)
Doug Simon <doug.simon@oracle.com>
parents:
16950
diff
changeset
|
105 curMethod = method; |
133d5a98c547
generalized semantics of DebugDumpHandler.close() to mean reset so that closing a handler flushes and releases all its resources but leaves it operational (i.e. subsequent uses will (re)create and (re)open the required resources)
Doug Simon <doug.simon@oracle.com>
parents:
16950
diff
changeset
|
106 curDecorators = decorators; |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
107 return true; |
5275
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5249
diff
changeset
|
108 } |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5249
diff
changeset
|
109 |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
110 private static final long timestamp = System.currentTimeMillis(); |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
111 private static final AtomicInteger uniqueId = new AtomicInteger(); |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
112 |
11379
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
113 private static boolean isFrontendObject(Object object) { |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
114 return object instanceof Graph || object instanceof BciBlockMapping; |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
115 } |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
116 |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
117 private LIR lastLIR = null; |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
118 private Interval[] delayedIntervals = null; |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
119 |
5029
74f47ef37394
Fix and enable liveness analysis to prune unnecessary frame state entries
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5011
diff
changeset
|
120 public void dumpSandboxed(Object object, String message) { |
4535
10f300ba182f
Make CFGObserver handle the case without GraalCompiler silently without NPE.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4525
diff
changeset
|
121 |
11379
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
122 if (!dumpFrontend && isFrontendObject(object)) { |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
123 return; |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
124 } |
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
125 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 if (cfgPrinter == null) { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
127 cfgFile = new File("compilations-" + timestamp + "_" + uniqueId.incrementAndGet() + ".cfg"); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
128 try { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
129 OutputStream out = new BufferedOutputStream(new FileOutputStream(cfgFile)); |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
130 cfgPrinter = new CFGPrinter(out); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
131 } catch (FileNotFoundException e) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19168
diff
changeset
|
132 throw new JVMCIError("Could not open " + cfgFile.getAbsolutePath()); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
133 } |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
134 TTY.println("CFGPrinter: Output to file %s", cfgFile); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
137 if (!checkMethodScope()) { |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
138 return; |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
139 } |
15025
292353f2645c
CFGPrinter: workaround for bytecode dumping.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
140 if (curMethod instanceof ResolvedJavaMethod) { |
292353f2645c
CFGPrinter: workaround for bytecode dumping.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
141 cfgPrinter.method = (ResolvedJavaMethod) curMethod; |
292353f2645c
CFGPrinter: workaround for bytecode dumping.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
142 } |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
143 |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
144 if (object instanceof LIR) { |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
145 cfgPrinter.lir = (LIR) object; |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
146 } else { |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
147 cfgPrinter.lir = Debug.contextLookup(LIR.class); |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
148 } |
14888
f6630873316b
Rename NodeLIRGenerator (and related classes and interfaces) to NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
149 cfgPrinter.nodeLirGenerator = Debug.contextLookup(NodeLIRBuilder.class); |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
150 if (cfgPrinter.nodeLirGenerator != null) { |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
151 cfgPrinter.target = cfgPrinter.nodeLirGenerator.getLIRGeneratorTool().target(); |
8150
b66f831ac5ab
Fix CFG printer output. Clean up after making the compiler class all-static.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
152 } |
14814
f200eb890729
Handle AbstractBlock in CFGPrinter.
Josef Eisl <josef.eisl@jku.at>
parents:
14791
diff
changeset
|
153 if (cfgPrinter.lir != null && cfgPrinter.lir.getControlFlowGraph() instanceof ControlFlowGraph) { |
14791
be2be30c653d
Introduce AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14788
diff
changeset
|
154 cfgPrinter.cfg = (ControlFlowGraph) cfgPrinter.lir.getControlFlowGraph(); |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
155 } |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
156 |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11379
diff
changeset
|
157 CodeCacheProvider codeCache = Debug.contextLookup(CodeCacheProvider.class); |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11379
diff
changeset
|
158 if (codeCache != null) { |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11379
diff
changeset
|
159 cfgPrinter.target = codeCache.getTarget(); |
8150
b66f831ac5ab
Fix CFG printer output. Clean up after making the compiler class all-static.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
160 } |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
161 |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
162 if (object instanceof BciBlockMapping) { |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
163 BciBlockMapping blockMap = (BciBlockMapping) object; |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
164 cfgPrinter.printCFG(message, blockMap); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6529
diff
changeset
|
165 if (blockMap.method.getCode() != null) { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
166 cfgPrinter.printBytecodes(new BytecodeDisassembler(false).disassemble(blockMap.method)); |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5557
diff
changeset
|
167 } |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
168 |
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
169 } else if (object instanceof LIR) { |
16950
559ab93c1ad6
CFGPrinter: do not print empty HIR cfgs.
Josef Eisl <josef.eisl@jku.at>
parents:
15537
diff
changeset
|
170 // Currently no node printing for lir |
559ab93c1ad6
CFGPrinter: do not print empty HIR cfgs.
Josef Eisl <josef.eisl@jku.at>
parents:
15537
diff
changeset
|
171 cfgPrinter.printCFG(message, cfgPrinter.lir.codeEmittingOrder(), false); |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
172 lastLIR = (LIR) object; |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
173 if (delayedIntervals != null) { |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
174 cfgPrinter.printIntervals(message, delayedIntervals); |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
175 delayedIntervals = null; |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
176 } |
14594
3eda945af90a
dump final HIR schedule to c1visualizer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14145
diff
changeset
|
177 } else if (object instanceof SchedulePhase) { |
3eda945af90a
dump final HIR schedule to c1visualizer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14145
diff
changeset
|
178 cfgPrinter.printSchedule(message, (SchedulePhase) object); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
179 } else if (object instanceof StructuredGraph) { |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
180 if (cfgPrinter.cfg == null) { |
9234
b9cf7d0b598e
removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8349
diff
changeset
|
181 StructuredGraph graph = (StructuredGraph) object; |
b9cf7d0b598e
removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8349
diff
changeset
|
182 cfgPrinter.cfg = ControlFlowGraph.compute(graph, true, true, true, false); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
183 } |
15537
8117e9cadb48
Use List instead of an array in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
184 cfgPrinter.printCFG(message, cfgPrinter.cfg.getBlocks(), true); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
185 |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
186 } else if (object instanceof CompilationResult) { |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8150
diff
changeset
|
187 final CompilationResult compResult = (CompilationResult) object; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
188 cfgPrinter.printMachineCode(disassemble(codeCache, compResult, null), message); |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8150
diff
changeset
|
189 } else if (isCompilationResultAndInstalledCode(object)) { |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
190 Object[] tuple = (Object[]) object; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
191 cfgPrinter.printMachineCode(disassemble(codeCache, (CompilationResult) tuple[0], (InstalledCode) tuple[1]), message); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4435
diff
changeset
|
192 } else if (object instanceof Interval[]) { |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
193 if (lastLIR == cfgPrinter.lir) { |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
194 cfgPrinter.printIntervals(message, (Interval[]) object); |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
195 } else { |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
196 if (delayedIntervals != null) { |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
197 Debug.log("Some delayed intervals were dropped (%s)", (Object) delayedIntervals); |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
198 } |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
199 delayedIntervals = (Interval[]) object; |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21725
diff
changeset
|
200 } |
19029
d80301977c5e
StackSlotAllocator: add CFGPrinter support for StackIntervals.
Josef Eisl <josef.eisl@jku.at>
parents:
18665
diff
changeset
|
201 } else if (object instanceof StackInterval[]) { |
d80301977c5e
StackSlotAllocator: add CFGPrinter support for StackIntervals.
Josef Eisl <josef.eisl@jku.at>
parents:
18665
diff
changeset
|
202 cfgPrinter.printStackIntervals(message, (StackInterval[]) object); |
4278
b49981617b10
Fixes after removal of GraalCompilation
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
203 } |
b49981617b10
Fixes after removal of GraalCompilation
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
204 |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
205 cfgPrinter.target = null; |
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
206 cfgPrinter.lir = null; |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
207 cfgPrinter.nodeLirGenerator = null; |
5011
5d0af6520f26
Do not use SchedulePhase in CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4612
diff
changeset
|
208 cfgPrinter.cfg = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 cfgPrinter.flush(); |
11379
0942e34b6c7d
added PrintBackendCFG option (default is true) for controlling if backend output is dumped to the C1Visualizer
Doug Simon <doug.simon@oracle.com>
parents:
9658
diff
changeset
|
210 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 } |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
212 |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
213 private static DisassemblerProvider disassembler; |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
214 |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
215 private static final DisassemblerProvider NOP_DISASSEMBLER = new DisassemblerProvider() { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
216 public String getName() { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
217 return null; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
218 } |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
219 }; |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
220 |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
221 private static DisassemblerProvider getDisassembler() { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
222 if (disassembler == null) { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
223 DisassemblerProvider selected = NOP_DISASSEMBLER; |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
224 for (DisassemblerProvider d : Services.load(DisassemblerProvider.class)) { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
225 String name = d.getName().toLowerCase(); |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
226 if (name.contains("hcf") || name.contains("hexcodefile")) { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
227 selected = d; |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
228 break; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
229 } |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
230 } |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
231 disassembler = selected; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
232 } |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
233 return disassembler; |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
234 } |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
235 |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
236 private static String disassemble(CodeCacheProvider codeCache, CompilationResult compResult, InstalledCode installedCode) { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
237 DisassemblerProvider dis = getDisassembler(); |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
238 if (installedCode != null) { |
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
239 return dis.disassembleInstalledCode(codeCache, compResult, installedCode); |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
240 } |
21725
edafbaef3059
unified the DisassemblerProvider service interface to support both the hsdis and HexCodeFile based disassemblers
Doug Simon <doug.simon@oracle.com>
parents:
21706
diff
changeset
|
241 return dis.disassembleCompiledCode(codeCache, compResult); |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
242 } |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
243 |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8150
diff
changeset
|
244 private static boolean isCompilationResultAndInstalledCode(Object object) { |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
245 if (object instanceof Object[]) { |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
246 Object[] tuple = (Object[]) object; |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8150
diff
changeset
|
247 if (tuple.length == 2 && tuple[0] instanceof CompilationResult && tuple[1] instanceof InstalledCode) { |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
248 return true; |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
249 } |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
250 } |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
251 return false; |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
252 } |
5819
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
253 |
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
254 @Override |
7032
5a1f6e96e163
close() method for dump handlers should not throw IOException
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6960
diff
changeset
|
255 public void close() { |
5819
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
256 if (cfgPrinter != null) { |
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
257 cfgPrinter.close(); |
18642
133d5a98c547
generalized semantics of DebugDumpHandler.close() to mean reset so that closing a handler flushes and releases all its resources but leaves it operational (i.e. subsequent uses will (re)create and (re)open the required resources)
Doug Simon <doug.simon@oracle.com>
parents:
16950
diff
changeset
|
258 cfgPrinter = null; |
18665
96861e3f8cc5
made CFGPrinterObserver reset (upon close) properly
Doug Simon <doug.simon@oracle.com>
parents:
18642
diff
changeset
|
259 curDecorators = Collections.emptyList(); |
96861e3f8cc5
made CFGPrinterObserver reset (upon close) properly
Doug Simon <doug.simon@oracle.com>
parents:
18642
diff
changeset
|
260 curMethod = null; |
5819
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
261 } |
8fd81d0e3acf
Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5763
diff
changeset
|
262 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 } |