annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @ 24106:1439a6614a10

8174957: [JVMCI] jaotc is broken in Xcomp mode
author Doug Simon <doug.simon@oracle.com>
date Wed, 15 Feb 2017 15:36:48 +0100
parents 37a27e859428
children dfad13b97c0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
25 import java.util.Map;
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;
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23346
diff changeset
45 protected final HotSpotVMConfig config;
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
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;
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
59 HotSpotVMConfigStore store = runtime.getConfigStore();
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
60 for (Map.Entry<String, Long> e : store.getConstants().entrySet()) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
61 String name = e.getKey();
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
62 if (name.startsWith("MARKID_") && e.getValue() == markId) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
63 return name;
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19782
diff changeset
64 }
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19782
diff changeset
65 }
21706
4c00096fc415 moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents: 21558
diff changeset
66 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
67 }
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19782
diff changeset
68
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69 /**
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70 * 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
71 */
21706
4c00096fc415 moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents: 21558
diff changeset
72 @Override
4c00096fc415 moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents: 21558
diff changeset
73 public String getTargetName(Call call) {
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
74 if (call.target instanceof HotSpotForeignCallTarget) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
75 long address = ((HotSpotForeignCallTarget) call.target).address;
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
76 HotSpotVMConfigStore store = runtime.getConfigStore();
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
77 for (Map.Entry<String, VMField> e : store.getFields().entrySet()) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
78 VMField field = e.getValue();
24106
1439a6614a10 8174957: [JVMCI] jaotc is broken in Xcomp mode
Doug Simon <doug.simon@oracle.com>
parents: 23755
diff changeset
79 if (field.isStatic() && field.value != null && field.value instanceof Long && ((Long) field.value) == address) {
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23700
diff changeset
80 return e.getValue() + ":0x" + Long.toHexString(address);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
81 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
82 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
83 }
21706
4c00096fc415 moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents: 21558
diff changeset
84 return CodeCacheProvider.super.getTargetName(call);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
86
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 @Override
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88 public RegisterConfig getRegisterConfig() {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
89 return regConfig;
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
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
92 @Override
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
93 public int getMinimumOutgoingSize() {
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
94 return runtime.getConfig().runtimeCallStackSize;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22772
diff changeset
97 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
98 ((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
99 return installedCode;
8ea51438445c consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents: 12536
diff changeset
100 }
8ea51438445c consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents: 12536
diff changeset
101
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22772
diff changeset
102 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
103 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
104 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
105 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
106 // Must be a stub
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
107 resultInstalledCode = new HotSpotRuntimeStub(((HotSpotCompiledCode) compiledCode).getName());
19782
29916dcee0b8 Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19685
diff changeset
108 } else {
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
109 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
110 }
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 } 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
112 resultInstalledCode = installedCode;
22593
cabc2b8bc3f1 Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents: 22590
diff changeset
113 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22772
diff changeset
114
23346
39f25354aeee Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23344
diff changeset
115 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
116
39f25354aeee Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23344
diff changeset
117 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
118 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
119 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
120 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
121 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
122 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
123 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
124 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
125 } 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
126 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
127 }
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 (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
129 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
130 }
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 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
132 } else {
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
133 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
134 }
22593
cabc2b8bc3f1 Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents: 22590
diff changeset
135 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22772
diff changeset
136 return logOrDump(resultInstalledCode, compiledCode);
12526
04671d59e93b Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12456
diff changeset
137 }
04671d59e93b Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12456
diff changeset
138
22629
f53dfbf08c71 added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents: 22628
diff changeset
139 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
140 runtime.getCompilerToVM().invalidateInstalledCode(installedCode);
f53dfbf08c71 added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents: 22628
diff changeset
141 }
f53dfbf08c71 added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents: 22628
diff changeset
142
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
143 @Override
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 public TargetDescription getTarget() {
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
145 return target;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148 public String disassemble(InstalledCode code) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 if (code.isValid()) {
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
150 return runtime.getCompilerToVM().disassembleCodeBlob(code);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
151 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
152 return null;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154
15358
c17d593ccafb Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
155 public SpeculationLog createSpeculationLog() {
c17d593ccafb Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
156 return new HotSpotSpeculationLog();
c17d593ccafb Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
157 }
22628
2e71226319da added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents: 22625
diff changeset
158
2e71226319da added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents: 22625
diff changeset
159 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
160 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
161 }
22631
19ce432d854d added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents: 22629
diff changeset
162
19ce432d854d added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents: 22629
diff changeset
163 public boolean shouldDebugNonSafepoints() {
19ce432d854d added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents: 22629
diff changeset
164 return runtime.getCompilerToVM().shouldDebugNonSafepoints();
19ce432d854d added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents: 22629
diff changeset
165 }
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
166
22782
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22780
diff changeset
167 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
168 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
169 }
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22780
diff changeset
170
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
171 /**
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
172 * 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
173 */
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 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
175 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
176 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
177 }