annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java @ 9430:147162b27799

GRAAL-234 - PTX code loading
author Morris Meyer <morris.meyer@oracle.com>
date Tue, 30 Apr 2013 08:17:55 -0400
parents aaf8798b0969
children 6898d8995866
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.*;
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
26
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
27 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
28 import java.util.*;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6404
diff changeset
29
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
30 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
31 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
32 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
33 import com.oracle.graal.compiler.target.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.hotspot.bridge.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.hotspot.logging.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
36 import com.oracle.graal.hotspot.meta.*;
5720
46ad94a0574a moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents: 5718
diff changeset
37 import com.oracle.graal.nodes.spi.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6521
diff changeset
38 import com.oracle.graal.phases.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 /**
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
41 * Singleton class holding the instance of the {@link GraalRuntime}.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7226
diff changeset
42 *
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7226
diff changeset
43 * The platform specific subclass is created by a call from the C++ HotSpot code.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 */
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
45 public abstract class HotSpotGraalRuntime implements GraalRuntime {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46
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
47 private static HotSpotGraalRuntime instance;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48
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
49 /**
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9108
diff changeset
50 * 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
51 */
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9108
diff changeset
52 public static HotSpotGraalRuntime graalRuntime() {
5532
82f2bb47c97e Clean up on HotSpotCompilerImpl class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5526
diff changeset
53 return instance;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
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
56 /**
1ecf984d490c fixed an ordering issue in the initialization and retrieval of the platform specific HotSpotGraalRuntime instance
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
57 * Called by the platform specific class exactly once to register the singleton instance.
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
58 */
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 protected static void setInstance(HotSpotGraalRuntime runtime) {
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
60 assert instance == null : "runtime already registered";
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 instance = runtime;
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
62
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
63 // Do deferred initialization
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
64
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
65 // 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
66 // 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
67 // 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
68 // proxied methods. Some of these static initializers (e.g. in
e86ac899c5be fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
69 // HotSpotMethodData) rely on the above instance field being set
e86ac899c5be fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
70 // to retrieve config details.
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 VMToCompiler toCompiler = runtime.vmToCompiler;
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 CompilerToVM toVM = runtime.compilerToVm;
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
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 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
75 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
76 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
77 }
e86ac899c5be fixed issues triggered when using the CountingProxy (i.e., -Dgraal.countcalls=true) or LoggingProxy (i.e., -Dgraal.debug=true) to analyze traffic across the VM/compiler boundary
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
78 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
79 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
80 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
81 }
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
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 runtime.vmToCompiler = 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
84 runtime.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
85 }
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
86
9429
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
87 protected static HotSpotGraalRuntimeFactory findFactory(String architecture) {
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
88 for (HotSpotGraalRuntimeFactory factory : ServiceLoader.loadInstalled(HotSpotGraalRuntimeFactory.class)) {
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
89 if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalOptions.GraalRuntime)) {
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
90 return factory;
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
91 }
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
92 }
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
93 return null;
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
94 }
aaf8798b0969 Load custom runtime implementations.
Roland Schatz <roland.schatz@oracle.com>
parents: 9289
diff changeset
95
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
96 private static Kind wordKind;
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
97
6954
0e20ad1ea98b removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
98 /**
0e20ad1ea98b removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
99 * Gets the kind of a word value.
0e20ad1ea98b removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
100 */
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
101 public static Kind wordKind() {
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
102 assert wordKind != null;
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
103 return wordKind;
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
104 }
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
105
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
106 /**
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
107 * Reads a word value from a given address.
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
108 */
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
109 public static long unsafeReadWord(long address) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7084
diff changeset
110 if (wordKind == Kind.Long) {
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
111 return unsafe.getLong(address);
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
112 }
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
113 return unsafe.getInt(address);
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
114 }
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
115
8472
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
116 /**
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
117 * 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
118 */
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
119 public static long unsafeReadWord(Object object, long offset) {
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
120 if (wordKind == Kind.Long) {
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
121 return unsafe.getLong(object, offset);
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
122 }
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
123 return unsafe.getInt(object, offset);
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
124 }
f71fec3fadae made method substitutions for Thread be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
125
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
126 protected/* final */CompilerToVM compilerToVm;
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
127 protected/* final */CompilerToGPU compilerToGpu;
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
128 protected/* final */VMToCompiler vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129
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
130 protected final HotSpotRuntime runtime;
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
131 protected final TargetDescription target;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
132 protected final Replacements replacements;
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
133
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
134 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
135 private volatile HotSpotGraphCache cache;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136
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
137 protected final HotSpotVMConfig config;
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
138 private final HotSpotBackend backend;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139
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
140 protected HotSpotGraalRuntime() {
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
141 CompilerToVM toVM = new CompilerToVMImpl();
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
142 CompilerToGPU toGPU = new CompilerToGPUImpl();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
144 // initialize VmToCompiler
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
145 VMToCompiler toCompiler = new VMToCompilerImpl(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
147 compilerToVm = toVM;
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
148 compilerToGpu = toGPU;
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
149 vmToCompiler = toCompiler;
6363
a73fcf1639fc HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents: 5848
diff changeset
150 config = new HotSpotVMConfig();
a73fcf1639fc HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents: 5848
diff changeset
151 compilerToVm.initializeConfiguration(config);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 config.check();
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
153
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
154 // Set some global options:
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
155 if (config.compileTheWorld) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
156 GraalOptions.CompileTheWorld = CompileTheWorld.SUN_BOOT_CLASS_PATH;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
157 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
158 if (config.compileTheWorldStartAt != 1) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
159 GraalOptions.CompileTheWorldStartAt = config.compileTheWorldStartAt;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
160 }
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
161 if (config.compileTheWorldStopAt != Integer.MAX_VALUE) {
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
162 GraalOptions.CompileTheWorldStopAt = config.compileTheWorldStopAt;
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8996
diff changeset
163 }
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
164 GraalOptions.HotSpotPrintCompilation = config.printCompilation;
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
165 GraalOptions.HotSpotPrintInlining = config.printInlining;
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8637
diff changeset
166
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
167 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
168 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
169 }
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
170
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
171 target = createTarget();
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
172 assert wordKind == null || wordKind.equals(target.wordKind);
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
173 wordKind = target.wordKind;
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
174
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
175 runtime = createRuntime();
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
176
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
177 // Replacements cannot have speculative optimizations since they have
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
178 // to be valid for the entire run of the VM.
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
179 Assumptions assumptions = new Assumptions(false);
8628
77de2f3df379 renames: [HotSpot]ReplacementsInstaller -> [HotSpot]ReplacementsImpl
Doug Simon <doug.simon@oracle.com>
parents: 8627
diff changeset
180 replacements = new HotSpotReplacementsImpl(runtime, assumptions, runtime.getGraalRuntime().getTarget());
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
181
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
182 backend = createBackend();
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
183 GraalOptions.StackShadowPages = config.stackShadowPages;
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
184 if (GraalOptions.CacheGraphs) {
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
185 cache = new HotSpotGraphCache();
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
186 }
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
187 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
188
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
189 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
190 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
191 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
192 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
193 f.setAccessible(true);
7156
29ee920b35dd make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents: 7152
diff changeset
194 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
195 }
29ee920b35dd make the output produced by -Dgraal.printconfig=true sorted
Doug Simon <doug.simon@oracle.com>
parents: 7152
diff changeset
196 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
197 try {
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
198 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
199 } 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
200 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
201 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
202 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203
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
204 protected abstract TargetDescription createTarget();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7226
diff changeset
205
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
206 protected abstract HotSpotBackend createBackend();
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7226
diff changeset
207
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
208 protected abstract HotSpotRuntime createRuntime();
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
209
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
210 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
211 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
212 }
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
213
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
214 public TargetDescription getTarget() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 return target;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217
5308
820fce52a244 moved GraphCache to platform specific part, solved class unloading problem
Lukas Stadler <lukas.stadler@jku.at>
parents: 5292
diff changeset
218 public HotSpotGraphCache getCache() {
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
219 return cache;
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
220 }
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
221
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
222 public CompilerToVM getCompilerToVM() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
223 return compilerToVm;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
226 public VMToCompiler getVMToCompiler() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
227 return vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
230 public CompilerToGPU getCompilerToGPU() {
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
231 return compilerToGpu;
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
232 }
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9429
diff changeset
233
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7037
diff changeset
234 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve) {
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
235 if (name.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
236 VMToCompilerImpl impl = (VMToCompilerImpl) vmToCompiler;
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
237 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
238 switch (kind) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 case Boolean:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
240 return impl.typeBoolean;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241 case Byte:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
242 return impl.typeByte;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
243 case Char:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
244 return impl.typeChar;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 case Double:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
246 return impl.typeDouble;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 case Float:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
248 return impl.typeFloat;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 case Illegal:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 case Int:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
252 return impl.typeInt;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 case Long:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
254 return impl.typeLong;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 case Short:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
258 return impl.typeShort;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 case Void:
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6588
diff changeset
260 return impl.typeVoid;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 }
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
263 return compilerToVm.lookupType(name, accessingClass, eagerResolve);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
265
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
266 public HotSpotRuntimeInterpreterInterface getRuntimeInterpreterInterface() {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
267 if (runtimeInterpreterInterface == null) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
268 runtimeInterpreterInterface = new HotSpotRuntimeInterpreterInterface(getRuntime());
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
269 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
270 return runtimeInterpreterInterface;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
271 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
272
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 public HotSpotRuntime getRuntime() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 return runtime;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
275 }
5292
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
276
8636
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8628
diff changeset
277 public Replacements getReplacements() {
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8628
diff changeset
278 return replacements;
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8628
diff changeset
279 }
ac4dbfecec8f passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents: 8628
diff changeset
280
5292
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
281 public void evictDeoptedGraphs() {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
282 if (cache != null) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
283 long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds();
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
284 if (deoptedGraphs != null) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
285 if (deoptedGraphs.length == 0) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
286 cache.clear();
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
287 } else {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
288 cache.removeGraphs(deoptedGraphs);
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
289 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
290 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
291 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
292 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
293
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
294 @Override
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
295 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
296 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
297 }
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
298
5533
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
299 @SuppressWarnings("unchecked")
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
300 @Override
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
301 public <T> T getCapability(Class<T> clazz) {
8412
488a5f694786 removed unnecessary interface
Doug Simon <doug.simon@oracle.com>
parents: 8150
diff changeset
302 if (clazz == GraalCodeCacheProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class) {
5533
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
303 return (T) getRuntime();
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
304 }
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7714
diff changeset
305 if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class) {
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7714
diff changeset
306 return (T) getRuntime();
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7714
diff changeset
307 }
7835
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7816
diff changeset
308 if (clazz == HotSpotRuntime.class) {
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7816
diff changeset
309 return (T) runtime;
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7816
diff changeset
310 }
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
311 if (clazz == Replacements.class) {
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
312 return (T) replacements;
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8472
diff changeset
313 }
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
314 if (clazz == Backend.class) {
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
315 return (T) getBackend();
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
316 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
317 return null;
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
318 }
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
319
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
320 public HotSpotBackend getBackend() {
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
321 return backend;
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
322 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 }