Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @ 23677:eb166b568645
Merge
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 09 Jun 2016 18:58:09 -0700 |
parents | 39f25354aeee |
children | b5557b757040 |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
22772
f16c1266b0de
Remove unused method.
Roland Schatz <roland.schatz@oracle.com>
parents:
22769
diff
changeset
|
2 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22567
diff
changeset
|
25 import java.lang.reflect.Field; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
27 import jdk.vm.ci.code.BailoutException; |
22782
bf8a5a6861b1
Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22780
diff
changeset
|
28 import jdk.vm.ci.code.BytecodeFrame; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
29 import jdk.vm.ci.code.CodeCacheProvider; |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
30 import jdk.vm.ci.code.CompiledCode; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
31 import jdk.vm.ci.code.InstalledCode; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
32 import jdk.vm.ci.code.RegisterConfig; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
33 import jdk.vm.ci.code.TargetDescription; |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
34 import jdk.vm.ci.code.site.Call; |
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
35 import jdk.vm.ci.code.site.Mark; |
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
36 import jdk.vm.ci.meta.ResolvedJavaMethod; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
37 import jdk.vm.ci.meta.SpeculationLog; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 * HotSpot implementation of {@link CodeCacheProvider}. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 */ |
17447
f861021b49b8
Restructure CodeCacheProvider hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
17371
diff
changeset
|
42 public class HotSpotCodeCacheProvider implements CodeCacheProvider { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21414
diff
changeset
|
44 protected final HotSpotJVMCIRuntimeProvider runtime; |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
45 public final HotSpotVMConfig config; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
46 protected final TargetDescription target; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 protected final RegisterConfig regConfig; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21414
diff
changeset
|
49 public HotSpotCodeCacheProvider(HotSpotJVMCIRuntimeProvider runtime, HotSpotVMConfig config, TargetDescription target, RegisterConfig regConfig) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
50 this.runtime = runtime; |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
51 this.config = config; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
52 this.target = target; |
17447
f861021b49b8
Restructure CodeCacheProvider hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
17371
diff
changeset
|
53 this.regConfig = regConfig; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 @Override |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
57 public String getMarkName(Mark mark) { |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
58 int markId = (int) mark.id; |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
59 Field[] fields = runtime.getConfig().getClass().getDeclaredFields(); |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
60 for (Field f : fields) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
61 if (f.getName().startsWith("MARKID_")) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
62 f.setAccessible(true); |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
63 try { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
64 if (f.getInt(runtime.getConfig()) == markId) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
65 return f.getName(); |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
66 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
67 } catch (Exception e) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
68 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
69 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
70 } |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
71 return CodeCacheProvider.super.getMarkName(mark); |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
72 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
73 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 * Decodes a call target to a mnemonic if possible. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 */ |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
77 @Override |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
78 public String getTargetName(Call call) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
79 Field[] fields = runtime.getConfig().getClass().getDeclaredFields(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 for (Field f : fields) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 if (f.getName().endsWith("Stub")) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 f.setAccessible(true); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 try { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
84 Object address = f.get(runtime.getConfig()); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 if (address.equals(call.target)) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 return f.getName() + ":0x" + Long.toHexString((Long) address); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 } catch (Exception e) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 } |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
92 return CodeCacheProvider.super.getTargetName(call); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 public RegisterConfig getRegisterConfig() { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 return regConfig; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 public int getMinimumOutgoingSize() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
102 return runtime.getConfig().runtimeCallStackSize; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
105 private InstalledCode logOrDump(InstalledCode installedCode, CompiledCode compiledCode) { |
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
106 ((HotSpotJVMCIRuntime) runtime).notifyInstall(this, installedCode, compiledCode); |
13233
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
107 return installedCode; |
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
108 } |
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
109 |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
110 public InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compiledCode, InstalledCode installedCode, SpeculationLog log, boolean isDefault) { |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
111 InstalledCode resultInstalledCode; |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
112 if (installedCode == null) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
113 if (method == null) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
114 // Must be a stub |
22780
b4ff1a18d19c
Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22773
diff
changeset
|
115 resultInstalledCode = new HotSpotRuntimeStub(((HotSpotCompiledCode) compiledCode).getName()); |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19685
diff
changeset
|
116 } else { |
22780
b4ff1a18d19c
Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22773
diff
changeset
|
117 resultInstalledCode = new HotSpotNmethod((HotSpotResolvedJavaMethod) method, ((HotSpotCompiledCode) compiledCode).getName(), isDefault); |
19426
dd8989d5547f
provide more detail when Graal code installation fails due to a failed dependency check
Doug Simon <doug.simon@oracle.com>
parents:
19321
diff
changeset
|
118 } |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
119 } else { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
120 resultInstalledCode = installedCode; |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22590
diff
changeset
|
121 } |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
122 |
23346
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23344
diff
changeset
|
123 HotSpotSpeculationLog speculationLog = (log != null && log.hasSpeculations()) ? (HotSpotSpeculationLog) log : null; |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23344
diff
changeset
|
124 |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23344
diff
changeset
|
125 int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, speculationLog); |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
126 if (result != config.codeInstallResultOk) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
127 String resultDesc = config.getCodeInstallResultDescription(result); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
128 if (compiledCode instanceof HotSpotCompiledNmethod) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
129 HotSpotCompiledNmethod compiledNmethod = (HotSpotCompiledNmethod) compiledCode; |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
130 String msg = compiledNmethod.getInstallationFailureMessage(); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
131 if (msg != null) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
132 msg = String.format("Code installation failed: %s%n%s", resultDesc, msg); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
133 } else { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
134 msg = String.format("Code installation failed: %s", resultDesc); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
135 } |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
136 if (result == config.codeInstallResultDependenciesInvalid) { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
137 throw new AssertionError(resultDesc + " " + msg); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
138 } |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
139 throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg); |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
140 } else { |
22780
b4ff1a18d19c
Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22773
diff
changeset
|
141 throw new BailoutException("Error installing %s: %s", ((HotSpotCompiledCode) compiledCode).getName(), resultDesc); |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22624
diff
changeset
|
142 } |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22590
diff
changeset
|
143 } |
22773
9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22772
diff
changeset
|
144 return logOrDump(resultInstalledCode, compiledCode); |
12526
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12456
diff
changeset
|
145 } |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12456
diff
changeset
|
146 |
22629
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
147 public void invalidateInstalledCode(InstalledCode installedCode) { |
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
148 runtime.getCompilerToVM().invalidateInstalledCode(installedCode); |
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
149 } |
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
150 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 public TargetDescription getTarget() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
153 return target; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 public String disassemble(InstalledCode code) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 if (code.isValid()) { |
22643
456800cd1a17
Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22636
diff
changeset
|
158 return runtime.getCompilerToVM().disassembleCodeBlob(code); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 return null; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
163 public SpeculationLog createSpeculationLog() { |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
164 return new HotSpotSpeculationLog(); |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
165 } |
22628
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
166 |
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
167 public long getMaxCallTargetOffset(long address) { |
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
168 return runtime.getCompilerToVM().getMaxCallTargetOffset(address); |
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
169 } |
22631
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
170 |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
171 public boolean shouldDebugNonSafepoints() { |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
172 return runtime.getCompilerToVM().shouldDebugNonSafepoints(); |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
173 } |
22632
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
174 |
22782
bf8a5a6861b1
Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22780
diff
changeset
|
175 public int interpreterFrameSize(BytecodeFrame pos) { |
bf8a5a6861b1
Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22780
diff
changeset
|
176 return runtime.getCompilerToVM().interpreterFrameSize(pos); |
bf8a5a6861b1
Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22780
diff
changeset
|
177 } |
bf8a5a6861b1
Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22780
diff
changeset
|
178 |
22632
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
179 /** |
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
180 * Resets all compilation statistics. |
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
181 */ |
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
182 public void resetCompilationStatistics() { |
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
183 runtime.getCompilerToVM().resetCompilationStatistics(); |
b44f7dd5c773
added HotSpotCodeCacheProvider.notifyCompilationStatistics and HotSpotCodeCacheProvider.resetCompilationStatistics and made made these methods package-private in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
22631
diff
changeset
|
184 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 } |