author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58282 | 03fce7b04b42 |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
43972 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
package jdk.vm.ci.hotspot; |
|
24 |
||
25 |
import static jdk.vm.ci.common.InitTimer.timer; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
26 |
import static jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory.CompilationLevelAdjustment.None; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
27 |
import static jdk.vm.ci.services.Services.IS_BUILDING_NATIVE_IMAGE; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
28 |
import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE; |
43972 | 29 |
|
30 |
import java.io.IOException; |
|
31 |
import java.io.OutputStream; |
|
32 |
import java.io.PrintStream; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
33 |
import java.io.Serializable; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
34 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
35 |
import java.lang.invoke.CallSite; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
36 |
import java.lang.invoke.ConstantCallSite; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
37 |
import java.lang.invoke.MethodHandle; |
50858 | 38 |
import java.lang.module.ModuleDescriptor.Requires; |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
39 |
import java.lang.ref.WeakReference; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
40 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
41 |
import java.util.ArrayList; |
43972 | 42 |
import java.util.Collections; |
43 |
import java.util.HashMap; |
|
50858 | 44 |
import java.util.HashSet; |
43972 | 45 |
import java.util.List; |
46 |
import java.util.Map; |
|
47 |
import java.util.Objects; |
|
44836 | 48 |
import java.util.ServiceLoader; |
50858 | 49 |
import java.util.function.Predicate; |
43972 | 50 |
|
50858 | 51 |
import jdk.internal.misc.Unsafe; |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
52 |
|
43972 | 53 |
import jdk.vm.ci.code.Architecture; |
54 |
import jdk.vm.ci.code.CompilationRequestResult; |
|
55 |
import jdk.vm.ci.code.CompiledCode; |
|
56 |
import jdk.vm.ci.code.InstalledCode; |
|
57 |
import jdk.vm.ci.common.InitTimer; |
|
58 |
import jdk.vm.ci.common.JVMCIError; |
|
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
59 |
import jdk.vm.ci.common.NativeImageReinitialize; |
43972 | 60 |
import jdk.vm.ci.meta.JavaKind; |
61 |
import jdk.vm.ci.meta.JavaType; |
|
62 |
import jdk.vm.ci.meta.ResolvedJavaType; |
|
50858 | 63 |
import jdk.vm.ci.meta.UnresolvedJavaType; |
43972 | 64 |
import jdk.vm.ci.runtime.JVMCI; |
65 |
import jdk.vm.ci.runtime.JVMCIBackend; |
|
66 |
import jdk.vm.ci.runtime.JVMCICompiler; |
|
67 |
import jdk.vm.ci.runtime.JVMCICompilerFactory; |
|
50858 | 68 |
import jdk.vm.ci.runtime.JVMCIRuntime; |
43972 | 69 |
import jdk.vm.ci.services.JVMCIServiceLocator; |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
70 |
import jdk.vm.ci.services.Services; |
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
71 |
|
43972 | 72 |
/** |
73 |
* HotSpot implementation of a JVMCI runtime. |
|
74 |
*/ |
|
50858 | 75 |
public final class HotSpotJVMCIRuntime implements JVMCIRuntime { |
43972 | 76 |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
77 |
/** |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
78 |
* Singleton instance lazily initialized via double-checked locking. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
79 |
*/ |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
80 |
@NativeImageReinitialize private static volatile HotSpotJVMCIRuntime instance; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
81 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
82 |
private HotSpotResolvedObjectTypeImpl javaLangObject; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
83 |
private HotSpotResolvedObjectTypeImpl javaLangInvokeMethodHandle; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
84 |
private HotSpotResolvedObjectTypeImpl constantCallSiteType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
85 |
private HotSpotResolvedObjectTypeImpl callSiteType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
86 |
private HotSpotResolvedObjectTypeImpl javaLangString; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
87 |
private HotSpotResolvedObjectTypeImpl javaLangClass; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
88 |
private HotSpotResolvedObjectTypeImpl throwableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
89 |
private HotSpotResolvedObjectTypeImpl serializableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
90 |
private HotSpotResolvedObjectTypeImpl cloneableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
91 |
private HotSpotResolvedObjectTypeImpl enumType; |
43972 | 92 |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
93 |
HotSpotResolvedObjectTypeImpl getJavaLangObject() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
94 |
if (javaLangObject == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
95 |
javaLangObject = (HotSpotResolvedObjectTypeImpl) fromClass(Object.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
96 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
97 |
return javaLangObject; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
98 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
99 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
100 |
HotSpotResolvedObjectTypeImpl getJavaLangString() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
101 |
if (javaLangString == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
102 |
javaLangString = (HotSpotResolvedObjectTypeImpl) fromClass(String.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
103 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
104 |
return javaLangString; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
105 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
106 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
107 |
HotSpotResolvedObjectTypeImpl getJavaLangClass() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
108 |
if (javaLangClass == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
109 |
javaLangClass = (HotSpotResolvedObjectTypeImpl) fromClass(Class.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
110 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
111 |
return javaLangClass; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
112 |
} |
49351
8bb47943a8dd
8199066: [JVMCI] EagerJVMCI option should also initialize the JVMCI compiler
dnsimon
parents:
47216
diff
changeset
|
113 |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
114 |
HotSpotResolvedObjectTypeImpl getJavaLangCloneable() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
115 |
if (cloneableType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
116 |
cloneableType = (HotSpotResolvedObjectTypeImpl) fromClass(Cloneable.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
117 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
118 |
return cloneableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
119 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
120 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
121 |
HotSpotResolvedObjectTypeImpl getJavaLangSerializable() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
122 |
if (serializableType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
123 |
serializableType = (HotSpotResolvedObjectTypeImpl) fromClass(Serializable.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
124 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
125 |
return serializableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
126 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
127 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
128 |
HotSpotResolvedObjectTypeImpl getJavaLangThrowable() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
129 |
if (throwableType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
130 |
throwableType = (HotSpotResolvedObjectTypeImpl) fromClass(Throwable.class); |
43972 | 131 |
} |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
132 |
return throwableType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
133 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
134 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
135 |
HotSpotResolvedObjectTypeImpl getJavaLangEnum() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
136 |
if (enumType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
137 |
enumType = (HotSpotResolvedObjectTypeImpl) fromClass(Enum.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
138 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
139 |
return enumType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
140 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
141 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
142 |
HotSpotResolvedObjectTypeImpl getConstantCallSite() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
143 |
if (constantCallSiteType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
144 |
constantCallSiteType = (HotSpotResolvedObjectTypeImpl) fromClass(ConstantCallSite.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
145 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
146 |
return constantCallSiteType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
147 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
148 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
149 |
HotSpotResolvedObjectTypeImpl getCallSite() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
150 |
if (callSiteType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
151 |
callSiteType = (HotSpotResolvedObjectTypeImpl) fromClass(CallSite.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
152 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
153 |
return callSiteType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
154 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
155 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
156 |
HotSpotResolvedObjectType getMethodHandleClass() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
157 |
if (javaLangInvokeMethodHandle == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
158 |
javaLangInvokeMethodHandle = (HotSpotResolvedObjectTypeImpl) fromClass(MethodHandle.class); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
159 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
160 |
return javaLangInvokeMethodHandle; |
43972 | 161 |
} |
162 |
||
163 |
/** |
|
164 |
* Gets the singleton {@link HotSpotJVMCIRuntime} object. |
|
165 |
*/ |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
166 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
167 |
@SuppressWarnings("try") |
43972 | 168 |
public static HotSpotJVMCIRuntime runtime() { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
169 |
HotSpotJVMCIRuntime result = instance; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
170 |
if (result == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
171 |
// Synchronize on JVMCI.class to avoid deadlock |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
172 |
// between the two JVMCI initialization paths: |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
173 |
// HotSpotJVMCIRuntime.runtime() and JVMCI.getRuntime(). |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
174 |
synchronized (JVMCI.class) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
175 |
result = instance; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
176 |
if (result == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
177 |
try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
178 |
instance = result = new HotSpotJVMCIRuntime(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
179 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
180 |
// Can only do eager initialization of the JVMCI compiler |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
181 |
// once the singleton instance is available. |
54732 | 182 |
if (result.config.getFlag("EagerJVMCI", Boolean.class)) { |
183 |
result.getCompiler(); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
184 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
185 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
186 |
// Ensures JVMCIRuntime::_HotSpotJVMCIRuntime_instance is |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
187 |
// initialized. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
188 |
JVMCI.getRuntime(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
189 |
} |
55159
a38132298eda
8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
54733
diff
changeset
|
190 |
// Make sure all the primitive box caches are populated (required to properly materialize boxed primitives |
a38132298eda
8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
54733
diff
changeset
|
191 |
// during deoptimization). |
a38132298eda
8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
54733
diff
changeset
|
192 |
Object[] boxCaches = { Boolean.valueOf(false), Byte.valueOf((byte)0), Short.valueOf((short) 0), Character.valueOf((char) 0), Integer.valueOf(0), Long.valueOf(0) }; |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
193 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
194 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
195 |
return result; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
196 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
197 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
198 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
199 |
static Throwable decodeThrowable(String encodedThrowable) throws Throwable { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
200 |
return TranslatedException.decodeThrowable(encodedThrowable); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
201 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
202 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
203 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
204 |
static String encodeThrowable(Throwable throwable) throws Throwable { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
205 |
return TranslatedException.encodeThrowable(throwable); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
206 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
207 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
208 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
209 |
static String callToString(Object o) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
210 |
return o.toString(); |
43972 | 211 |
} |
212 |
||
213 |
/** |
|
214 |
* A list of all supported JVMCI options. |
|
215 |
*/ |
|
216 |
public enum Option { |
|
217 |
// @formatter:off |
|
44836 | 218 |
Compiler(String.class, null, "Selects the system compiler. This must match the getCompilerName() value returned " + |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
219 |
"by a jdk.vm.ci.runtime.JVMCICompilerFactory provider. " + |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
220 |
"An empty string or the value \"null\" selects a compiler " + |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
221 |
"that will raise an exception upon receiving a compilation request."), |
43972 | 222 |
// Note: The following one is not used (see InitTimer.ENABLED). It is added here |
223 |
// so that -XX:+JVMCIPrintProperties shows the option. |
|
224 |
InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."), |
|
225 |
PrintConfig(Boolean.class, false, "Prints VM configuration available via JVMCI."), |
|
55463 | 226 |
AuditHandles(Boolean.class, false, "Record stack trace along with scoped foreign object reference wrappers " + |
227 |
"to debug issue with a wrapper being used after its scope has closed."), |
|
43972 | 228 |
TraceMethodDataFilter(String.class, null, |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
229 |
"Enables tracing of profiling info when read by JVMCI.", |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
230 |
"Empty value: trace all methods", |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
231 |
"Non-empty value: trace methods whose fully qualified name contains the value."), |
43972 | 232 |
UseProfilingInformation(Boolean.class, true, ""); |
233 |
// @formatter:on |
|
234 |
||
235 |
/** |
|
236 |
* The prefix for system properties that are JVMCI options. |
|
237 |
*/ |
|
238 |
private static final String JVMCI_OPTION_PROPERTY_PREFIX = "jvmci."; |
|
239 |
||
240 |
/** |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
241 |
* Sentinel for value initialized to {@code null} since {@code null} means uninitialized. |
43972 | 242 |
*/ |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
243 |
private static final String NULL_VALUE = "NULL"; |
43972 | 244 |
|
245 |
private final Class<?> type; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
246 |
@NativeImageReinitialize private Object value; |
43972 | 247 |
private final Object defaultValue; |
248 |
private boolean isDefault; |
|
249 |
private final String[] helpLines; |
|
250 |
||
251 |
Option(Class<?> type, Object defaultValue, String... helpLines) { |
|
252 |
assert Character.isUpperCase(name().charAt(0)) : "Option name must start with upper-case letter: " + name(); |
|
253 |
this.type = type; |
|
254 |
this.defaultValue = defaultValue; |
|
255 |
this.helpLines = helpLines; |
|
256 |
} |
|
257 |
||
258 |
@SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "sentinel must be String since it's a static final in an enum") |
|
259 |
private Object getValue() { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
260 |
if (value == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
261 |
String propertyValue = Services.getSavedProperty(getPropertyName()); |
43972 | 262 |
if (propertyValue == null) { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
263 |
this.value = defaultValue == null ? NULL_VALUE : defaultValue; |
43972 | 264 |
this.isDefault = true; |
265 |
} else { |
|
266 |
if (type == Boolean.class) { |
|
267 |
this.value = Boolean.parseBoolean(propertyValue); |
|
268 |
} else if (type == String.class) { |
|
269 |
this.value = propertyValue; |
|
270 |
} else { |
|
271 |
throw new JVMCIError("Unexpected option type " + type); |
|
272 |
} |
|
273 |
this.isDefault = false; |
|
274 |
} |
|
275 |
} |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
276 |
return value == NULL_VALUE ? null : value; |
43972 | 277 |
} |
278 |
||
279 |
/** |
|
280 |
* Gets the name of system property from which this option gets its value. |
|
281 |
*/ |
|
282 |
public String getPropertyName() { |
|
283 |
return JVMCI_OPTION_PROPERTY_PREFIX + name(); |
|
284 |
} |
|
285 |
||
286 |
/** |
|
287 |
* Returns the option's value as boolean. |
|
288 |
* |
|
289 |
* @return option's value |
|
290 |
*/ |
|
291 |
public boolean getBoolean() { |
|
292 |
return (boolean) getValue(); |
|
293 |
} |
|
294 |
||
295 |
/** |
|
296 |
* Returns the option's value as String. |
|
297 |
* |
|
298 |
* @return option's value |
|
299 |
*/ |
|
300 |
public String getString() { |
|
301 |
return (String) getValue(); |
|
302 |
} |
|
303 |
||
304 |
private static final int PROPERTY_LINE_WIDTH = 80; |
|
305 |
private static final int PROPERTY_HELP_INDENT = 10; |
|
306 |
||
307 |
/** |
|
308 |
* Prints a description of the properties used to configure shared JVMCI code. |
|
309 |
* |
|
310 |
* @param out stream to print to |
|
311 |
*/ |
|
312 |
public static void printProperties(PrintStream out) { |
|
313 |
out.println("[JVMCI properties]"); |
|
314 |
Option[] values = values(); |
|
315 |
for (Option option : values) { |
|
316 |
Object value = option.getValue(); |
|
317 |
if (value instanceof String) { |
|
318 |
value = '"' + String.valueOf(value) + '"'; |
|
319 |
} |
|
320 |
||
321 |
String name = option.getPropertyName(); |
|
322 |
String assign = option.isDefault ? "=" : ":="; |
|
323 |
String typeName = option.type.getSimpleName(); |
|
324 |
String linePrefix = String.format("%s %s %s ", name, assign, value); |
|
325 |
int typeStartPos = PROPERTY_LINE_WIDTH - typeName.length(); |
|
326 |
int linePad = typeStartPos - linePrefix.length(); |
|
327 |
if (linePad > 0) { |
|
328 |
out.printf("%s%-" + linePad + "s[%s]%n", linePrefix, "", typeName); |
|
329 |
} else { |
|
330 |
out.printf("%s[%s]%n", linePrefix, typeName); |
|
331 |
} |
|
332 |
for (String line : option.helpLines) { |
|
333 |
out.printf("%" + PROPERTY_HELP_INDENT + "s%s%n", "", line); |
|
334 |
} |
|
335 |
} |
|
336 |
} |
|
337 |
} |
|
338 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
339 |
private static HotSpotJVMCIBackendFactory findFactory(String architecture) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
340 |
Iterable<HotSpotJVMCIBackendFactory> factories = getHotSpotJVMCIBackendFactories(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
341 |
assert factories != null : "sanity"; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
342 |
for (HotSpotJVMCIBackendFactory factory : factories) { |
43972 | 343 |
if (factory.getArchitecture().equalsIgnoreCase(architecture)) { |
344 |
return factory; |
|
345 |
} |
|
346 |
} |
|
347 |
||
348 |
throw new JVMCIError("No JVMCI runtime available for the %s architecture", architecture); |
|
349 |
} |
|
350 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
351 |
private static volatile List<HotSpotJVMCIBackendFactory> cachedHotSpotJVMCIBackendFactories; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
352 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
353 |
@SuppressFBWarnings(value = "LI_LAZY_INIT_UPDATE_STATIC", justification = "not sure about this") |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
354 |
private static Iterable<HotSpotJVMCIBackendFactory> getHotSpotJVMCIBackendFactories() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
355 |
if (IS_IN_NATIVE_IMAGE || cachedHotSpotJVMCIBackendFactories != null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
356 |
return cachedHotSpotJVMCIBackendFactories; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
357 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
358 |
Iterable<HotSpotJVMCIBackendFactory> result = ServiceLoader.load(HotSpotJVMCIBackendFactory.class, ClassLoader.getSystemClassLoader()); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
359 |
if (IS_BUILDING_NATIVE_IMAGE) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
360 |
cachedHotSpotJVMCIBackendFactories = new ArrayList<>(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
361 |
for (HotSpotJVMCIBackendFactory factory : result) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
362 |
cachedHotSpotJVMCIBackendFactories.add(factory); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
363 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
364 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
365 |
return result; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
366 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
367 |
|
43972 | 368 |
/** |
369 |
* Gets the kind of a word value on the {@linkplain #getHostJVMCIBackend() host} backend. |
|
370 |
*/ |
|
371 |
public static JavaKind getHostWordKind() { |
|
372 |
return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordJavaKind; |
|
373 |
} |
|
374 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
375 |
protected final CompilerToVM compilerToVm; |
43972 | 376 |
|
377 |
protected final HotSpotVMConfigStore configStore; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
378 |
protected final HotSpotVMConfig config; |
43972 | 379 |
private final JVMCIBackend hostBackend; |
380 |
||
381 |
private final JVMCICompilerFactory compilerFactory; |
|
382 |
private final HotSpotJVMCICompilerFactory hsCompilerFactory; |
|
383 |
private volatile JVMCICompiler compiler; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
384 |
protected final HotSpotJVMCIReflection reflection; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
385 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
386 |
@NativeImageReinitialize private volatile boolean creatingCompiler; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
387 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
388 |
/** |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
389 |
* Cache for speeding up {@link #fromClass(Class)}. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
390 |
*/ |
54733
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
391 |
@NativeImageReinitialize private volatile ClassValue<WeakReferenceHolder<HotSpotResolvedJavaType>> resolvedJavaType; |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
392 |
|
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
393 |
/** |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
394 |
* To avoid calling ClassValue.remove to refresh the weak reference, which |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
395 |
* under certain circumstances can lead to an infinite loop, we use a |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
396 |
* permanent holder with a mutable field that we refresh. |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
397 |
*/ |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
398 |
private static class WeakReferenceHolder<T> { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
399 |
private volatile WeakReference<T> ref; |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
400 |
WeakReferenceHolder(T value) { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
401 |
set(value); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
402 |
} |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
403 |
void set(T value) { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
404 |
ref = new WeakReference<T>(value); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
405 |
} |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
406 |
T get() { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
407 |
return ref.get(); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
408 |
} |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
409 |
}; |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
410 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
411 |
@NativeImageReinitialize private HashMap<Long, WeakReference<ResolvedJavaType>> resolvedJavaTypes; |
43972 | 412 |
|
413 |
/** |
|
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
414 |
* Stores the value set by {@link #excludeFromJVMCICompilation(Module...)} so that it can |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
415 |
* be read from the VM. |
43972 | 416 |
*/ |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
417 |
@SuppressWarnings("unused")// |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
418 |
@NativeImageReinitialize private Module[] excludeFromJVMCICompilation; |
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
419 |
|
43972 | 420 |
|
421 |
private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>(); |
|
422 |
||
423 |
private volatile List<HotSpotVMEventListener> vmEventListeners; |
|
424 |
||
425 |
private Iterable<HotSpotVMEventListener> getVmEventListeners() { |
|
426 |
if (vmEventListeners == null) { |
|
427 |
synchronized (this) { |
|
428 |
if (vmEventListeners == null) { |
|
429 |
vmEventListeners = JVMCIServiceLocator.getProviders(HotSpotVMEventListener.class); |
|
430 |
} |
|
431 |
} |
|
432 |
} |
|
433 |
return vmEventListeners; |
|
434 |
} |
|
435 |
||
436 |
@SuppressWarnings("try") |
|
437 |
private HotSpotJVMCIRuntime() { |
|
438 |
compilerToVm = new CompilerToVM(); |
|
439 |
||
440 |
try (InitTimer t = timer("HotSpotVMConfig<init>")) { |
|
441 |
configStore = new HotSpotVMConfigStore(compilerToVm); |
|
442 |
config = new HotSpotVMConfig(configStore); |
|
443 |
} |
|
444 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
445 |
reflection = IS_IN_NATIVE_IMAGE ? new SharedLibraryJVMCIReflection() : new HotSpotJDKReflection(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
446 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
447 |
PrintStream vmLogStream = null; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
448 |
if (IS_IN_NATIVE_IMAGE) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
449 |
// Redirect System.out and System.err to HotSpot's TTY stream |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
450 |
vmLogStream = new PrintStream(getLogStream()); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
451 |
System.setOut(vmLogStream); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
452 |
System.setErr(vmLogStream); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
453 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
454 |
|
43972 | 455 |
String hostArchitecture = config.getHostArchitectureName(); |
456 |
||
457 |
HotSpotJVMCIBackendFactory factory; |
|
458 |
try (InitTimer t = timer("find factory:", hostArchitecture)) { |
|
459 |
factory = findFactory(hostArchitecture); |
|
460 |
} |
|
461 |
||
462 |
try (InitTimer t = timer("create JVMCI backend:", hostArchitecture)) { |
|
463 |
hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); |
|
464 |
} |
|
465 |
||
466 |
compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory(); |
|
467 |
if (compilerFactory instanceof HotSpotJVMCICompilerFactory) { |
|
468 |
hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory; |
|
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
469 |
if (hsCompilerFactory.getCompilationLevelAdjustment() != None) { |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
470 |
String name = HotSpotJVMCICompilerFactory.class.getName(); |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
471 |
String msg = String.format("%s.getCompilationLevelAdjustment() is no longer supported. " + |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
472 |
"Use %s.excludeFromJVMCICompilation() instead.", name, name); |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
473 |
throw new UnsupportedOperationException(msg); |
43972 | 474 |
} |
475 |
} else { |
|
476 |
hsCompilerFactory = null; |
|
477 |
} |
|
478 |
||
479 |
if (config.getFlag("JVMCIPrintProperties", Boolean.class)) { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
480 |
if (vmLogStream == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
481 |
vmLogStream = new PrintStream(getLogStream()); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
482 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
483 |
Option.printProperties(vmLogStream); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
484 |
compilerFactory.printProperties(vmLogStream); |
43972 | 485 |
System.exit(0); |
486 |
} |
|
487 |
||
488 |
if (Option.PrintConfig.getBoolean()) { |
|
54732 | 489 |
configStore.printConfig(); |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
490 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
491 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
492 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
493 |
HotSpotResolvedJavaType createClass(Class<?> javaClass) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
494 |
if (javaClass.isPrimitive()) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
495 |
return HotSpotResolvedPrimitiveType.forKind(JavaKind.fromJavaClass(javaClass)); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
496 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
497 |
if (IS_IN_NATIVE_IMAGE) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
498 |
try { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
499 |
return compilerToVm.lookupType(javaClass.getName().replace('.', '/'), null, true); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
500 |
} catch (ClassNotFoundException e) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
501 |
throw new JVMCIError(e); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
502 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
503 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
504 |
return compilerToVm.lookupClass(javaClass); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
505 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
506 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
507 |
private HotSpotResolvedJavaType fromClass0(Class<?> javaClass) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
508 |
if (resolvedJavaType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
509 |
synchronized (this) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
510 |
if (resolvedJavaType == null) { |
54733
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
511 |
resolvedJavaType = new ClassValue<WeakReferenceHolder<HotSpotResolvedJavaType>>() { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
512 |
@Override |
54733
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
513 |
protected WeakReferenceHolder<HotSpotResolvedJavaType> computeValue(Class<?> type) { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
514 |
return new WeakReferenceHolder<>(createClass(type)); |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
515 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
516 |
}; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
517 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
518 |
} |
43972 | 519 |
} |
54733
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
520 |
|
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
521 |
WeakReferenceHolder<HotSpotResolvedJavaType> ref = resolvedJavaType.get(javaClass); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
522 |
HotSpotResolvedJavaType javaType = ref.get(); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
523 |
if (javaType == null) { |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
524 |
/* |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
525 |
* If the referent has become null, create a new value and |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
526 |
* update cached weak reference. |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
527 |
*/ |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
528 |
javaType = createClass(javaClass); |
28dd27202591
8218700: infinite loop in HotSpotJVMCIMetaAccessContext.fromClass after OutOfMemoryError
dlong
parents:
54732
diff
changeset
|
529 |
ref.set(javaType); |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
530 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
531 |
return javaType; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
532 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
533 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
534 |
/** |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
535 |
* Gets the JVMCI mirror for a {@link Class} object. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
536 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
537 |
* @return the {@link ResolvedJavaType} corresponding to {@code javaClass} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
538 |
*/ |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
539 |
HotSpotResolvedJavaType fromClass(Class<?> javaClass) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
540 |
if (javaClass == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
541 |
return null; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
542 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
543 |
return fromClass0(javaClass); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
544 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
545 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
546 |
synchronized HotSpotResolvedObjectTypeImpl fromMetaspace(long klassPointer, String signature) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
547 |
if (resolvedJavaTypes == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
548 |
resolvedJavaTypes = new HashMap<>(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
549 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
550 |
assert klassPointer != 0; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
551 |
WeakReference<ResolvedJavaType> klassReference = resolvedJavaTypes.get(klassPointer); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
552 |
HotSpotResolvedObjectTypeImpl javaType = null; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
553 |
if (klassReference != null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
554 |
javaType = (HotSpotResolvedObjectTypeImpl) klassReference.get(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
555 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
556 |
if (javaType == null) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
557 |
javaType = new HotSpotResolvedObjectTypeImpl(klassPointer, signature); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
558 |
resolvedJavaTypes.put(klassPointer, new WeakReference<>(javaType)); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
559 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
560 |
return javaType; |
43972 | 561 |
} |
562 |
||
563 |
private JVMCIBackend registerBackend(JVMCIBackend backend) { |
|
564 |
Class<? extends Architecture> arch = backend.getCodeCache().getTarget().arch.getClass(); |
|
565 |
JVMCIBackend oldValue = backends.put(arch, backend); |
|
566 |
assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName(); |
|
567 |
return backend; |
|
568 |
} |
|
569 |
||
570 |
public HotSpotVMConfigStore getConfigStore() { |
|
571 |
return configStore; |
|
572 |
} |
|
573 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
574 |
public HotSpotVMConfig getConfig() { |
43972 | 575 |
return config; |
576 |
} |
|
577 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
578 |
public CompilerToVM getCompilerToVM() { |
43972 | 579 |
return compilerToVm; |
580 |
} |
|
581 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
582 |
HotSpotJVMCIReflection getReflection() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
583 |
return reflection; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
584 |
} |
50858 | 585 |
|
586 |
/** |
|
587 |
* Gets a predicate that determines if a given type can be considered trusted for the purpose of |
|
588 |
* intrinsifying methods it declares. |
|
589 |
* |
|
590 |
* @param compilerLeafClasses classes in the leaves of the module graph comprising the JVMCI |
|
591 |
* compiler. |
|
592 |
*/ |
|
593 |
public Predicate<ResolvedJavaType> getIntrinsificationTrustPredicate(Class<?>... compilerLeafClasses) { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
594 |
return new Predicate<ResolvedJavaType>() { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
595 |
@Override |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
596 |
public boolean test(ResolvedJavaType type) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
597 |
if (type instanceof HotSpotResolvedObjectTypeImpl) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
598 |
HotSpotResolvedObjectTypeImpl hsType = (HotSpotResolvedObjectTypeImpl) type; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
599 |
return compilerToVm.isTrustedForIntrinsics(hsType); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
600 |
} else { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
601 |
return false; |
51420
6bb7b8d0da76
8209535: [JVMCI] Do not swallow NoClassDefFoundError when converting JVMCI methods and fields to reflection objects
dnsimon
parents:
50858
diff
changeset
|
602 |
} |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
603 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
604 |
}; |
50858 | 605 |
} |
606 |
||
607 |
/** |
|
608 |
* Get the {@link Class} corresponding to {@code type}. |
|
609 |
* |
|
610 |
* @param type the type for which a {@link Class} is requested |
|
611 |
* @return the original Java class corresponding to {@code type} or {@code null} if this runtime |
|
612 |
* does not support mapping {@link ResolvedJavaType} instances to {@link Class} |
|
613 |
* instances |
|
614 |
*/ |
|
615 |
public Class<?> getMirror(ResolvedJavaType type) { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
616 |
if (type instanceof HotSpotResolvedJavaType && reflection instanceof HotSpotJDKReflection) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
617 |
return ((HotSpotJDKReflection) reflection).getMirror((HotSpotResolvedJavaType) type); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
618 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
619 |
return null; |
50858 | 620 |
} |
621 |
||
622 |
@Override |
|
43972 | 623 |
public JVMCICompiler getCompiler() { |
624 |
if (compiler == null) { |
|
625 |
synchronized (this) { |
|
626 |
if (compiler == null) { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
627 |
assert !creatingCompiler : "recursive compiler creation"; |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
628 |
creatingCompiler = true; |
43972 | 629 |
compiler = compilerFactory.createCompiler(this); |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
630 |
creatingCompiler = false; |
43972 | 631 |
} |
632 |
} |
|
633 |
} |
|
634 |
return compiler; |
|
635 |
} |
|
636 |
||
50858 | 637 |
/** |
638 |
* Converts a name to a Java type. This method attempts to resolve {@code name} to a |
|
639 |
* {@link ResolvedJavaType}. |
|
640 |
* |
|
641 |
* @param name a well formed Java type in {@linkplain JavaType#getName() internal} format |
|
642 |
* @param accessingType the context of resolution which must be non-null |
|
643 |
* @param resolve specifies whether resolution failure results in an unresolved type being |
|
644 |
* return or a {@link LinkageError} being thrown |
|
645 |
* @return a Java type for {@code name} which is guaranteed to be of type |
|
646 |
* {@link ResolvedJavaType} if {@code resolve == true} |
|
647 |
* @throws LinkageError if {@code resolve == true} and the resolution failed |
|
648 |
* @throws NullPointerException if {@code accessingClass} is {@code null} |
|
649 |
*/ |
|
43972 | 650 |
public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) { |
651 |
Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class"); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
652 |
return lookupTypeInternal(name, accessingType, resolve); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
653 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
654 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
655 |
JavaType lookupTypeInternal(String name, HotSpotResolvedObjectType accessingType, boolean resolve) { |
43972 | 656 |
// If the name represents a primitive type we can short-circuit the lookup. |
657 |
if (name.length() == 1) { |
|
658 |
JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
659 |
return HotSpotResolvedPrimitiveType.forKind(kind); |
43972 | 660 |
} |
661 |
||
662 |
// Resolve non-primitive types in the VM. |
|
663 |
HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType; |
|
46972
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
664 |
try { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
665 |
final HotSpotResolvedJavaType klass = compilerToVm.lookupType(name, hsAccessingType, resolve); |
43972 | 666 |
|
46972
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
667 |
if (klass == null) { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
668 |
assert resolve == false : name; |
50858 | 669 |
return UnresolvedJavaType.create(name); |
46972
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
670 |
} |
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
671 |
return klass; |
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
672 |
} catch (ClassNotFoundException e) { |
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
673 |
throw (NoClassDefFoundError) new NoClassDefFoundError().initCause(e); |
43972 | 674 |
} |
675 |
} |
|
676 |
||
50858 | 677 |
@Override |
43972 | 678 |
public JVMCIBackend getHostJVMCIBackend() { |
679 |
return hostBackend; |
|
680 |
} |
|
681 |
||
50858 | 682 |
@Override |
43972 | 683 |
public <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch) { |
684 |
assert arch != Architecture.class; |
|
685 |
return backends.get(arch); |
|
686 |
} |
|
687 |
||
688 |
public Map<Class<? extends Architecture>, JVMCIBackend> getJVMCIBackends() { |
|
689 |
return Collections.unmodifiableMap(backends); |
|
690 |
} |
|
691 |
||
55463 | 692 |
@SuppressWarnings("try") |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
693 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
694 |
private HotSpotCompilationRequestResult compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long compileState, int id) { |
55463 | 695 |
HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, compileState, id); |
696 |
CompilationRequestResult result = getCompiler().compileMethod(request); |
|
43972 | 697 |
assert result != null : "compileMethod must always return something"; |
698 |
HotSpotCompilationRequestResult hsResult; |
|
699 |
if (result instanceof HotSpotCompilationRequestResult) { |
|
700 |
hsResult = (HotSpotCompilationRequestResult) result; |
|
701 |
} else { |
|
702 |
Object failure = result.getFailure(); |
|
703 |
if (failure != null) { |
|
704 |
boolean retry = false; // Be conservative with unknown compiler |
|
705 |
hsResult = HotSpotCompilationRequestResult.failure(failure.toString(), retry); |
|
706 |
} else { |
|
707 |
int inlinedBytecodes = -1; |
|
708 |
hsResult = HotSpotCompilationRequestResult.success(inlinedBytecodes); |
|
709 |
} |
|
710 |
} |
|
711 |
return hsResult; |
|
712 |
} |
|
713 |
||
714 |
/** |
|
715 |
* Shuts down the runtime. |
|
716 |
*/ |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
717 |
@VMEntryPoint |
43972 | 718 |
private void shutdown() throws Exception { |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
719 |
// Cleaners are normally only processed when a new Cleaner is |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
720 |
// instantiated so process all remaining cleaners now. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
721 |
Cleaner.clean(); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
722 |
|
43972 | 723 |
for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) { |
724 |
vmEventListener.notifyShutdown(); |
|
725 |
} |
|
726 |
} |
|
727 |
||
728 |
/** |
|
729 |
* Notify on completion of a bootstrap. |
|
730 |
*/ |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
731 |
@VMEntryPoint |
43972 | 732 |
private void bootstrapFinished() throws Exception { |
733 |
for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) { |
|
734 |
vmEventListener.notifyBootstrapFinished(); |
|
735 |
} |
|
736 |
} |
|
737 |
||
738 |
/** |
|
739 |
* Notify on successful install into the CodeCache. |
|
740 |
* |
|
741 |
* @param hotSpotCodeCacheProvider |
|
742 |
* @param installedCode |
|
743 |
* @param compiledCode |
|
744 |
*/ |
|
745 |
void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) { |
|
746 |
for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) { |
|
747 |
vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compiledCode); |
|
748 |
} |
|
749 |
} |
|
750 |
||
54732 | 751 |
/** |
752 |
* Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to HotSpot's |
|
753 |
* log stream. |
|
754 |
* |
|
755 |
* @param flush specifies if the log stream should be flushed after writing |
|
756 |
* @param canThrow specifies if an error in the {@code bytes}, {@code offset} or {@code length} |
|
757 |
* arguments should result in an exception or a negative return value. If |
|
758 |
* {@code false}, this call will not perform any heap allocation |
|
759 |
* @return 0 on success, -1 if {@code bytes == null && !canThrow}, -2 if {@code !canThrow} and |
|
760 |
* copying would cause access of data outside array bounds |
|
761 |
* @throws NullPointerException if {@code bytes == null} |
|
762 |
* @throws IndexOutOfBoundsException if copying would cause access of data outside array bounds |
|
763 |
*/ |
|
764 |
public int writeDebugOutput(byte[] bytes, int offset, int length, boolean flush, boolean canThrow) { |
|
765 |
return compilerToVm.writeDebugOutput(bytes, offset, length, flush, canThrow); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
766 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
767 |
|
50858 | 768 |
/** |
769 |
* Gets an output stream that writes to HotSpot's {@code tty} stream. |
|
770 |
*/ |
|
43972 | 771 |
public OutputStream getLogStream() { |
772 |
return new OutputStream() { |
|
773 |
||
774 |
@Override |
|
775 |
public void write(byte[] b, int off, int len) throws IOException { |
|
776 |
if (b == null) { |
|
777 |
throw new NullPointerException(); |
|
778 |
} else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) { |
|
779 |
throw new IndexOutOfBoundsException(); |
|
780 |
} else if (len == 0) { |
|
781 |
return; |
|
782 |
} |
|
54732 | 783 |
compilerToVm.writeDebugOutput(b, off, len, false, true); |
43972 | 784 |
} |
785 |
||
786 |
@Override |
|
787 |
public void write(int b) throws IOException { |
|
788 |
write(new byte[]{(byte) b}, 0, 1); |
|
789 |
} |
|
790 |
||
791 |
@Override |
|
792 |
public void flush() throws IOException { |
|
793 |
compilerToVm.flushDebugOutput(); |
|
794 |
} |
|
795 |
}; |
|
796 |
} |
|
797 |
||
798 |
/** |
|
799 |
* Collects the current values of all JVMCI benchmark counters, summed up over all threads. |
|
800 |
*/ |
|
801 |
public long[] collectCounters() { |
|
802 |
return compilerToVm.collectCounters(); |
|
803 |
} |
|
50858 | 804 |
|
805 |
/** |
|
55206 | 806 |
* @return the current number of per thread counters. May be set through |
807 |
* {@code -XX:JVMCICompilerSize=} command line option or the |
|
808 |
* {@link #setCountersSize(int)} call. |
|
809 |
*/ |
|
810 |
public int getCountersSize() { |
|
811 |
return compilerToVm.getCountersSize(); |
|
812 |
} |
|
813 |
||
814 |
/** |
|
58282
03fce7b04b42
8230395: Code checks for NULL value returned from NEW_C_HEAP_ARRAY which can not happen
dholmes
parents:
55463
diff
changeset
|
815 |
* Enlarge the number of per thread counters available. Requires a safepoint so |
55206 | 816 |
* resizing should be rare to avoid performance effects. |
817 |
* |
|
818 |
* @param newSize |
|
819 |
*/ |
|
58282
03fce7b04b42
8230395: Code checks for NULL value returned from NEW_C_HEAP_ARRAY which can not happen
dholmes
parents:
55463
diff
changeset
|
820 |
public void setCountersSize(int newSize) { |
03fce7b04b42
8230395: Code checks for NULL value returned from NEW_C_HEAP_ARRAY which can not happen
dholmes
parents:
55463
diff
changeset
|
821 |
compilerToVm.setCountersSize(newSize); |
55206 | 822 |
} |
823 |
||
824 |
/** |
|
50858 | 825 |
* The offset from the origin of an array to the first element. |
826 |
* |
|
827 |
* @return the offset in bytes |
|
828 |
*/ |
|
829 |
public int getArrayBaseOffset(JavaKind kind) { |
|
830 |
switch (kind) { |
|
831 |
case Boolean: |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
832 |
return compilerToVm.ARRAY_BOOLEAN_BASE_OFFSET; |
50858 | 833 |
case Byte: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
834 |
return compilerToVm.ARRAY_BYTE_BASE_OFFSET; |
50858 | 835 |
case Char: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
836 |
return compilerToVm.ARRAY_CHAR_BASE_OFFSET; |
50858 | 837 |
case Short: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
838 |
return compilerToVm.ARRAY_SHORT_BASE_OFFSET; |
50858 | 839 |
case Int: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
840 |
return compilerToVm.ARRAY_INT_BASE_OFFSET; |
50858 | 841 |
case Long: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
842 |
return compilerToVm.ARRAY_LONG_BASE_OFFSET; |
50858 | 843 |
case Float: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
844 |
return compilerToVm.ARRAY_FLOAT_BASE_OFFSET; |
50858 | 845 |
case Double: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
846 |
return compilerToVm.ARRAY_DOUBLE_BASE_OFFSET; |
50858 | 847 |
case Object: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
848 |
return compilerToVm.ARRAY_OBJECT_BASE_OFFSET; |
50858 | 849 |
default: |
850 |
throw new JVMCIError("%s", kind); |
|
851 |
} |
|
852 |
||
853 |
} |
|
854 |
||
855 |
/** |
|
856 |
* The scale used for the index when accessing elements of an array of this kind. |
|
857 |
* |
|
858 |
* @return the scale in order to convert the index into a byte offset |
|
859 |
*/ |
|
860 |
public int getArrayIndexScale(JavaKind kind) { |
|
861 |
switch (kind) { |
|
862 |
case Boolean: |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
863 |
return compilerToVm.ARRAY_BOOLEAN_INDEX_SCALE; |
50858 | 864 |
case Byte: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
865 |
return compilerToVm.ARRAY_BYTE_INDEX_SCALE; |
50858 | 866 |
case Char: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
867 |
return compilerToVm.ARRAY_CHAR_INDEX_SCALE; |
50858 | 868 |
case Short: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
869 |
return compilerToVm.ARRAY_SHORT_INDEX_SCALE; |
50858 | 870 |
case Int: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
871 |
return compilerToVm.ARRAY_INT_INDEX_SCALE; |
50858 | 872 |
case Long: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
873 |
return compilerToVm.ARRAY_LONG_INDEX_SCALE; |
50858 | 874 |
case Float: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
875 |
return compilerToVm.ARRAY_FLOAT_INDEX_SCALE; |
50858 | 876 |
case Double: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
877 |
return compilerToVm.ARRAY_DOUBLE_INDEX_SCALE; |
50858 | 878 |
case Object: |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
879 |
return compilerToVm.ARRAY_OBJECT_INDEX_SCALE; |
50858 | 880 |
default: |
881 |
throw new JVMCIError("%s", kind); |
|
882 |
||
883 |
} |
|
884 |
} |
|
885 |
||
886 |
/** |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
887 |
* Links each native method in {@code clazz} to an implementation in the JVMCI shared library. |
50858 | 888 |
* <p> |
889 |
* A use case for this is a JVMCI compiler implementation that offers an API to Java code |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
890 |
* executing in HotSpot to exercise functionality (mostly) in the JVMCI shared library. For |
50858 | 891 |
* example: |
892 |
* |
|
893 |
* <pre> |
|
894 |
* package com.jcompile; |
|
895 |
* |
|
896 |
* import java.lang.reflect.Method; |
|
897 |
* |
|
898 |
* public static class JCompile { |
|
899 |
* static { |
|
900 |
* HotSpotJVMCIRuntime.runtime().registerNativeMethods(JCompile.class); |
|
901 |
* } |
|
902 |
* public static boolean compile(Method method, String[] options) { |
|
903 |
* // Convert to simpler data types for passing/serializing across native interface |
|
904 |
* long metaspaceMethodHandle = getHandle(method); |
|
905 |
* char[] opts = convertToCharArray(options); |
|
906 |
* return compile(metaspaceMethodHandle, opts); |
|
907 |
* } |
|
908 |
* private static native boolean compile0(long metaspaceMethodHandle, char[] options); |
|
909 |
* |
|
910 |
* private static long getHandle(Method method) { ... } |
|
911 |
* private static char[] convertToCharArray(String[] a) { ... } |
|
912 |
* } |
|
913 |
* </pre> |
|
914 |
* |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
915 |
* The implementation of the native {@code JCompile.compile0} method would be in the JVMCI |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
916 |
* shared library that contains the bulk of the JVMCI compiler. The {@code JCompile.compile0} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
917 |
* implementation will be exported as the following JNI-compatible symbol: |
50858 | 918 |
* |
919 |
* <pre> |
|
920 |
* Java_com_jcompile_JCompile_compile0 |
|
921 |
* </pre> |
|
922 |
* |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
923 |
* @see "https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/design.html#resolving_native_method_names" |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
924 |
* @see "https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#creating_the_vm" |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
925 |
* @see "https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#invocation_api_functions" |
50858 | 926 |
* |
927 |
* |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
928 |
* @return an array of 4 longs where the first value is the {@code JavaVM*} value representing |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
929 |
* the Java VM in the JVMCI shared library, and the remaining values are the first 3 |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
930 |
* pointers in the Invocation API function table (i.e., {@code JNIInvokeInterface}) |
50858 | 931 |
* @throws NullPointerException if {@code clazz == null} |
54732 | 932 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
933 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
934 |
* @throws IllegalStateException if the current execution context is the JVMCI shared library |
|
935 |
* @throws IllegalArgumentException if {@code clazz} is {@link Class#isPrimitive()} |
|
936 |
* @throws UnsatisfiedLinkError if there's a problem linking a native method in {@code clazz} |
|
937 |
* (no matching JNI symbol or the native method is already linked to a different |
|
938 |
* address) |
|
50858 | 939 |
*/ |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
940 |
public long[] registerNativeMethods(Class<?> clazz) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
941 |
return compilerToVm.registerNativeMethods(clazz); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
942 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
943 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
944 |
/** |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
945 |
* Creates or retrieves an object in the peer runtime that mirrors {@code obj}. The types whose |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
946 |
* objects can be translated are: |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
947 |
* <ul> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
948 |
* <li>{@link HotSpotResolvedJavaMethodImpl},</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
949 |
* <li>{@link HotSpotResolvedObjectTypeImpl},</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
950 |
* <li>{@link HotSpotResolvedPrimitiveType},</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
951 |
* <li>{@link IndirectHotSpotObjectConstantImpl},</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
952 |
* <li>{@link DirectHotSpotObjectConstantImpl} and</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
953 |
* <li>{@link HotSpotNmethod}</li> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
954 |
* </ul> |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
955 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
956 |
* This mechanism can be used to pass and return values between the HotSpot and JVMCI shared |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
957 |
* library runtimes. In the receiving runtime, the value can be converted back to an object with |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
958 |
* {@link #unhand(Class, long)}. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
959 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
960 |
* @param obj an object for which an equivalent instance in the peer runtime is requested |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
961 |
* @return a JNI global reference to the mirror of {@code obj} in the peer runtime |
54732 | 962 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
963 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
964 |
* @throws IllegalArgumentException if {@code obj} is not of a translatable type |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
965 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
966 |
* @see "https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/design.html#global_and_local_references" |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
967 |
*/ |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
968 |
public long translate(Object obj) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
969 |
return compilerToVm.translate(obj); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
970 |
} |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
971 |
|
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
972 |
/** |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
973 |
* Dereferences and returns the object referred to by the JNI global reference {@code handle}. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
974 |
* The global reference is deleted prior to returning. Any further use of {@code handle} is |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
975 |
* invalid. |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
976 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
977 |
* @param handle a JNI global reference to an object in the current runtime |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
978 |
* @return the object referred to by {@code handle} |
54732 | 979 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
980 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
981 |
* @throws ClassCastException if the returned object cannot be cast to {@code type} |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
982 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
983 |
* @see "https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/design.html#global_and_local_references" |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
984 |
* |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
985 |
*/ |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
986 |
public <T> T unhand(Class<T> type, long handle) { |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54647
diff
changeset
|
987 |
return type.cast(compilerToVm.unhand(handle)); |
50858 | 988 |
} |
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
989 |
|
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
990 |
/** |
54732 | 991 |
* Determines if the current thread is attached to the peer runtime. |
992 |
* |
|
993 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
|
994 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
995 |
* @throws IllegalStateException if the peer runtime has not been initialized |
|
996 |
*/ |
|
997 |
public boolean isCurrentThreadAttached() { |
|
998 |
return compilerToVm.isCurrentThreadAttached(); |
|
999 |
} |
|
1000 |
||
1001 |
/** |
|
1002 |
* Ensures the current thread is attached to the peer runtime. |
|
1003 |
* |
|
1004 |
* @param asDaemon if the thread is not yet attached, should it be attached as a daemon |
|
1005 |
* @return {@code true} if this call attached the current thread, {@code false} if the current |
|
1006 |
* thread was already attached |
|
1007 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
|
1008 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
1009 |
* @throws IllegalStateException if the peer runtime has not been initialized or there is an |
|
1010 |
* error while trying to attach the thread |
|
1011 |
*/ |
|
1012 |
public boolean attachCurrentThread(boolean asDaemon) { |
|
1013 |
return compilerToVm.attachCurrentThread(asDaemon); |
|
1014 |
} |
|
1015 |
||
1016 |
/** |
|
1017 |
* Detaches the current thread from the peer runtime. |
|
1018 |
* |
|
1019 |
* @throws UnsupportedOperationException if the JVMCI shared library is not enabled (i.e. |
|
1020 |
* {@code -XX:-UseJVMCINativeLibrary}) |
|
1021 |
* @throws IllegalStateException if the peer runtime has not been initialized or if the current |
|
1022 |
* thread is not attached or if there is an error while trying to detach the thread |
|
1023 |
*/ |
|
1024 |
public void detachCurrentThread() { |
|
1025 |
compilerToVm.detachCurrentThread(); |
|
1026 |
} |
|
1027 |
||
1028 |
/** |
|
54647
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1029 |
* Informs HotSpot that no method whose module is in {@code modules} is to be compiled |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1030 |
* with {@link #compileMethod}. |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1031 |
* |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1032 |
* @param modules the set of modules containing JVMCI compiler classes |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1033 |
*/ |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1034 |
public void excludeFromJVMCICompilation(Module...modules) { |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1035 |
this.excludeFromJVMCICompilation = modules.clone(); |
c0d9bc9b4e1f
8219403: JVMCIRuntime::adjust_comp_level should be replaced
dlong
parents:
52381
diff
changeset
|
1036 |
} |
55463 | 1037 |
|
1038 |
/** |
|
1039 |
* Calls {@link System#exit(int)} in HotSpot's runtime. |
|
1040 |
*/ |
|
1041 |
public void exitHotSpot(int status) { |
|
1042 |
if (!IS_IN_NATIVE_IMAGE) { |
|
1043 |
System.exit(status); |
|
1044 |
} |
|
1045 |
compilerToVm.callSystemExit(status); |
|
1046 |
} |
|
43972 | 1047 |
} |