Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java @ 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.
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 09 Oct 2012 15:23:38 -0700 |
parents | ee651c726397 |
children | 3dddb311395f |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4313
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
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 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
24 package com.oracle.graal.hotspot.bridge; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 |
5328
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
26 import java.io.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.lang.reflect.*; |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
28 import java.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.util.concurrent.*; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
30 import java.util.concurrent.atomic.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5503
diff
changeset
|
32 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.compiler.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
34 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.debug.internal.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.hotspot.*; |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
37 import com.oracle.graal.hotspot.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.hotspot.snippets.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.java.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
40 import com.oracle.graal.phases.*; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
41 import com.oracle.graal.phases.PhasePlan.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.snippets.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
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 * Exits from the HotSpot VM into Java code. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 */ |
5529
d487ae06265d
Move graal.hotspot.server into its own project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5526
diff
changeset
|
47 public class VMToCompilerImpl implements VMToCompiler { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
49 private final HotSpotGraalRuntime graalRuntime; |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
50 private IntrinsifyArrayCopyPhase intrinsifyArrayCopy; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 public final HotSpotTypePrimitive typeBoolean; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 public final HotSpotTypePrimitive typeChar; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 public final HotSpotTypePrimitive typeFloat; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 public final HotSpotTypePrimitive typeDouble; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 public final HotSpotTypePrimitive typeByte; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 public final HotSpotTypePrimitive typeShort; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 public final HotSpotTypePrimitive typeInt; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 public final HotSpotTypePrimitive typeLong; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 public final HotSpotTypePrimitive typeVoid; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 private ThreadPoolExecutor compileQueue; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
63 private ThreadPoolExecutor slowCompileQueue; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
64 private AtomicInteger compileTaskIds = new AtomicInteger(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 |
5328
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
66 private PrintStream log = System.out; |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
67 |
5534
e0f7a49129f2
Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
68 public VMToCompilerImpl(HotSpotGraalRuntime compiler) { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
69 this.graalRuntime = compiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
71 typeBoolean = new HotSpotTypePrimitive(Kind.Boolean); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
72 typeChar = new HotSpotTypePrimitive(Kind.Char); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
73 typeFloat = new HotSpotTypePrimitive(Kind.Float); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
74 typeDouble = new HotSpotTypePrimitive(Kind.Double); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
75 typeByte = new HotSpotTypePrimitive(Kind.Byte); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
76 typeShort = new HotSpotTypePrimitive(Kind.Short); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
77 typeInt = new HotSpotTypePrimitive(Kind.Int); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
78 typeLong = new HotSpotTypePrimitive(Kind.Long); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
79 typeVoid = new HotSpotTypePrimitive(Kind.Void); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 public void startCompiler() throws Throwable { |
5328
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
83 if (GraalOptions.LogFile != null) { |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
84 try { |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
85 final boolean enableAutoflush = true; |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
86 log = new PrintStream(new FileOutputStream(GraalOptions.LogFile), enableAutoflush); |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
87 } catch (FileNotFoundException e) { |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
88 throw new RuntimeException("couldn't open log file: " + GraalOptions.LogFile, e); |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
89 } |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
90 } |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
91 |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
92 TTY.initialize(log); |
5164
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
93 |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
94 if (GraalOptions.Log == null && GraalOptions.Meter == null && GraalOptions.Time == null && GraalOptions.Dump == null) { |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
95 if (GraalOptions.MethodFilter != null) { |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
96 TTY.println("WARNING: Ignoring MethodFilter option since Log, Meter, Time and Dump options are all null"); |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
97 } |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
98 } |
56909bcec047
added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents:
5138
diff
changeset
|
99 |
4558
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
100 if (GraalOptions.Debug) { |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
101 Debug.enable(); |
5328
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
102 HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter, log); |
4558
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
103 Debug.setConfig(hotspotDebugConfig); |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
104 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 // Install intrinsics. |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
106 GraalCompiler compiler = graalRuntime.getCompiler(); |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
107 final HotSpotRuntime runtime = (HotSpotRuntime) compiler.runtime; |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4171
diff
changeset
|
108 if (GraalOptions.Intrinsify) { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
109 Debug.scope("InstallSnippets", new Object[] {new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() { |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
110 |
4558
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
111 @Override |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
112 public void run() { |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
113 VMToCompilerImpl.this.intrinsifyArrayCopy = new IntrinsifyArrayCopyPhase(runtime); |
5780
64257cbef60c
removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
114 SnippetInstaller installer = new SnippetInstaller(runtime, runtime.getGraalRuntime().getTarget()); |
5585
a7ed598130c2
modified snippet installation to avoid using compiler storage for every method (not just the snippets) processed during installation
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
115 GraalIntrinsics.installIntrinsics(installer); |
a7ed598130c2
modified snippet installation to avoid using compiler storage for every method (not just the snippets) processed during installation
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
116 runtime.installSnippets(installer); |
4558
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
117 } |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
118 }); |
3706975946e4
Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4479
diff
changeset
|
119 |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4171
diff
changeset
|
120 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 // Create compilation queue. |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
123 BlockingQueue<Runnable> queue = GraalOptions.PriorityCompileQueue ? new PriorityBlockingQueue<Runnable>() : new LinkedBlockingQueue<Runnable>(); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
124 compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, queue, CompilerThread.FACTORY); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
125 |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
126 if (GraalOptions.SlowCompileThreads) { |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
127 BlockingQueue<Runnable> slowQueue = GraalOptions.PriorityCompileQueue ? new PriorityBlockingQueue<Runnable>() : new LinkedBlockingQueue<Runnable>(); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
128 slowCompileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, slowQueue, CompilerThread.LOW_PRIORITY_FACTORY); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
129 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 // Create queue status printing thread. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 if (GraalOptions.PrintQueue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 Thread t = new Thread() { |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
134 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 public void run() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 while (true) { |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
138 if (slowCompileQueue == null) { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
139 TTY.println(compileQueue.toString()); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
140 } else { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
141 TTY.println("fast: " + compileQueue.toString() + " slow: " + slowCompileQueue); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
142 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 Thread.sleep(1000); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 } catch (InterruptedException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 t.setDaemon(true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 t.start(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 |
4313
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
155 /** |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
156 * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths |
5233
efbb1e33e2f3
removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
5183
diff
changeset
|
157 * that are otherwise not exercised during bootstrapping and lead to later deoptimization when application code is |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
158 * compiled. |
4313
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
159 */ |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
160 @SuppressWarnings("unused") |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
161 @Deprecated |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
162 private synchronized void compileWarmup() { |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
163 // Method is synchronized to exercise the synchronization code in the compiler. |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
164 } |
79af35bd9fd7
Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
165 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 public void bootstrap() throws Throwable { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 TTY.print("Bootstrapping Graal"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 TTY.flush(); |
4168
0bc4815d2069
Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
169 long startTime = System.currentTimeMillis(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
171 boolean firstRun = true; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
172 do { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
173 // Initialize compile queue with a selected set of methods. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
174 Class<Object> objectKlass = Object.class; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
175 if (firstRun) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
176 enqueue(getClass().getDeclaredMethod("compileWarmup")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
177 enqueue(objectKlass.getDeclaredMethod("equals", Object.class)); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
178 enqueue(objectKlass.getDeclaredMethod("toString")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
179 firstRun = false; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
180 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
181 for (int i = 0; i < 100; i++) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
182 enqueue(getClass().getDeclaredMethod("bootstrap")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
183 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
184 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
186 // Compile until the queue is empty. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
187 int z = 0; |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
188 while (true) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
189 try { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
190 assert !CompilationTask.withinEnqueue.get(); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
191 CompilationTask.withinEnqueue.set(Boolean.TRUE); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
192 if (slowCompileQueue == null) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
193 if (compileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getTaskCount())) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
194 break; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
195 } |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
196 } else { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
197 if (compileQueue.getCompletedTaskCount() + slowCompileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getTaskCount() + slowCompileQueue.getTaskCount())) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
198 break; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
199 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
200 } |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
201 } finally { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
202 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
203 } |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
204 |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
205 Thread.sleep(100); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
206 while (z < compileQueue.getCompletedTaskCount() / 100) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
207 ++z; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
208 TTY.print("."); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
209 TTY.flush(); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
210 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
212 } while ((System.currentTimeMillis() - startTime) <= GraalOptions.TimedBootstrap); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
213 CompilationStatistics.clear("bootstrap"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 TTY.println(" in %d ms", System.currentTimeMillis() - startTime); |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
216 if (graalRuntime.getCache() != null) { |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
217 graalRuntime.getCache().clear(); |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5176
diff
changeset
|
218 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 System.gc(); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
220 CompilationStatistics.clear("bootstrap2"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 private void enqueue(Method m) throws Throwable { |
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:
6526
diff
changeset
|
224 JavaMethod javaMethod = graalRuntime.getRuntime().lookupJavaMethod(m); |
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:
6526
diff
changeset
|
225 assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) : javaMethod; |
5719
429accae15aa
moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents:
5661
diff
changeset
|
226 compileMethod((HotSpotResolvedJavaMethod) javaMethod, 0, false, 10); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 |
5367
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
229 private static void shutdownCompileQueue(ThreadPoolExecutor queue) throws InterruptedException { |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
230 if (queue != null) { |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
231 queue.shutdown(); |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
232 if (Debug.isEnabled() && GraalOptions.Dump != null) { |
5661
28dea025b221
reduced shutdown pause when -G:Dump is used from 5 seconds to 2
Doug Simon <doug.simon@oracle.com>
parents:
5585
diff
changeset
|
233 // Wait 2 seconds to flush out all graph dumps that may be of interest |
28dea025b221
reduced shutdown pause when -G:Dump is used from 5 seconds to 2
Doug Simon <doug.simon@oracle.com>
parents:
5585
diff
changeset
|
234 queue.awaitTermination(2, TimeUnit.SECONDS); |
5367
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
235 } |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
236 } |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
237 } |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
238 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 public void shutdownCompiler() throws Throwable { |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
240 try { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
241 assert !CompilationTask.withinEnqueue.get(); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
242 CompilationTask.withinEnqueue.set(Boolean.TRUE); |
5367
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
243 shutdownCompileQueue(compileQueue); |
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
244 shutdownCompileQueue(slowCompileQueue); |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
245 } finally { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
246 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
247 } |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
248 |
5367
7cf71c7961c6
if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents:
5361
diff
changeset
|
249 |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
250 if (Debug.isEnabled()) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
251 List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps(); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
252 List<DebugValue> debugValues = KeyRegistry.getDebugValues(); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
253 if (debugValues.size() > 0) { |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
254 ArrayList<DebugValue> sortedValues = new ArrayList<>(debugValues); |
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
255 Collections.sort(sortedValues, DebugValue.ORDER_BY_NAME); |
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
256 |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
257 if (GraalOptions.SummarizeDebugValues) { |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
258 printSummary(topLevelMaps, sortedValues); |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
259 } else if (GraalOptions.PerThreadDebugValues) { |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
260 for (DebugValueMap map : topLevelMaps) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
261 TTY.println("Showing the results for thread: " + map.getName()); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
262 map.group(); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
263 map.normalize(); |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
264 printMap(map, sortedValues, 0); |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
265 } |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
266 } else { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
267 DebugValueMap globalMap = new DebugValueMap("Global"); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
268 for (DebugValueMap map : topLevelMaps) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
269 if (GraalOptions.SummarizePerPhase) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
270 flattenChildren(map, globalMap); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
271 } else { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
272 for (DebugValueMap child : map.getChildren()) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
273 globalMap.addChild(child); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
274 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
275 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
276 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
277 if (!GraalOptions.SummarizePerPhase) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
278 globalMap.group(); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
279 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
280 globalMap.normalize(); |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
281 printMap(globalMap, sortedValues, 0); |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
282 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
283 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
284 } |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
285 CompilationStatistics.clear("final"); |
5769
8635406a0c33
factored counter functionality out of CheckcastSnippets in SnippetCounter for use by other snippets
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
286 SnippetCounter.printGroups(TTY.out().out()); |
4563
b27666ff9bd6
added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4560
diff
changeset
|
287 } |
b27666ff9bd6
added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4560
diff
changeset
|
288 |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
289 private void flattenChildren(DebugValueMap map, DebugValueMap globalMap) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
290 globalMap.addChild(map); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
291 for (DebugValueMap child : map.getChildren()) { |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
292 flattenChildren(child, globalMap); |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
293 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
294 map.clearChildren(); |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
295 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
296 |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
297 private static void printSummary(List<DebugValueMap> topLevelMaps, List<DebugValue> debugValues) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
298 DebugValueMap result = new DebugValueMap("Summary"); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
299 for (int i = debugValues.size() - 1; i >= 0; i--) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
300 DebugValue debugValue = debugValues.get(i); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
301 int index = debugValue.getIndex(); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
302 long total = collectTotal(topLevelMaps, index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
303 result.setCurrentValue(index, total); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
304 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
305 printMap(result, debugValues, 0); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
306 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
307 |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
308 private static long collectTotal(List<DebugValueMap> maps, int index) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
309 long total = 0; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
310 for (int i = 0; i < maps.size(); i++) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
311 DebugValueMap map = maps.get(i); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
312 // the top level accumulates some counters -> do not process the children if we find a value |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
313 long value = map.getCurrentValue(index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
314 if (value == 0) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
315 total += collectTotal(map.getChildren(), index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
316 } else { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
317 total += value; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
318 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
319 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
320 return total; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
321 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
322 |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
323 private static void printMap(DebugValueMap map, List<DebugValue> debugValues, int level) { |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
324 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
325 printIndent(level); |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
326 TTY.println("%s", map.getName()); |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
327 |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
328 for (DebugValue value : debugValues) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
329 long l = map.getCurrentValue(value.getIndex()); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
330 if (l != 0) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
331 printIndent(level + 1); |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
332 TTY.println(value.getName() + "=" + value.toString(l)); |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
333 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
334 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
335 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
336 for (DebugValueMap child : map.getChildren()) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
337 printMap(child, debugValues, level + 1); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
338 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
339 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
340 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
341 private static void printIndent(int level) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
342 for (int i = 0; i < level; ++i) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
343 TTY.print(" "); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
344 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
345 TTY.print("|-> "); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
349 public boolean compileMethod(final HotSpotResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable { |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
350 if (CompilationTask.withinEnqueue.get()) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
351 // This is required to avoid deadlocking a compiler thread. The issue is that a |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
352 // java.util.concurrent.BlockingQueue is used to implement the compilation worker |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
353 // queues. If a compiler thread triggers a compilation, then it may be blocked trying |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
354 // to add something to its own queue. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
355 return false; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
356 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
357 CompilationTask.withinEnqueue.set(Boolean.TRUE); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
358 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
359 try { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
360 CompilationTask current = method.currentTask(); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
361 if (!blocking && current != null) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
362 if (GraalOptions.PriorityCompileQueue) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
363 // normally compilation tasks will only be re-queued when they get a priority boost, so cancel the old task and add a new one |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
364 current.cancel(); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
365 } else { |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
366 // without a prioritizing compile queue it makes no sense to re-queue the compilation task |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
367 return true; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
368 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
370 |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
371 final OptimisticOptimizations optimisticOpts = new OptimisticOptimizations(method); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
372 int id = compileTaskIds.incrementAndGet(); |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
373 CompilationTask task = CompilationTask.create(graalRuntime, createPhasePlan(optimisticOpts), optimisticOpts, method, id, priority); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
374 if (blocking) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
375 task.runCompilation(); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
376 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
377 try { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
378 method.setCurrentTask(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
379 if (GraalOptions.SlowCompileThreads && priority > GraalOptions.SlowQueueCutoff) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
380 slowCompileQueue.execute(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
381 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
382 compileQueue.execute(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
383 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
384 } catch (RejectedExecutionException e) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
385 // The compile queue was already shut down. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
386 return false; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
387 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
388 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
389 return true; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
390 } finally { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
391 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
396 public JavaMethod createJavaMethod(String name, String signature, JavaType holder) { |
5530
9da759562a42
Remove compiler member field from HotSpot's implementation of the Ri* interfaces.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5529
diff
changeset
|
397 return new HotSpotMethodUnresolved(name, signature, holder); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
401 public Signature createSignature(String signature) { |
5530
9da759562a42
Remove compiler member field from HotSpot's implementation of the Ri* interfaces.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5529
diff
changeset
|
402 return new HotSpotSignature(signature); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
406 public JavaField createJavaField(JavaType holder, String name, JavaType type, int offset, int flags) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 if (offset != -1) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
408 HotSpotResolvedJavaType resolved = (HotSpotResolvedJavaType) holder; |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5769
diff
changeset
|
409 return resolved.createField(name, type, offset, flags); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
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:
6526
diff
changeset
|
411 return new HotSpotUnresolvedField(holder, name, type); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
415 public ResolvedJavaType createPrimitiveJavaType(int basicType) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 switch (basicType) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 case 4: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 return typeBoolean; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 case 5: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 return typeChar; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 case 6: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 return typeFloat; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 case 7: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 return typeDouble; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
425 case 8: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 return typeByte; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 case 9: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 return typeShort; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 case 10: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 return typeInt; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 case 11: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 return typeLong; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 case 14: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 return typeVoid; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 throw new IllegalArgumentException("Unknown basic type: " + basicType); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
441 public JavaType createJavaType(String name) { |
5530
9da759562a42
Remove compiler member field from HotSpot's implementation of the Ri* interfaces.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5529
diff
changeset
|
442 return new HotSpotTypeUnresolved(name); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
446 public Constant createConstant(Kind kind, long value) { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
447 if (kind == Kind.Long) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
448 return Constant.forLong(value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
449 } else if (kind == Kind.Int) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
450 return Constant.forInt((int) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
451 } else if (kind == Kind.Short) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
452 return Constant.forShort((short) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
453 } else if (kind == Kind.Char) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
454 return Constant.forChar((char) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
455 } else if (kind == Kind.Byte) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
456 return Constant.forByte((byte) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
457 } else if (kind == Kind.Boolean) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
458 return (value == 0) ? Constant.FALSE : Constant.TRUE; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
459 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 throw new IllegalArgumentException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
465 public Constant createConstantFloat(float value) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
466 return Constant.forFloat(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
470 public Constant createConstantDouble(double value) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
471 return Constant.forDouble(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
475 public Constant createConstantObject(Object object) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
476 return Constant.forObject(object); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 } |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
478 |
5138 | 479 |
5323
bb6c9818cd03
the phase plan used whether compiling via HotSpotRuntime.compileMethod() or VMToCompilerImpl.compileMethod() is now the same
Doug Simon <doug.simon@oracle.com>
parents:
5318
diff
changeset
|
480 public PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts) { |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
481 PhasePlan phasePlan = new PhasePlan(); |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
482 GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts); |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
483 phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); |
4463 | 484 if (GraalOptions.Intrinsify) { |
485 phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy); | |
486 } | |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
487 return phasePlan; |
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
488 } |
5328
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
489 |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
490 @Override |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
491 public PrintStream log() { |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
492 return log; |
e4e02131c58b
log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
493 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 } |