Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java @ 6682:504a6ab40bb7
remove unnecessary assertion in OSR compilation
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 07 Nov 2012 16:22:11 +0100 |
parents | 3dddb311395f |
children | 98d691bc23da 41938af2b3d8 8d16b9b2c51e |
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.*; |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
38 import com.oracle.graal.hotspot.phases.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.hotspot.snippets.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.java.*; |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
41 import com.oracle.graal.nodes.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
42 import com.oracle.graal.phases.*; |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
43 import com.oracle.graal.phases.PhasePlan.PhasePosition; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.snippets.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 * Exits from the HotSpot VM into Java code. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 */ |
5529
d487ae06265d
Move graal.hotspot.server into its own project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5526
diff
changeset
|
49 public class VMToCompilerImpl implements VMToCompiler { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
51 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
|
52 private IntrinsifyArrayCopyPhase intrinsifyArrayCopy; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 public final HotSpotTypePrimitive typeBoolean; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 public final HotSpotTypePrimitive typeChar; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 public final HotSpotTypePrimitive typeFloat; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 public final HotSpotTypePrimitive typeDouble; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 public final HotSpotTypePrimitive typeByte; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 public final HotSpotTypePrimitive typeShort; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 public final HotSpotTypePrimitive typeInt; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 public final HotSpotTypePrimitive typeLong; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 public final HotSpotTypePrimitive typeVoid; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 private ThreadPoolExecutor compileQueue; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
65 private ThreadPoolExecutor slowCompileQueue; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
66 private AtomicInteger compileTaskIds = new AtomicInteger(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
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
|
68 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
|
69 |
5534
e0f7a49129f2
Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
70 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
|
71 this.graalRuntime = compiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
73 typeBoolean = new HotSpotTypePrimitive(Kind.Boolean); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
74 typeChar = new HotSpotTypePrimitive(Kind.Char); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
75 typeFloat = new HotSpotTypePrimitive(Kind.Float); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
76 typeDouble = new HotSpotTypePrimitive(Kind.Double); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
77 typeByte = new HotSpotTypePrimitive(Kind.Byte); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
78 typeShort = new HotSpotTypePrimitive(Kind.Short); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
79 typeInt = new HotSpotTypePrimitive(Kind.Int); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
80 typeLong = new HotSpotTypePrimitive(Kind.Long); |
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
81 typeVoid = new HotSpotTypePrimitive(Kind.Void); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 } 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
|
90 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
|
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 } |
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
|
93 |
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
|
94 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
|
95 |
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 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
|
97 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
|
98 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
|
99 } |
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
|
100 } |
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
|
101 |
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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 // Install intrinsics. |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
108 GraalCompiler compiler = graalRuntime.getCompiler(); |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
109 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
|
110 if (GraalOptions.Intrinsify) { |
5763
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
111 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
|
112 |
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
|
113 @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
|
114 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
|
115 VMToCompilerImpl.this.intrinsifyArrayCopy = new IntrinsifyArrayCopyPhase(runtime); |
5780
64257cbef60c
removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
116 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
|
117 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
|
118 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
|
119 } |
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
|
120 }); |
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
|
121 |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4171
diff
changeset
|
122 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 // Create compilation queue. |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
125 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
|
126 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
|
127 |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
128 if (GraalOptions.SlowCompileThreads) { |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
129 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
|
130 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
|
131 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 // Create queue status printing thread. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 if (GraalOptions.PrintQueue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 Thread t = new Thread() { |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
136 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 public void run() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 while (true) { |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
140 if (slowCompileQueue == null) { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
141 TTY.println(compileQueue.toString()); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
142 } else { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
143 TTY.println("fast: " + compileQueue.toString() + " slow: " + slowCompileQueue); |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
144 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 Thread.sleep(1000); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 } catch (InterruptedException e) { |
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 t.setDaemon(true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 t.start(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 |
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
|
157 /** |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
158 * 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
|
159 * 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
|
160 * 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
|
161 */ |
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 @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
|
163 @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
|
164 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
|
165 // 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
|
166 } |
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
|
167 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 public void bootstrap() throws Throwable { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 TTY.print("Bootstrapping Graal"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 TTY.flush(); |
4168
0bc4815d2069
Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
171 long startTime = System.currentTimeMillis(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
173 boolean firstRun = true; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
174 do { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
175 // 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
|
176 Class<Object> objectKlass = Object.class; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
177 if (firstRun) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
178 enqueue(getClass().getDeclaredMethod("compileWarmup")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
179 enqueue(objectKlass.getDeclaredMethod("equals", Object.class)); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
180 enqueue(objectKlass.getDeclaredMethod("toString")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
181 firstRun = false; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
182 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
183 for (int i = 0; i < 100; i++) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
184 enqueue(getClass().getDeclaredMethod("bootstrap")); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
185 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
186 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
188 // Compile until the queue is empty. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
189 int z = 0; |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
190 while (true) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
191 try { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
192 assert !CompilationTask.withinEnqueue.get(); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
193 CompilationTask.withinEnqueue.set(Boolean.TRUE); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
194 if (slowCompileQueue == null) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
195 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
|
196 break; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
197 } |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
198 } else { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
199 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
|
200 break; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
201 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
202 } |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
203 } finally { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
204 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
205 } |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
206 |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
207 Thread.sleep(100); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
208 while (z < compileQueue.getCompletedTaskCount() / 100) { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
209 ++z; |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
210 TTY.print("."); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
211 TTY.flush(); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
212 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
214 } 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
|
215 CompilationStatistics.clear("bootstrap"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 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
|
218 if (graalRuntime.getCache() != null) { |
a3d71693e0ce
removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
219 graalRuntime.getCache().clear(); |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5176
diff
changeset
|
220 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 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
|
222 CompilationStatistics.clear("bootstrap2"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 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
|
226 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
|
227 assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) : javaMethod; |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
228 compileMethod((HotSpotResolvedJavaMethod) javaMethod, StructuredGraph.INVOCATION_ENTRY_BCI, false, 10); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 |
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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 // 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
|
236 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
|
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 } |
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
|
239 } |
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
|
240 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 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
|
242 try { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
243 assert !CompilationTask.withinEnqueue.get(); |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
244 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
|
245 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
|
246 shutdownCompileQueue(slowCompileQueue); |
5263
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
247 } finally { |
d87155082c4d
guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
5183
diff
changeset
|
248 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
249 } |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
250 |
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
|
251 |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
252 if (Debug.isEnabled()) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
253 List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps(); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
254 List<DebugValue> debugValues = KeyRegistry.getDebugValues(); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
255 if (debugValues.size() > 0) { |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
256 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
|
257 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
|
258 |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
259 if (GraalOptions.SummarizeDebugValues) { |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
260 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
|
261 } else if (GraalOptions.PerThreadDebugValues) { |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
262 for (DebugValueMap map : topLevelMaps) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
263 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
|
264 map.group(); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
265 map.normalize(); |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
266 printMap(map, sortedValues, 0); |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
267 } |
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
|
268 } 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 } 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
|
274 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
|
275 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
|
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 } |
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 } |
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 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
|
280 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
|
281 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
282 globalMap.normalize(); |
5386
19e5dc8d0891
alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents:
5367
diff
changeset
|
283 printMap(globalMap, sortedValues, 0); |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
284 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
285 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
286 } |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
287 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
|
288 SnippetCounter.printGroups(TTY.out().out()); |
4563
b27666ff9bd6
added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4560
diff
changeset
|
289 } |
b27666ff9bd6
added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4560
diff
changeset
|
290 |
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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 } |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
296 map.clearChildren(); |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
297 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
298 |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
299 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
|
300 DebugValueMap result = new DebugValueMap("Summary"); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
301 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
|
302 DebugValue debugValue = debugValues.get(i); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
303 int index = debugValue.getIndex(); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
304 long total = collectTotal(topLevelMaps, index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
305 result.setCurrentValue(index, total); |
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 printMap(result, debugValues, 0); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
308 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
309 |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
310 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
|
311 long total = 0; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
312 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
|
313 DebugValueMap map = maps.get(i); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
314 // 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
|
315 long value = map.getCurrentValue(index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
316 if (value == 0) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
317 total += collectTotal(map.getChildren(), index); |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
318 } else { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
319 total += value; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
320 } |
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 return total; |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
323 } |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
324 |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4479
diff
changeset
|
325 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
|
326 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
327 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
|
328 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
|
329 |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
330 for (DebugValue value : debugValues) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
331 long l = map.getCurrentValue(value.getIndex()); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
332 if (l != 0) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
333 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
|
334 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
|
335 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
336 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
337 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
338 for (DebugValueMap child : map.getChildren()) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
339 printMap(child, debugValues, level + 1); |
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 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
342 |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
343 private static void printIndent(int level) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
344 for (int i = 0; i < level; ++i) { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
345 TTY.print(" "); |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
346 } |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4366
diff
changeset
|
347 TTY.print("|-> "); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
351 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
|
352 if (CompilationTask.withinEnqueue.get()) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
353 // 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
|
354 // 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
|
355 // 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
|
356 // to add something to its own queue. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
357 return false; |
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 CompilationTask.withinEnqueue.set(Boolean.TRUE); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
360 |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
361 try { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
362 CompilationTask current = method.currentTask(); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
363 if (!blocking && current != null) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
364 if (GraalOptions.PriorityCompileQueue) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
365 // 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
|
366 current.cancel(); |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
367 } else { |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
368 // 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
|
369 return true; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5164
diff
changeset
|
370 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
372 |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
373 final OptimisticOptimizations optimisticOpts = new OptimisticOptimizations(method); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
374 int id = compileTaskIds.incrementAndGet(); |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
375 CompilationTask task = CompilationTask.create(graalRuntime, createPhasePlan(optimisticOpts, false), optimisticOpts, method, StructuredGraph.INVOCATION_ENTRY_BCI, id, priority, null); |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
376 if (blocking) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
377 task.runCompilation(); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
378 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
379 try { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
380 method.setCurrentTask(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
381 if (GraalOptions.SlowCompileThreads && priority > GraalOptions.SlowQueueCutoff) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
382 slowCompileQueue.execute(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
383 } else { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
384 compileQueue.execute(task); |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
385 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
386 } catch (RejectedExecutionException e) { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
387 // The compile queue was already shut down. |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
388 return false; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
389 } |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
390 } |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
391 if (entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI && CompilationTask.withinCompilation.get() == 0) { |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
392 final OptimisticOptimizations osrOptimisticOpts = new OptimisticOptimizations(method); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
393 int osrId = compileTaskIds.incrementAndGet(); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
394 Debug.log("OSR compilation %s@%d", method, entryBCI); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
395 final CountDownLatch latch = new CountDownLatch(1); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
396 Runnable callback = new Runnable() { |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
397 @Override |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
398 public void run() { |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
399 latch.countDown(); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
400 } |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
401 }; |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
402 CompilationTask osrTask = CompilationTask.create(graalRuntime, createPhasePlan(osrOptimisticOpts, true), osrOptimisticOpts, method, entryBCI, osrId, Integer.MAX_VALUE, callback); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
403 compileQueue.execute(osrTask); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
404 latch.await(); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
405 } |
5183
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
406 return true; |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
407 } finally { |
e1e681a5558e
fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents:
5177
diff
changeset
|
408 CompilationTask.withinEnqueue.set(Boolean.FALSE); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
413 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
|
414 return new HotSpotMethodUnresolved(name, signature, holder); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
418 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
|
419 return new HotSpotSignature(signature); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
423 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
|
424 if (offset != -1) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
425 HotSpotResolvedJavaType resolved = (HotSpotResolvedJavaType) holder; |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5769
diff
changeset
|
426 return resolved.createField(name, type, offset, flags); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 } |
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
|
428 return new HotSpotUnresolvedField(holder, name, type); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
432 public ResolvedJavaType createPrimitiveJavaType(int basicType) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 switch (basicType) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 case 4: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 return typeBoolean; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 case 5: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 return typeChar; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 case 6: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 return typeFloat; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 case 7: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 return typeDouble; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 case 8: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 return typeByte; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 case 9: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 return typeShort; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 case 10: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
447 return typeInt; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 case 11: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 return typeLong; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
450 case 14: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
451 return typeVoid; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
452 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 throw new IllegalArgumentException("Unknown basic type: " + basicType); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
455 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
458 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
|
459 return new HotSpotTypeUnresolved(name); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 } |
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 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
463 public Constant createConstant(Kind kind, long value) { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
464 if (kind == Kind.Long) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
465 return Constant.forLong(value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
466 } else if (kind == Kind.Int) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
467 return Constant.forInt((int) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
468 } else if (kind == Kind.Short) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
469 return Constant.forShort((short) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
470 } else if (kind == Kind.Char) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
471 return Constant.forChar((char) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
472 } else if (kind == Kind.Byte) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
473 return Constant.forByte((byte) value); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
474 } else if (kind == Kind.Boolean) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
475 return (value == 0) ? Constant.FALSE : Constant.TRUE; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 throw new IllegalArgumentException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
482 public Constant createConstantFloat(float value) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
483 return Constant.forFloat(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
487 public Constant createConstantDouble(double value) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
488 return Constant.forDouble(value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
489 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 @Override |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
492 public Constant createConstantObject(Object object) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
493 return Constant.forObject(object); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 } |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
495 |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
496 public PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts, boolean onStackReplacement) { |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
497 PhasePlan phasePlan = new PhasePlan(); |
6677
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
498 phasePlan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts)); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
499 if (onStackReplacement) { |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
500 phasePlan.addPhase(PhasePosition.AFTER_PARSING, new OnStackReplacementPhase()); |
3dddb311395f
hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
501 } |
4463 | 502 if (GraalOptions.Intrinsify) { |
503 phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy); | |
504 } | |
4420
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
505 return phasePlan; |
97e0fb1f4906
Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4410
diff
changeset
|
506 } |
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
|
507 |
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
|
508 @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
|
509 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
|
510 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
|
511 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 } |