Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @ 22699:ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 21 Oct 2015 09:06:12 -0700 |
parents | 1bbd4a7c274b |
children | d57508b1bcb5 |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
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
|
2 * Copyright (c) 2013, 2015, 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 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
25 import static jdk.vm.ci.hotspot.HotSpotCompressedNullConstant.COMPRESSED_NULL; |
18289
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
26 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22567
diff
changeset
|
27 import java.lang.reflect.Field; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 |
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.BailoutException; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
30 import jdk.vm.ci.code.CodeCacheProvider; |
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.CompilationRequest; |
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.CompilationResult; |
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.CompilationResult.Call; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
34 import jdk.vm.ci.code.CompilationResult.ConstantReference; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
35 import jdk.vm.ci.code.CompilationResult.DataPatch; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
36 import jdk.vm.ci.code.CompilationResult.Mark; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
37 import jdk.vm.ci.code.DataSection; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
38 import jdk.vm.ci.code.DataSection.Data; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
39 import jdk.vm.ci.code.DataSection.DataBuilder; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
40 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
|
41 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
|
42 import jdk.vm.ci.code.TargetDescription; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
43 import jdk.vm.ci.common.JVMCIError; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
44 import jdk.vm.ci.meta.Constant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
45 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
46 import jdk.vm.ci.meta.SerializableConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
47 import jdk.vm.ci.meta.SpeculationLog; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
48 import jdk.vm.ci.meta.VMConstant; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 * HotSpot implementation of {@link CodeCacheProvider}. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 */ |
17447
f861021b49b8
Restructure CodeCacheProvider hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
17371
diff
changeset
|
53 public class HotSpotCodeCacheProvider implements CodeCacheProvider { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 |
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
|
55 protected final HotSpotJVMCIRuntimeProvider runtime; |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
56 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
|
57 protected final TargetDescription target; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 protected final RegisterConfig regConfig; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 |
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
|
60 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
|
61 this.runtime = runtime; |
21413
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
62 this.config = config; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
63 this.target = target; |
17447
f861021b49b8
Restructure CodeCacheProvider hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
17371
diff
changeset
|
64 this.regConfig = regConfig; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 @Override |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
68 public String getMarkName(Mark mark) { |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
69 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
|
70 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
|
71 for (Field f : fields) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
72 if (f.getName().startsWith("MARKID_")) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
73 f.setAccessible(true); |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
74 try { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
75 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
|
76 return f.getName(); |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
77 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
78 } catch (Exception e) { |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
79 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
80 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
81 } |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
82 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
|
83 } |
15a46a918fc1
removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19782
diff
changeset
|
84 |
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 * 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
|
87 */ |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
88 @Override |
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
89 public String getTargetName(Call call) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
90 Field[] fields = runtime.getConfig().getClass().getDeclaredFields(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 for (Field f : fields) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 if (f.getName().endsWith("Stub")) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 f.setAccessible(true); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 try { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
95 Object address = f.get(runtime.getConfig()); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 if (address.equals(call.target)) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 return f.getName() + ":0x" + Long.toHexString((Long) address); |
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 } catch (Exception e) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 } |
21706
4c00096fc415
moved CodeCacheProvider.disassemble(...) from API to CFGPrinterObserver
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
103 return CodeCacheProvider.super.getTargetName(call); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 public RegisterConfig getRegisterConfig() { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 return regConfig; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 public int getMinimumOutgoingSize() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
113 return runtime.getConfig().runtimeCallStackSize; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 |
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
|
116 private InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) { |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
117 ((HotSpotJVMCIRuntime) runtime).notifyInstall(this, installedCode, compResult); |
13233
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
118 return installedCode; |
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
119 } |
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
12536
diff
changeset
|
120 |
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
|
121 public InstalledCode installCode(CompilationRequest compRequest, CompilationResult compResult, InstalledCode installedCode, SpeculationLog log, boolean isDefault) { |
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 HotSpotResolvedJavaMethod method = compRequest != null ? (HotSpotResolvedJavaMethod) compRequest.getMethod() : 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
|
123 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
|
124 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
|
125 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
|
126 // Must be a stub |
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 resultInstalledCode = new HotSpotRuntimeStub(compResult.getName()); |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19685
diff
changeset
|
128 } else { |
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
|
129 resultInstalledCode = new HotSpotNmethod(method, compResult.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
|
130 } |
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
|
131 } 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
|
132 resultInstalledCode = installedCode; |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22590
diff
changeset
|
133 } |
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 HotSpotCompiledCode 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
|
135 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
|
136 final int id; |
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 final long jvmciEnv; |
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 if (compRequest instanceof HotSpotCompilationRequest) { |
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 HotSpotCompilationRequest hsCompRequest = (HotSpotCompilationRequest) compRequest; |
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 id = hsCompRequest.getId(); |
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
|
141 jvmciEnv = hsCompRequest.getJvmciEnv(); |
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 } 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
|
143 id = method.allocateCompileId(compRequest.getEntryBCI()); |
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
|
144 jvmciEnv = 0L; |
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
|
145 } |
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
|
146 compiledCode = new HotSpotCompiledNmethod(method, compResult, id, jvmciEnv); |
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
|
147 } 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
|
148 compiledCode = new HotSpotCompiledCode(compResult); |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22590
diff
changeset
|
149 } |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
150 int result = runtime.getCompilerToVM().installCode(target, compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log); |
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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 } 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
|
159 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
|
160 } |
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
|
161 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
|
162 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
|
163 } |
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
|
164 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
|
165 } 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
|
166 throw new BailoutException("Error installing %s: %s", compResult.getName(), 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
|
167 } |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22590
diff
changeset
|
168 } |
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
|
169 return logOrDump(resultInstalledCode, compResult); |
12526
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12456
diff
changeset
|
170 } |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12456
diff
changeset
|
171 |
22629
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
172 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
|
173 runtime.getCompilerToVM().invalidateInstalledCode(installedCode); |
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
174 } |
f53dfbf08c71
added CodeCacheProvider.invalidateInstalledCode and made CompilerToVM.invalidateInstalledCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22628
diff
changeset
|
175 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
176 public boolean needsDataPatch(JavaConstant constant) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14929
diff
changeset
|
177 return constant instanceof HotSpotMetaspaceConstant; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 |
22411
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
180 private Data createSingleDataItem(Constant constant) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
181 int size; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
182 DataBuilder builder; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
183 if (constant instanceof VMConstant) { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
184 VMConstant vmConstant = (VMConstant) constant; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
185 boolean compressed; |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
186 if (constant instanceof HotSpotConstant) { |
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
187 HotSpotConstant c = (HotSpotConstant) vmConstant; |
18289
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
188 compressed = c.isCompressed(); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
189 } else { |
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
|
190 throw new JVMCIError(String.valueOf(constant)); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
191 } |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
192 |
22567
bfd5fdca1ce9
Clean separation between backend and frontend wordKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22562
diff
changeset
|
193 size = compressed ? 4 : target.wordSize; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
194 if (size == 4) { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
195 builder = (buffer, patch) -> { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
196 patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant))); |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
197 buffer.putInt(0xDEADDEAD); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
198 }; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
199 } else { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
200 assert size == 8; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
201 builder = (buffer, patch) -> { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
202 patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant))); |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
203 buffer.putLong(0xDEADDEADDEADDEADL); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
204 }; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
205 } |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
206 } else if (JavaConstant.isNull(constant)) { |
18289
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
207 boolean compressed = COMPRESSED_NULL.equals(constant); |
22567
bfd5fdca1ce9
Clean separation between backend and frontend wordKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22562
diff
changeset
|
208 size = compressed ? 4 : target.wordSize; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
209 builder = DataBuilder.zero(size); |
19188
c79d0ed46368
Remove redundant code for Constant serialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
18661
diff
changeset
|
210 } else if (constant instanceof SerializableConstant) { |
c79d0ed46368
Remove redundant code for Constant serialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
18661
diff
changeset
|
211 SerializableConstant s = (SerializableConstant) constant; |
c79d0ed46368
Remove redundant code for Constant serialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
18661
diff
changeset
|
212 size = s.getSerializedSize(); |
c79d0ed46368
Remove redundant code for Constant serialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
18661
diff
changeset
|
213 builder = DataBuilder.serializable(s); |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
214 } else { |
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
|
215 throw new JVMCIError(String.valueOf(constant)); |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
216 } |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
217 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
17447
diff
changeset
|
218 return new Data(size, size, builder); |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
219 } |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14559
diff
changeset
|
220 |
22411
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
221 public Data createDataItem(Constant... constants) { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
222 assert constants.length > 0; |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
223 if (constants.length == 1) { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
224 return createSingleDataItem(constants[0]); |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
225 } else { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
226 DataBuilder[] builders = new DataBuilder[constants.length]; |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
227 int size = 0; |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
228 int alignment = 1; |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
229 for (int i = 0; i < constants.length; i++) { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
230 Data data = createSingleDataItem(constants[i]); |
22428
ca5200277c37
Assertion checking alignment requirements in data section.
Roland Schatz <roland.schatz@oracle.com>
parents:
22411
diff
changeset
|
231 |
ca5200277c37
Assertion checking alignment requirements in data section.
Roland Schatz <roland.schatz@oracle.com>
parents:
22411
diff
changeset
|
232 assert size % data.getAlignment() == 0 : "invalid alignment in packed constants"; |
ca5200277c37
Assertion checking alignment requirements in data section.
Roland Schatz <roland.schatz@oracle.com>
parents:
22411
diff
changeset
|
233 alignment = DataSection.lcm(alignment, data.getAlignment()); |
ca5200277c37
Assertion checking alignment requirements in data section.
Roland Schatz <roland.schatz@oracle.com>
parents:
22411
diff
changeset
|
234 |
22411
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
235 builders[i] = data.getBuilder(); |
22428
ca5200277c37
Assertion checking alignment requirements in data section.
Roland Schatz <roland.schatz@oracle.com>
parents:
22411
diff
changeset
|
236 size += data.getSize(); |
22411
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
237 } |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
238 DataBuilder ret = (buffer, patches) -> { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
239 for (DataBuilder b : builders) { |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
240 b.emit(buffer, patches); |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
241 } |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
242 }; |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
243 return new Data(alignment, size, ret); |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
244 } |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
245 } |
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22299
diff
changeset
|
246 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 public TargetDescription getTarget() { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
249 return target; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 public String disassemble(InstalledCode code) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 if (code.isValid()) { |
22643
456800cd1a17
Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22636
diff
changeset
|
254 return runtime.getCompilerToVM().disassembleCodeBlob(code); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
255 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 return null; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
259 public SpeculationLog createSpeculationLog() { |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
260 return new HotSpotSpeculationLog(); |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
261 } |
22628
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
262 |
2e71226319da
added CodeCacheProvider.getMaxCallTargetOffset and made CompilerToVM.getMaxCallTargetOffset package-private
Doug Simon <doug.simon@oracle.com>
parents:
22625
diff
changeset
|
263 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
|
264 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
|
265 } |
22631
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
266 |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
267 public boolean shouldDebugNonSafepoints() { |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
268 return runtime.getCompilerToVM().shouldDebugNonSafepoints(); |
19ce432d854d
added CodeCacheProvider.shouldDebugNonSafepoints and made CompilerToVM.shouldDebugNonSafepoints package-private
Doug Simon <doug.simon@oracle.com>
parents:
22629
diff
changeset
|
269 } |
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
|
270 |
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
|
271 /** |
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
|
272 * Notifies the VM of statistics for a completed compilation. |
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
|
273 * |
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
|
274 * @param id the identifier of the compilation |
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
|
275 * @param method the method compiled |
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
|
276 * @param osr specifies if the compilation was for on-stack-replacement |
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
|
277 * @param processedBytecodes the number of bytecodes processed during the compilation, including |
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
|
278 * the bytecodes of all inlined methods |
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
|
279 * @param time the amount time spent compiling {@code method} |
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
|
280 * @param timeUnitsPerSecond the granularity of the units for the {@code time} value |
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
|
281 * @param installedCode the nmethod installed as a result of the compilation |
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
|
282 */ |
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
|
283 public void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode) { |
22636
1ec4129907b3
made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents:
22632
diff
changeset
|
284 runtime.getCompilerToVM().notifyCompilationStatistics(id, (HotSpotResolvedJavaMethodImpl) method, osr, processedBytecodes, time, timeUnitsPerSecond, installedCode); |
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
|
285 } |
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
|
286 |
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
|
287 /** |
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
|
288 * 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
|
289 */ |
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
|
290 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
|
291 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
|
292 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
293 } |