Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java @ 12490:4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 18 Oct 2013 23:55:35 +0200 |
parents | 1a4dc163cd0a |
children | 128bf29518a0 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
7784
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7714
diff
changeset
|
25 import static com.oracle.graal.graph.UnsafeAccess.*; |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.Options.*; |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
27 |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
28 import java.lang.reflect.*; |
7156
29ee920b35dd
make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents:
7152
diff
changeset
|
29 import java.util.*; |
6462 | 30 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
31 import sun.misc.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
32 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
33 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5503
diff
changeset
|
34 import com.oracle.graal.api.meta.*; |
6540
31aa76ffd3bb
Rename project graal.api to graal.api.runtime
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
35 import com.oracle.graal.api.runtime.*; |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
36 import com.oracle.graal.compiler.target.*; |
9936
0927013db134
fail fast if a non-default value for GraalRuntime was specified and the corresponding factory is not available
Doug Simon <doug.simon@oracle.com>
parents:
9914
diff
changeset
|
37 import com.oracle.graal.graph.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.hotspot.bridge.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.hotspot.logging.*; |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
40 import com.oracle.graal.hotspot.meta.*; |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
41 import com.oracle.graal.options.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6521
diff
changeset
|
42 import com.oracle.graal.phases.*; |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
43 import com.oracle.graal.runtime.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 /** |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
46 * Singleton class holding the instance of the {@link GraalRuntime}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 */ |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
48 public final class HotSpotGraalRuntime implements GraalRuntime, RuntimeProvider { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
50 private static final HotSpotGraalRuntime instance = new HotSpotGraalRuntime(); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
51 static { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
52 instance.completeInitialization(); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
53 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
55 /** |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9108
diff
changeset
|
56 * Gets the singleton {@link HotSpotGraalRuntime} object. |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
57 */ |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12430
diff
changeset
|
58 public static HotSpotGraalRuntime runtime() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
59 assert instance != null; |
5532
82f2bb47c97e
Clean up on HotSpotCompilerImpl class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5526
diff
changeset
|
60 return instance; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
63 /** |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
64 * Do deferred initialization. |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
65 */ |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
66 public void completeInitialization() { |
7152
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
67 |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
68 // Proxies for the VM/Compiler interfaces cannot be initialized |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
69 // in the constructor as proxy creation causes static |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
70 // initializers to be executed for all the types involved in the |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
71 // proxied methods. Some of these static initializers (e.g. in |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
72 // HotSpotMethodData) rely on the static 'instance' field being set |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
73 // to retrieve configuration details. |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
74 VMToCompiler toCompiler = this.vmToCompiler; |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
75 CompilerToVM toVM = this.compilerToVm; |
7152
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
76 |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
77 if (CountingProxy.ENABLED) { |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
78 toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler); |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
79 toVM = CountingProxy.getProxy(CompilerToVM.class, toVM); |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
80 } |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
81 if (Logger.ENABLED) { |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
82 toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler); |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
83 toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM); |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
84 } |
e86ac899c5be
fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents:
7098
diff
changeset
|
85 |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
86 this.vmToCompiler = toCompiler; |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
87 this.compilerToVm = toVM; |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
88 } |
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
89 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
90 // Options must not be directly declared in HotSpotGraalRuntime - see VerifyOptionsPhase |
11420
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
91 static class Options { |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
92 |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
93 // @formatter:off |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
94 @Option(help = "The runtime configuration to use") |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
95 static final OptionValue<String> GraalRuntime = new OptionValue<>(""); |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
96 // @formatter:on |
7c4c1a7c875a
made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents:
11275
diff
changeset
|
97 } |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
98 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
99 private static HotSpotBackendFactory findFactory(String architecture) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
100 HotSpotBackendFactory basic = null; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
101 HotSpotBackendFactory selected = null; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
102 HotSpotBackendFactory nonBasic = null; |
10509
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
103 int nonBasicCount = 0; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
104 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
105 for (HotSpotBackendFactory factory : ServiceLoader.loadInstalled(HotSpotBackendFactory.class)) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
106 if (factory.getArchitecture().equalsIgnoreCase(architecture)) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
107 if (factory.getGraalRuntimeName().equals(GraalRuntime.getValue())) { |
10509
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
108 assert selected == null; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
109 selected = factory; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
110 } |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
111 if (factory.getGraalRuntimeName().equals("basic")) { |
10509
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
112 assert basic == null; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
113 basic = factory; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
114 } else { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
115 nonBasic = factory; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
116 nonBasicCount++; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
117 } |
9429
aaf8798b0969
Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9289
diff
changeset
|
118 } |
aaf8798b0969
Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9289
diff
changeset
|
119 } |
10509
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
120 |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
121 if (selected != null) { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
122 return selected; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
123 } else { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
124 if (!GraalRuntime.getValue().equals("")) { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
125 // Fail fast if a non-default value for GraalRuntime was specified |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
126 // and the corresponding factory is not available |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
127 throw new GraalInternalError("Specified runtime \"%s\" not available for the %s architecture", GraalRuntime.getValue(), architecture); |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
128 } else if (nonBasicCount == 1) { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
129 // If there is exactly one non-basic runtime, select this one. |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
130 return nonBasic; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
131 } else { |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
132 return basic; |
fcc5fb4e2b9e
New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
133 } |
9936
0927013db134
fail fast if a non-default value for GraalRuntime was specified and the corresponding factory is not available
Doug Simon <doug.simon@oracle.com>
parents:
9914
diff
changeset
|
134 } |
9429
aaf8798b0969
Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9289
diff
changeset
|
135 } |
aaf8798b0969
Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents:
9289
diff
changeset
|
136 |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6950
diff
changeset
|
137 /** |
12464
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12462
diff
changeset
|
138 * Gets the kind of a word value on the {@linkplain #getHostBackend() host} backend. |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6950
diff
changeset
|
139 */ |
12464
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12462
diff
changeset
|
140 public static Kind getHostWordKind() { |
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12462
diff
changeset
|
141 return instance.getHostBackend().getTarget().wordKind; |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6505
diff
changeset
|
142 } |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6505
diff
changeset
|
143 |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
144 /** |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
145 * Reads a word value from a given address. |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
146 */ |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
147 public static long unsafeReadWord(long address) { |
12464
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12462
diff
changeset
|
148 if (getHostWordKind() == Kind.Long) { |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
149 return unsafe.getLong(address); |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
150 } |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
151 return unsafe.getInt(address); |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
152 } |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
153 |
8472
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
154 /** |
10715
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
155 * Reads a klass pointer from a constant object. |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
156 */ |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
157 public static long unsafeReadKlassPointer(Object object) { |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
158 return instance.getCompilerToVM().readUnsafeKlassPointer(object); |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
159 } |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
160 |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10509
diff
changeset
|
161 /** |
8472
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
162 * Reads a word value from a given object. |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
163 */ |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
164 public static long unsafeReadWord(Object object, long offset) { |
12464
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12462
diff
changeset
|
165 if (getHostWordKind() == Kind.Long) { |
8472
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
166 return unsafe.getLong(object, offset); |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
167 } |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
168 return unsafe.getInt(object, offset); |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
169 } |
f71fec3fadae
made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
170 |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
171 protected/* final */CompilerToVM compilerToVm; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
172 protected/* final */CompilerToGPU compilerToGpu; |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
173 protected/* final */VMToCompiler vmToCompiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
175 private HotSpotRuntimeInterpreterInterface runtimeInterpreterInterface; |
5308
820fce52a244
moved GraphCache to platform specific part, solved class unloading problem
Lukas Stadler <lukas.stadler@jku.at>
parents:
5292
diff
changeset
|
176 private volatile HotSpotGraphCache cache; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
178 protected final HotSpotVMConfig config; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
179 private final HotSpotBackend hostBackend; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
181 private final Map<Class<? extends Architecture>, HotSpotBackend> backends = new HashMap<>(); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
182 |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
183 private HotSpotGraalRuntime() { |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
184 CompilerToVM toVM = new CompilerToVMImpl(); |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
185 CompilerToGPU toGPU = new CompilerToGPUImpl(); |
5289
6519cf82d390
remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents:
5278
diff
changeset
|
186 VMToCompiler toCompiler = new VMToCompilerImpl(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
188 compilerToVm = toVM; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
189 compilerToGpu = toGPU; |
5289
6519cf82d390
remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents:
5278
diff
changeset
|
190 vmToCompiler = toCompiler; |
11430
a7dd2d728500
made all public, non-static fields in HotSpotVMConfig final
Doug Simon <doug.simon@oracle.com>
parents:
11420
diff
changeset
|
191 config = new HotSpotVMConfig(compilerToVm); |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
192 |
8996
6d86ce1297bc
GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents:
8637
diff
changeset
|
193 // Set some global options: |
9108 | 194 if (config.compileTheWorld) { |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
195 GraalOptions.CompileTheWorld.setValue(CompileTheWorld.SUN_BOOT_CLASS_PATH); |
9108 | 196 } |
197 if (config.compileTheWorldStartAt != 1) { | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
198 GraalOptions.CompileTheWorldStartAt.setValue(config.compileTheWorldStartAt); |
9108 | 199 } |
200 if (config.compileTheWorldStopAt != Integer.MAX_VALUE) { | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
201 GraalOptions.CompileTheWorldStopAt.setValue(config.compileTheWorldStopAt); |
9108 | 202 } |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
203 GraalOptions.HotSpotPrintCompilation.setValue(config.printCompilation); |
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
204 GraalOptions.HotSpotPrintInlining.setValue(config.printInlining); |
8996
6d86ce1297bc
GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents:
8637
diff
changeset
|
205 |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
206 if (Boolean.valueOf(System.getProperty("graal.printconfig"))) { |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
207 printConfig(config); |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
208 } |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
209 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
210 String hostArchitecture = getHostArchitectureName(); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
211 hostBackend = registerBackend(findFactory(hostArchitecture).createBackend(this, null)); |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6505
diff
changeset
|
212 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
213 String[] gpuArchitectures = getGPUArchitectureNames(); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
214 for (String arch : gpuArchitectures) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
215 HotSpotBackendFactory factory = findFactory(arch); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
216 if (factory == null) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
217 throw new GraalInternalError("No backend available for specified GPU architecture \"%s\"", arch); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
218 } |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
219 registerBackend(factory.createBackend(this, hostBackend)); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
220 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
221 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
222 GraalOptions.StackShadowPages.setValue(config.stackShadowPages); |
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
223 if (GraalOptions.CacheGraphs.getValue()) { |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
224 cache = new HotSpotGraphCache(compilerToVm); |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
225 } |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
226 } |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
227 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
228 private HotSpotBackend registerBackend(HotSpotBackend backend) { |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
229 Class<? extends Architecture> arch = backend.getTarget().arch.getClass(); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
230 HotSpotBackend oldValue = backends.put(arch, backend); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
231 assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName(); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
232 return backend; |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
233 } |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
234 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
235 /** |
12462
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
236 * Gets the host architecture name for the purpose of finding the corresponding |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
237 * {@linkplain HotSpotBackendFactory backend}. |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
238 */ |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
239 private static String getHostArchitectureName() { |
12462
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
240 String arch = System.getProperty("os.arch"); |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
241 switch (arch) { |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
242 case "x86_64": |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
243 // This is what Mac OS X reports; |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
244 arch = "amd64"; |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
245 break; |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
246 } |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
247 return arch; |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
248 } |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
249 |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
250 public static final String GRAAL_GPU_ISALIST_PROPERTY_NAME = "graal.gpu.isalist"; |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
251 |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
252 /** |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
253 * Gets the names of the supported GPU architectures for the purpose of finding the |
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
254 * corresponding {@linkplain HotSpotBackendFactory backend} objects. This method first looks for |
12490
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
255 * a comma or {@link java.io.File#pathSeparatorChar} separated list of names in the |
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
256 * {@value #GRAAL_GPU_ISALIST_PROPERTY_NAME} system property. If this property is not set, then |
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
257 * the GPU native support code is queried. |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
258 */ |
12490
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
259 private static String[] getGPUArchitectureNames() { |
12462
88d451c7c484
factored out retrieving the host architecture name to handle variations in value of os.arch system property
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
260 String gpuList = System.getProperty(GRAAL_GPU_ISALIST_PROPERTY_NAME); |
12490
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
261 if (gpuList != null && !gpuList.isEmpty()) { |
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
262 String[] gpus = gpuList.split("[,:]"); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
263 return gpus; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
264 } |
12490
4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
265 return new String[0]; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
266 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
267 |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
268 private static void printConfig(HotSpotVMConfig config) { |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
269 Field[] fields = config.getClass().getDeclaredFields(); |
7156
29ee920b35dd
make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents:
7152
diff
changeset
|
270 Map<String, Field> sortedFields = new TreeMap<>(); |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
271 for (Field f : fields) { |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
272 f.setAccessible(true); |
7156
29ee920b35dd
make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents:
7152
diff
changeset
|
273 sortedFields.put(f.getName(), f); |
29ee920b35dd
make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents:
7152
diff
changeset
|
274 } |
29ee920b35dd
make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents:
7152
diff
changeset
|
275 for (Field f : sortedFields.values()) { |
5186
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
276 try { |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
277 Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config)))); |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
278 } catch (Exception e) { |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
279 } |
b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents:
5177
diff
changeset
|
280 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
283 public HotSpotVMConfig getConfig() { |
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
284 return config; |
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
285 } |
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
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 public TargetDescription getTarget() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
288 return hostBackend.getTarget(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
291 public HotSpotGraphCache getGraphCache() { |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
292 return cache; |
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
293 } |
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
294 |
5278
74dfa6f86879
removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
295 public CompilerToVM getCompilerToVM() { |
74dfa6f86879
removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
296 return compilerToVm; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 |
5278
74dfa6f86879
removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
299 public VMToCompiler getVMToCompiler() { |
74dfa6f86879
removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
300 return vmToCompiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
303 public CompilerToGPU getCompilerToGPU() { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
304 return compilerToGpu; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
305 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
9429
diff
changeset
|
306 |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7037
diff
changeset
|
307 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve) { |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
6543
diff
changeset
|
308 if (name.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
309 VMToCompilerImpl impl = (VMToCompilerImpl) vmToCompiler; |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
6543
diff
changeset
|
310 Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
311 switch (kind) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 case Boolean: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
313 return impl.typeBoolean; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 case Byte: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
315 return impl.typeByte; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 case Char: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
317 return impl.typeChar; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 case Double: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
319 return impl.typeDouble; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 case Float: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
321 return impl.typeFloat; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 case Illegal: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 case Int: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
325 return impl.typeInt; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
326 case Long: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
327 return impl.typeLong; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 case Short: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
331 return impl.typeShort; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 case Void: |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
333 return impl.typeVoid; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
335 } |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
6543
diff
changeset
|
336 return compilerToVm.lookupType(name, accessingClass, eagerResolve); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
337 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
338 |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
339 public HotSpotRuntimeInterpreterInterface getRuntimeInterpreterInterface() { |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
340 if (runtimeInterpreterInterface == null) { |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
341 runtimeInterpreterInterface = new HotSpotRuntimeInterpreterInterface(getHostProviders().getMetaAccess()); |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
342 } |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
343 return runtimeInterpreterInterface; |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
344 } |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5720
diff
changeset
|
345 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
346 public HotSpotProviders getHostProviders() { |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
347 return getHostBackend().getProviders(); |
5292
796917d3bfc9
move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents:
5289
diff
changeset
|
348 } |
5526
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
349 |
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
350 @Override |
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
351 public String getName() { |
6505
1ecf984d490c
fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
352 return getClass().getSimpleName(); |
5526
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
353 } |
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
354 |
5533
c5c13f3ed5c4
Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5532
diff
changeset
|
355 @SuppressWarnings("unchecked") |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
356 @Override |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
357 public <T> T getCapability(Class<T> clazz) { |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
358 if (clazz == RuntimeProvider.class) { |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
359 return (T) this; |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
360 } |
5526
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
361 return null; |
87e4aed94b26
Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5514
diff
changeset
|
362 } |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
363 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
364 public HotSpotBackend getHostBackend() { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
365 return hostBackend; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
366 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
367 |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
368 public <T extends Architecture> Backend getBackend(Class<T> arch) { |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
369 assert arch != Architecture.class; |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
370 return backends.get(arch); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
371 } |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
372 |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12464
diff
changeset
|
373 public Map<Class<? extends Architecture>, HotSpotBackend> getBackends() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
374 return Collections.unmodifiableMap(backends); |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
375 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
376 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
377 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
378 * The offset from the origin of an array to the first element. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
379 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
380 * @return the offset in bytes |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
381 */ |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
382 public static int getArrayBaseOffset(Kind kind) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
383 switch (kind) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
384 case Boolean: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
385 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
386 case Byte: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
387 return Unsafe.ARRAY_BYTE_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
388 case Char: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
389 return Unsafe.ARRAY_CHAR_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
390 case Short: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
391 return Unsafe.ARRAY_SHORT_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
392 case Int: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
393 return Unsafe.ARRAY_INT_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
394 case Long: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
395 return Unsafe.ARRAY_LONG_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
396 case Float: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
397 return Unsafe.ARRAY_FLOAT_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
398 case Double: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
399 return Unsafe.ARRAY_DOUBLE_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
400 case Object: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
401 return Unsafe.ARRAY_OBJECT_BASE_OFFSET; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
402 default: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
403 throw GraalInternalError.shouldNotReachHere(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
404 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
405 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
406 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
407 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
408 * The scale used for the index when accessing elements of an array of this kind. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
409 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
410 * @return the scale in order to convert the index into a byte offset |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
411 */ |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
412 public static int getArrayIndexScale(Kind kind) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
413 switch (kind) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
414 case Boolean: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
415 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
416 case Byte: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
417 return Unsafe.ARRAY_BYTE_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
418 case Char: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
419 return Unsafe.ARRAY_CHAR_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
420 case Short: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
421 return Unsafe.ARRAY_SHORT_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
422 case Int: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
423 return Unsafe.ARRAY_INT_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
424 case Long: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
425 return Unsafe.ARRAY_LONG_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
426 case Float: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
427 return Unsafe.ARRAY_FLOAT_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
428 case Double: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
429 return Unsafe.ARRAY_DOUBLE_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
430 case Object: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
431 return Unsafe.ARRAY_OBJECT_INDEX_SCALE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
432 default: |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
433 throw GraalInternalError.shouldNotReachHere(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
434 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
435 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 } |