annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java @ 6493:85c1b84f8fd9

moved ADM64-specific assembler code into separate project
author Doug Simon <doug.simon@oracle.com>
date Tue, 02 Oct 2012 22:22:06 +0200
parents b3a75a3d9e1b
children df02fa2bce58
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
5186
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
25 import java.lang.reflect.*;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6404
diff changeset
26
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
27 import com.oracle.graal.api.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
28 import com.oracle.graal.api.code.*;
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
29 import com.oracle.graal.api.interpreter.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5503
diff changeset
30 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.compiler.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.compiler.target.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.hotspot.bridge.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.hotspot.logging.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
35 import com.oracle.graal.hotspot.meta.*;
5848
aba97dd72b70 moved HotSpotXirGenerator to com.oracle.graal.hotspot.target.amd64
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
36 import com.oracle.graal.hotspot.target.amd64.*;
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.*;
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6488
diff changeset
38 import com.oracle.max.asm.amd64.*;
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 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 * Singleton class holding the instance of the GraalCompiler.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 */
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5533
diff changeset
43 public final class HotSpotGraalRuntime implements GraalRuntime {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5533
diff changeset
45 private static final HotSpotGraalRuntime instance = new HotSpotGraalRuntime();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5533
diff changeset
47 public static HotSpotGraalRuntime getInstance() {
5532
82f2bb47c97e Clean up on HotSpotCompilerImpl class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5526
diff changeset
48 return instance;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
51 private final CompilerToVM compilerToVm;
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
52 private final VMToCompiler vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 private HotSpotRuntime runtime;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 private GraalCompiler compiler;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
56 private TargetDescription target;
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
57 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
58 private volatile HotSpotGraphCache cache;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 private final HotSpotVMConfig config;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 public HotSpotVMConfig getConfig() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 return config;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5533
diff changeset
66 private HotSpotGraalRuntime() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67
5532
82f2bb47c97e Clean up on HotSpotCompilerImpl class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5526
diff changeset
68 CompilerToVM toVM = new CompilerToVMImpl();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
70 // initialize VmToCompiler
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
71 VMToCompiler toCompiler = new VMToCompilerImpl(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 // logging, etc.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 if (CountingProxy.ENABLED) {
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
75 toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler);
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
76 toVM = CountingProxy.getProxy(CompilerToVM.class, toVM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 if (Logger.ENABLED) {
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
79 toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler);
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
80 toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 // set the final fields
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
84 compilerToVm = toVM;
5289
6519cf82d390 remove on more vmExits instance
Lukas Stadler <lukas.stadler@jku.at>
parents: 5278
diff changeset
85 vmToCompiler = toCompiler;
6363
a73fcf1639fc HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents: 5848
diff changeset
86 config = new HotSpotVMConfig();
a73fcf1639fc HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents: 5848
diff changeset
87 compilerToVm.initializeConfiguration(config);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 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
89
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
90 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
91 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
92 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
93 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
94
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
95 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
96 Field[] fields = config.getClass().getDeclaredFields();
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
97 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
98 f.setAccessible(true);
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
99 try {
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
100 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
101 } 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
102 }
b00e56aa159d added printing of HotSpot config if graal.printconfig system property is true
Doug Simon <doug.simon@oracle.com>
parents: 5177
diff changeset
103 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
106 public TargetDescription getTarget() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 if (target == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 final int wordSize = 8;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 final int stackFrameAlignment = 16;
6488
b3a75a3d9e1b removed more XIR remnants
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
110 target = new TargetDescription(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 return target;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 public GraalCompiler getCompiler() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 if (compiler == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 // these options are important - graal will not generate correct code without them
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 GraalOptions.StackShadowPages = config.stackShadowPages;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6404
diff changeset
121 Backend backend = new HotSpotAMD64Backend(getRuntime(), getTarget());
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4262
diff changeset
122
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6404
diff changeset
123 compiler = new GraalCompiler(getRuntime(), getTarget(), backend);
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
124 if (GraalOptions.CacheGraphs) {
5308
820fce52a244 moved GraphCache to platform specific part, solved class unloading problem
Lukas Stadler <lukas.stadler@jku.at>
parents: 5292
diff changeset
125 cache = new HotSpotGraphCache();
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
126 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 return compiler;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130
5308
820fce52a244 moved GraphCache to platform specific part, solved class unloading problem
Lukas Stadler <lukas.stadler@jku.at>
parents: 5292
diff changeset
131 public HotSpotGraphCache getCache() {
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
132 return cache;
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
133 }
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
134
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
135 public CompilerToVM getCompilerToVM() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
136 return compilerToVm;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
139 public VMToCompiler getVMToCompiler() {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
140 return vmToCompiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
143 public JavaType lookupType(String returnType, HotSpotResolvedJavaType accessingClass, boolean eagerResolve) {
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
144 if (returnType.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) {
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5233
diff changeset
145 VMToCompilerImpl exitsNative = (VMToCompilerImpl) vmToCompiler;
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
146 Kind kind = Kind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 switch(kind) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 case Boolean:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 return exitsNative.typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 case Byte:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
151 return exitsNative.typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 case Char:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 return exitsNative.typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 case Double:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155 return exitsNative.typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156 case Float:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157 return exitsNative.typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158 case Illegal:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161 return exitsNative.typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 case Jsr:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
165 return exitsNative.typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166 case Object:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 break;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 return exitsNative.typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
170 case Void:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 return exitsNative.typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
174 return compilerToVm.Signature_lookupType(returnType, accessingClass, eagerResolve);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
177 public HotSpotRuntimeInterpreterInterface getRuntimeInterpreterInterface() {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
178 if (runtimeInterpreterInterface == null) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
179 runtimeInterpreterInterface = new HotSpotRuntimeInterpreterInterface(getRuntime());
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
180 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
181 return runtimeInterpreterInterface;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
182 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
183
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 public HotSpotRuntime getRuntime() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 if (runtime == null) {
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4265
diff changeset
186 runtime = new HotSpotRuntime(config, this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
187 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
188 return runtime;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 }
5292
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
190
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
191 public void evictDeoptedGraphs() {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
192 if (cache != null) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
193 long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds();
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
194 if (deoptedGraphs != null) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
195 if (deoptedGraphs.length == 0) {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
196 cache.clear();
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
197 } else {
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
198 cache.removeGraphs(deoptedGraphs);
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
199 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
200 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
201 }
796917d3bfc9 move cached graph eviction out of GraalCompiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 5289
diff changeset
202 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
203
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
204 @Override
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
205 public String getName() {
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
206 return "HotSpotGraalRuntime";
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
207 }
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
208
5533
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
209 @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
210 @Override
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
211 public <T> T getCapability(Class<T> clazz) {
5718
10341299528c renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents: 5629
diff changeset
212 if (clazz == GraalCodeCacheProvider.class || clazz == MetaAccessProvider.class) {
5533
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
213 return (T) getRuntime();
c5c13f3ed5c4 Remove GraalAccess class, replace usages new GraalVM API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5532
diff changeset
214 }
5557
2e2a77f091f2 re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
215 if (clazz == GraalCompiler.class) {
2e2a77f091f2 re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
216 return (T) getCompiler();
2e2a77f091f2 re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
217 }
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
218 if (clazz == MetaAccessProvider.class) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
219 return (T) getRuntime();
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
220 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
221 if (clazz == RuntimeInterpreterInterface.class) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
222 return (T) getRuntimeInterpreterInterface();
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5720
diff changeset
223 }
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
224 return null;
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5514
diff changeset
225 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 }