annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java @ 13353:0e5c4f9fa9a5

enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
author Doug Simon <doug.simon@oracle.com>
date Mon, 16 Dec 2013 23:33:40 +0100
parents fdd6ef90d66d
children 5a6c617a66ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.*;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
26 import static com.oracle.graal.hotspot.CompileTheWorld.*;
11420
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
27 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.Options.*;
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
28 import static com.oracle.graal.phases.GraalOptions.*;
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
29
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
30 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
31 import java.util.*;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6404
diff changeset
32
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
33 import sun.misc.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
34
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
35 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
36 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
37 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
38 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
39 import com.oracle.graal.graph.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
40 import com.oracle.graal.hotspot.bridge.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
41 import com.oracle.graal.hotspot.logging.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
42 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
43 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
44 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
45 import com.oracle.graal.runtime.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46
13255
785bbb619238 Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13253
diff changeset
47 //JaCoCo Exclude
785bbb619238 Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13253
diff changeset
48
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 /**
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
50 * 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
51 */
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
52 public final class HotSpotGraalRuntime implements GraalRuntime, RuntimeProvider {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
54 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
55 static {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
56 instance.completeInitialization();
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
57 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58
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
59 /**
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9108
diff changeset
60 * 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
61 */
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12430
diff changeset
62 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
63 assert instance != null;
5532
82f2bb47c97e Clean up on HotSpotCompilerImpl class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5526
diff changeset
64 return instance;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66
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
67 /**
11420
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
68 * 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
69 */
11420
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
70 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
71
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
72 // 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
73 // 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
74 // 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
75 // 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
76 // HotSpotMethodData) rely on the static 'instance' field being set
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
77 // to retrieve configuration details.
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
78 VMToCompiler toCompiler = this.vmToCompiler;
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
79 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
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 (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
82 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
83 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
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 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
86 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
87 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
88 }
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
89
11420
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
90 this.vmToCompiler = toCompiler;
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
91 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
92 }
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
93
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
94 // 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
95 static class Options {
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
96
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
97 // @formatter:off
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
98 @Option(help = "The runtime configuration to use")
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
99 static final OptionValue<String> GraalRuntime = new OptionValue<>("");
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
100 // @formatter:on
7c4c1a7c875a made HotSpotGraalRuntime.instance final
Doug Simon <doug.simon@oracle.com>
parents: 11275
diff changeset
101 }
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9430
diff changeset
102
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
103 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
104 HotSpotBackendFactory basic = null;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
105 HotSpotBackendFactory selected = null;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
106 HotSpotBackendFactory nonBasic = null;
10509
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
107 int nonBasicCount = 0;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
108
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
109 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
110 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
111 if (factory.getGraalRuntimeName().equals(GraalRuntime.getValue())) {
12501
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
112 assert selected == null || checkFactoryOverriding(selected, factory);
10509
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
113 selected = factory;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
114 }
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
115 if (factory.getGraalRuntimeName().equals("basic")) {
12501
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
116 assert basic == null || checkFactoryOverriding(basic, factory);
10509
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
117 basic = factory;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
118 } else {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
119 nonBasic = factory;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
120 nonBasicCount++;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
121 }
9429
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
122 }
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
123 }
10509
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
124
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
125 if (selected != null) {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
126 return selected;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
127 } else {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
128 if (!GraalRuntime.getValue().equals("")) {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
129 // 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
130 // 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
131 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
132 } else if (nonBasicCount == 1) {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
133 // 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
134 return nonBasic;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
135 } else {
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
136 return basic;
fcc5fb4e2b9e New strategy for selecting the default runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9968
diff changeset
137 }
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
138 }
9429
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
139 }
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
140
6954
0e20ad1ea98b removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
141 /**
12501
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
142 * Checks that a factory overriding is valid. A factory B can only override/replace a factory A
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
143 * if the B.getClass() is a subclass of A.getClass(). This models the assumption that B is
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
144 * extends the behavior of A and has therefore understood the behavior expected of A.
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
145 *
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
146 * @param baseFactory
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
147 * @param overridingFactory
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
148 */
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
149 private static boolean checkFactoryOverriding(HotSpotBackendFactory baseFactory, HotSpotBackendFactory overridingFactory) {
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
150 return baseFactory.getClass().isAssignableFrom(overridingFactory.getClass());
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
151 }
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
152
128bf29518a0 added limited ability for one HotSpotBackendFactory to override another
Doug Simon <doug.simon@oracle.com>
parents: 12490
diff changeset
153 /**
12464
59ce8d220e11 replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12462
diff changeset
154 * 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
155 */
12464
59ce8d220e11 replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12462
diff changeset
156 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
157 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
158 }
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
159
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
160 /**
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
161 * Reads a word value from a given address.
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
162 */
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
163 public static long unsafeReadWord(long address) {
12670
cf57663a2a36 use getAddress instead of getLong in HotSpotGraalRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12501
diff changeset
164 return unsafe.getAddress(address);
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
165 }
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
166
8472
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
167 /**
10715
c3760150dc29 Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10509
diff changeset
168 * 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
169 */
c3760150dc29 Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10509
diff changeset
170 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
171 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
172 }
c3760150dc29 Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10509
diff changeset
173
c3760150dc29 Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10509
diff changeset
174 /**
8472
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
175 * 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
176 */
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
177 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
178 if (getHostWordKind() == Kind.Long) {
8472
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
179 return unsafe.getLong(object, offset);
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
180 }
12670
cf57663a2a36 use getAddress instead of getLong in HotSpotGraalRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12501
diff changeset
181 return unsafe.getInt(object, offset) & 0xFFFFFFFFL;
8472
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
182 }
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
183
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9430
diff changeset
184 protected/* final */CompilerToVM compilerToVm;
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
185 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
186 protected/* final */VMToCompiler vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
187
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
188 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
189 private volatile HotSpotGraphCache cache;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190
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
191 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
192 private final HotSpotBackend hostBackend;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
193
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
194 public final HotSpotResolvedPrimitiveType typeBoolean;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
195 public final HotSpotResolvedPrimitiveType typeByte;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
196 public final HotSpotResolvedPrimitiveType typeChar;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
197 public final HotSpotResolvedPrimitiveType typeShort;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
198 public final HotSpotResolvedPrimitiveType typeInt;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
199 public final HotSpotResolvedPrimitiveType typeLong;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
200 public final HotSpotResolvedPrimitiveType typeFloat;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
201 public final HotSpotResolvedPrimitiveType typeDouble;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
202 public final HotSpotResolvedPrimitiveType typeVoid;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
203
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
204 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
205
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
206 private HotSpotGraalRuntime() {
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9430
diff changeset
207 CompilerToVM toVM = new CompilerToVMImpl();
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
208 CompilerToGPU toGPU = new CompilerToGPUImpl();
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
209 VMToCompiler toCompiler = new VMToCompilerImpl(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9430
diff changeset
211 compilerToVm = toVM;
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
212 compilerToGpu = toGPU;
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
213 vmToCompiler = toCompiler;
11430
a7dd2d728500 made all public, non-static fields in HotSpotVMConfig final
Doug Simon <doug.simon@oracle.com>
parents: 11420
diff changeset
214 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
215
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
216 typeBoolean = new HotSpotResolvedPrimitiveType(Kind.Boolean);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
217 typeByte = new HotSpotResolvedPrimitiveType(Kind.Byte);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
218 typeChar = new HotSpotResolvedPrimitiveType(Kind.Char);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
219 typeShort = new HotSpotResolvedPrimitiveType(Kind.Short);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
220 typeInt = new HotSpotResolvedPrimitiveType(Kind.Int);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
221 typeLong = new HotSpotResolvedPrimitiveType(Kind.Long);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
222 typeFloat = new HotSpotResolvedPrimitiveType(Kind.Float);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
223 typeDouble = new HotSpotResolvedPrimitiveType(Kind.Double);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
224 typeVoid = new HotSpotResolvedPrimitiveType(Kind.Void);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
225
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
226 initMirror(typeBoolean);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
227 initMirror(typeByte);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
228 initMirror(typeChar);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
229 initMirror(typeShort);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
230 initMirror(typeInt);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
231 initMirror(typeLong);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
232 initMirror(typeFloat);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
233 initMirror(typeDouble);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
234 initMirror(typeVoid);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
235
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
236 // Set some global options:
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
237 if (config.compileTheWorld && CompileTheWorld.Options.CompileTheWorldClasspath.getValue() == null) {
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
238 CompileTheWorld.Options.CompileTheWorldClasspath.setValue(SUN_BOOT_CLASS_PATH);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
239 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
240 if (config.compileTheWorldStartAt != 1) {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
241 CompileTheWorld.Options.CompileTheWorldStartAt.setValue(config.compileTheWorldStartAt);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
242 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
243 if (config.compileTheWorldStopAt != Integer.MAX_VALUE) {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
244 CompileTheWorld.Options.CompileTheWorldStopAt.setValue(config.compileTheWorldStopAt);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
245 }
13171
c302ab46defe don't overwrite the values of HotSpotPrintCompilation and HotSpotPrintInlining
twisti
parents: 12670
diff changeset
246
c302ab46defe don't overwrite the values of HotSpotPrintCompilation and HotSpotPrintInlining
twisti
parents: 12670
diff changeset
247 // Only set HotSpotPrintCompilation and HotSpotPrintInlining if they still have their
c302ab46defe don't overwrite the values of HotSpotPrintCompilation and HotSpotPrintInlining
twisti
parents: 12670
diff changeset
248 // default value (false).
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
249 if (HotSpotPrintCompilation.getValue() == false) {
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
250 HotSpotPrintCompilation.setValue(config.printCompilation);
13171
c302ab46defe don't overwrite the values of HotSpotPrintCompilation and HotSpotPrintInlining
twisti
parents: 12670
diff changeset
251 }
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
252 if (HotSpotPrintInlining.getValue() == false) {
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13258
diff changeset
253 HotSpotPrintInlining.setValue(config.printInlining);
13171
c302ab46defe don't overwrite the values of HotSpotPrintCompilation and HotSpotPrintInlining
twisti
parents: 12670
diff changeset
254 }
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
255
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
256 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
257 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
258 }
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
259
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
260 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
261 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
262
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
263 String[] gpuArchitectures = getGPUArchitectureNames();
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
264 for (String arch : gpuArchitectures) {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
265 HotSpotBackendFactory factory = findFactory(arch);
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
266 if (factory == null) {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
267 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
268 }
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
269 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
270 }
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
271
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9855
diff changeset
272 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
273 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
274 }
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
275 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
276
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
277 private void initMirror(HotSpotResolvedPrimitiveType type) {
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
278 Class<?> mirror = type.mirror();
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
279 final long offset = config.graalMirrorInClassOffset;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
280 unsafe.putObject(mirror, offset, type);
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
281 assert unsafe.getObject(mirror, offset) == type;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
282 }
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
283
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
284 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
285 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
286 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
287 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
288 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
289 }
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
290
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
291 /**
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
292 * 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
293 * {@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
294 */
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
295 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
296 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
297 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
298 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
299 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
300 break;
13253
4d1cd29cceb0 make SPARC run again
twisti
parents: 13252
diff changeset
301 case "sparcv9":
4d1cd29cceb0 make SPARC run again
twisti
parents: 13252
diff changeset
302 arch = "sparc";
4d1cd29cceb0 make SPARC run again
twisti
parents: 13252
diff changeset
303 break;
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
304 }
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
305 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
306 }
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
307
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
308 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
309
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
310 /**
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
311 * 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
312 * 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
313 * 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
314 * {@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
315 * 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
316 */
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
317 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
318 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
319 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
320 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
321 return gpus;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
322 }
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
323 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
324 }
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
325
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
326 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
327 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
328 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
329 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
330 f.setAccessible(true);
7156
29ee920b35dd make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents: 7152
diff changeset
331 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
332 }
29ee920b35dd make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents: 7152
diff changeset
333 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
334 try {
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
335 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
336 } 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
337 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
338 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340
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
341 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
342 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
343 }
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
344
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
345 public TargetDescription getTarget() {
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
346 return hostBackend.getTarget();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348
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
349 public HotSpotGraphCache getGraphCache() {
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
350 return cache;
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
351 }
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
352
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
353 public CompilerToVM getCompilerToVM() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
354 return compilerToVm;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
355 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
357 public VMToCompiler getVMToCompiler() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
358 return vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
361 public CompilerToGPU getCompilerToGPU() {
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
362 return compilerToGpu;
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
363 }
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
364
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7037
diff changeset
365 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve) {
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
366 if (name.length() == 1) {
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
367 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
368 switch (kind) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
369 case Boolean:
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
370 return typeBoolean;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 case Byte:
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
372 return typeByte;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
373 case Char:
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
374 return typeChar;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
375 case Short:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
376 return typeShort;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
377 case Int:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
378 return typeInt;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
379 case Long:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
380 return typeLong;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
381 case Float:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
382 return typeFloat;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383 case Double:
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
384 return typeDouble;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
385 case Void:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
386 return typeVoid;
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
387 case Object:
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13255
diff changeset
388 break;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 case Illegal:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
391 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
392 }
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
393 return compilerToVm.lookupType(name, accessingClass, eagerResolve);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
394 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
395
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
396 public HotSpotRuntimeInterpreterInterface getRuntimeInterpreterInterface() {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
397 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
398 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
399 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
400 return runtimeInterpreterInterface;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
401 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
402
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
403 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
404 return getHostBackend().getProviders();
5292
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
405 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
406
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
407 @Override
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
408 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
409 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
410 }
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
411
5533
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
412 @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
413 @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
414 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
415 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
416 return (T) this;
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
417 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
418 return null;
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
419 }
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
420
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
421 public HotSpotBackend getHostBackend() {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
422 return hostBackend;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
423 }
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
424
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
425 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
426 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
427 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
428 }
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
429
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
430 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
431 return Collections.unmodifiableMap(backends);
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
432 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
433
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 * 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
436 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
437 * @return the offset in bytes
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
438 */
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
439 public static int getArrayBaseOffset(Kind kind) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
440 switch (kind) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
441 case Boolean:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
442 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
443 case Byte:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
444 return Unsafe.ARRAY_BYTE_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
445 case Char:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
446 return Unsafe.ARRAY_CHAR_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
447 case Short:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
448 return Unsafe.ARRAY_SHORT_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
449 case Int:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
450 return Unsafe.ARRAY_INT_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
451 case Long:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
452 return Unsafe.ARRAY_LONG_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
453 case Float:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
454 return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
455 case Double:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
456 return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
457 case Object:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
458 return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
459 default:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
460 throw GraalInternalError.shouldNotReachHere();
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
461 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
462 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
463
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
464 /**
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
465 * 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
466 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
467 * @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
468 */
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
469 public static int getArrayIndexScale(Kind kind) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
470 switch (kind) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
471 case Boolean:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
472 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
473 case Byte:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
474 return Unsafe.ARRAY_BYTE_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
475 case Char:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
476 return Unsafe.ARRAY_CHAR_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
477 case Short:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
478 return Unsafe.ARRAY_SHORT_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
479 case Int:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
480 return Unsafe.ARRAY_INT_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
481 case Long:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
482 return Unsafe.ARRAY_LONG_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
483 case Float:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
484 return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
485 case Double:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
486 return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
487 case Object:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
488 return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
489 default:
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
490 throw GraalInternalError.shouldNotReachHere();
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
491 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
492 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
493 }