author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58299 | 6df94ce3ab2f |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
54084 | 2 |
* Copyright (c) 2013, 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 |
*/ |
|
50858 | 23 |
|
24 |
||
43972 | 25 |
package org.graalvm.compiler.hotspot.meta; |
26 |
||
46344 | 27 |
import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall; |
43972 | 28 |
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; |
29 |
import static org.graalvm.compiler.core.target.Backend.ARITHMETIC_DREM; |
|
30 |
import static org.graalvm.compiler.core.target.Backend.ARITHMETIC_FREM; |
|
31 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.BACKEDGE_EVENT; |
|
54601 | 32 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.BASE64_ENCODE_BLOCK; |
54084 | 33 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.COUNTERMODE_IMPL_CRYPT; |
43972 | 34 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.DECRYPT; |
35 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.DECRYPT_BLOCK; |
|
36 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.DECRYPT_BLOCK_WITH_ORIGINAL_KEY; |
|
37 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.DECRYPT_WITH_ORIGINAL_KEY; |
|
38 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.ENCRYPT; |
|
39 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.ENCRYPT_BLOCK; |
|
40 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER; |
|
54084 | 41 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.GHASH_PROCESS_BLOCKS; |
43972 | 42 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.IC_MISS_HANDLER; |
46344 | 43 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.INITIALIZE_KLASS_BY_SYMBOL; |
44 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.INVOCATION_EVENT; |
|
43972 | 45 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.MONTGOMERY_MULTIPLY; |
46 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.MONTGOMERY_SQUARE; |
|
47 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.MULTIPLY_TO_LEN; |
|
48 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.MUL_ADD; |
|
49 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY; |
|
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
50 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL; |
43972 | 51 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE; |
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
52 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL; |
43972 | 53 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY; |
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
54 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL; |
47667 | 55 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_DYNAMIC_INVOKE; |
46344 | 56 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_KLASS_BY_SYMBOL; |
57 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_METHOD_BY_SYMBOL_AND_LOAD_COUNTERS; |
|
58 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_STRING_BY_SYMBOL; |
|
43972 | 59 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA2_IMPL_COMPRESS; |
54084 | 60 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA2_IMPL_COMPRESS_MB; |
43972 | 61 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA5_IMPL_COMPRESS; |
54084 | 62 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA5_IMPL_COMPRESS_MB; |
43972 | 63 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA_IMPL_COMPRESS; |
54084 | 64 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA_IMPL_COMPRESS_MB; |
43972 | 65 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.SQUARE_TO_LEN; |
66 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER; |
|
54084 | 67 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.VECTORIZED_MISMATCHED; |
43972 | 68 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.VM_ERROR; |
69 |
import static org.graalvm.compiler.hotspot.HotSpotBackend.WRONG_METHOD_HANDLER; |
|
52910 | 70 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.NOT_REEXECUTABLE; |
51436 | 71 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE; |
58299 | 72 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS; |
43972 | 73 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF; |
54601 | 74 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO; |
43972 | 75 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.SAFEPOINT; |
76 |
import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.STACK_INSPECTABLE_LEAF; |
|
77 |
import static org.graalvm.compiler.hotspot.HotSpotHostBackend.DEOPTIMIZATION_HANDLER; |
|
51126
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
78 |
import static org.graalvm.compiler.hotspot.HotSpotHostBackend.ENABLE_STACK_RESERVED_ZONE; |
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
79 |
import static org.graalvm.compiler.hotspot.HotSpotHostBackend.THROW_DELAYED_STACKOVERFLOW_ERROR; |
43972 | 80 |
import static org.graalvm.compiler.hotspot.HotSpotHostBackend.UNCOMMON_TRAP_HANDLER; |
81 |
import static org.graalvm.compiler.hotspot.replacements.AssertionSnippets.ASSERTION_VM_MESSAGE_C; |
|
55509 | 82 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotG1WriteBarrierSnippets.G1WBPOSTCALL; |
83 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotG1WriteBarrierSnippets.G1WBPRECALL; |
|
84 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotG1WriteBarrierSnippets.VALIDATE_OBJECT; |
|
43972 | 85 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION; |
86 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_END_LOCATION; |
|
87 |
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_TOP_LOCATION; |
|
55509 | 88 |
import static org.graalvm.compiler.hotspot.replacements.Log.LOG_OBJECT; |
89 |
import static org.graalvm.compiler.hotspot.replacements.Log.LOG_PRIMITIVE; |
|
90 |
import static org.graalvm.compiler.hotspot.replacements.Log.LOG_PRINTF; |
|
43972 | 91 |
import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITORENTER; |
92 |
import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITOREXIT; |
|
52578 | 93 |
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_INSTANCE; |
94 |
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_INSTANCE_OR_NULL; |
|
43972 | 95 |
import static org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub.EXCEPTION_HANDLER_FOR_PC; |
96 |
import static org.graalvm.compiler.hotspot.stubs.StubUtil.VM_MESSAGE_C; |
|
97 |
import static org.graalvm.compiler.hotspot.stubs.UnwindExceptionToCallerStub.EXCEPTION_HANDLER_FOR_RETURN_ADDRESS; |
|
98 |
import static org.graalvm.compiler.nodes.java.ForeignCallDescriptors.REGISTER_FINALIZER; |
|
99 |
import static org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation.POW; |
|
100 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.COS; |
|
101 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.EXP; |
|
102 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.LOG; |
|
103 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.LOG10; |
|
104 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN; |
|
105 |
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN; |
|
49873 | 106 |
import static jdk.internal.vm.compiler.word.LocationIdentity.any; |
43972 | 107 |
|
108 |
import java.util.EnumMap; |
|
109 |
||
49873 | 110 |
import jdk.internal.vm.compiler.collections.EconomicMap; |
43972 | 111 |
import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; |
112 |
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider; |
|
113 |
import org.graalvm.compiler.debug.GraalError; |
|
46344 | 114 |
import org.graalvm.compiler.hotspot.CompilerRuntimeHotSpotVMConfig; |
43972 | 115 |
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
116 |
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage; |
|
117 |
import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
|
118 |
import org.graalvm.compiler.hotspot.stubs.ArrayStoreExceptionStub; |
|
119 |
import org.graalvm.compiler.hotspot.stubs.ClassCastExceptionStub; |
|
120 |
import org.graalvm.compiler.hotspot.stubs.CreateExceptionStub; |
|
50330 | 121 |
import org.graalvm.compiler.hotspot.stubs.DivisionByZeroExceptionStub; |
43972 | 122 |
import org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub; |
51436 | 123 |
import org.graalvm.compiler.hotspot.stubs.IntegerExactOverflowExceptionStub; |
124 |
import org.graalvm.compiler.hotspot.stubs.LongExactOverflowExceptionStub; |
|
43972 | 125 |
import org.graalvm.compiler.hotspot.stubs.NullPointerExceptionStub; |
126 |
import org.graalvm.compiler.hotspot.stubs.OutOfBoundsExceptionStub; |
|
127 |
import org.graalvm.compiler.hotspot.stubs.Stub; |
|
128 |
import org.graalvm.compiler.hotspot.stubs.UnwindExceptionToCallerStub; |
|
129 |
import org.graalvm.compiler.hotspot.stubs.VerifyOopStub; |
|
130 |
import org.graalvm.compiler.nodes.NamedLocationIdentity; |
|
50330 | 131 |
import org.graalvm.compiler.nodes.extended.BytecodeExceptionNode.BytecodeExceptionKind; |
46344 | 132 |
import org.graalvm.compiler.options.OptionValues; |
52910 | 133 |
import org.graalvm.compiler.replacements.arraycopy.ArrayCopyForeignCalls; |
43972 | 134 |
import org.graalvm.compiler.word.Word; |
135 |
import org.graalvm.compiler.word.WordTypes; |
|
49873 | 136 |
import jdk.internal.vm.compiler.word.LocationIdentity; |
43972 | 137 |
|
138 |
import jdk.vm.ci.code.CodeCacheProvider; |
|
139 |
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
|
140 |
import jdk.vm.ci.meta.JavaKind; |
|
141 |
import jdk.vm.ci.meta.MetaAccessProvider; |
|
142 |
||
143 |
/** |
|
144 |
* HotSpot implementation of {@link ForeignCallsProvider}. |
|
145 |
*/ |
|
52910 | 146 |
public abstract class HotSpotHostForeignCallsProvider extends HotSpotForeignCallsProviderImpl implements ArrayCopyForeignCalls { |
43972 | 147 |
|
148 |
public static final ForeignCallDescriptor JAVA_TIME_MILLIS = new ForeignCallDescriptor("javaTimeMillis", long.class); |
|
149 |
public static final ForeignCallDescriptor JAVA_TIME_NANOS = new ForeignCallDescriptor("javaTimeNanos", long.class); |
|
150 |
||
49873 | 151 |
public static final ForeignCallDescriptor NOTIFY = new ForeignCallDescriptor("object_notify", boolean.class, Object.class); |
152 |
public static final ForeignCallDescriptor NOTIFY_ALL = new ForeignCallDescriptor("object_notifyAll", boolean.class, Object.class); |
|
153 |
||
50858 | 154 |
public HotSpotHostForeignCallsProvider(HotSpotJVMCIRuntime jvmciRuntime, HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache, |
43972 | 155 |
WordTypes wordTypes) { |
156 |
super(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes); |
|
157 |
} |
|
158 |
||
159 |
protected static void link(Stub stub) { |
|
160 |
stub.getLinkage().setCompiledStub(stub); |
|
161 |
} |
|
162 |
||
52910 | 163 |
@Override |
164 |
public ForeignCallDescriptor lookupCheckcastArraycopyDescriptor(boolean uninit) { |
|
43972 | 165 |
return checkcastArraycopyDescriptors[uninit ? 1 : 0]; |
166 |
} |
|
167 |
||
52910 | 168 |
@Override |
169 |
public ForeignCallDescriptor lookupArraycopyDescriptor(JavaKind kind, boolean aligned, boolean disjoint, boolean uninit, boolean killAny) { |
|
43972 | 170 |
if (uninit) { |
171 |
assert kind == JavaKind.Object; |
|
172 |
assert !killAny : "unsupported"; |
|
173 |
return uninitObjectArraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0]; |
|
174 |
} |
|
175 |
if (killAny) { |
|
54084 | 176 |
return arraycopyDescriptorsKillAny[aligned ? 1 : 0][disjoint ? 1 : 0].get(kind); |
43972 | 177 |
} |
178 |
return arraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0].get(kind); |
|
179 |
} |
|
180 |
||
54084 | 181 |
@SuppressWarnings("unchecked") private static final EnumMap<JavaKind, ForeignCallDescriptor>[][] arraycopyDescriptors = (EnumMap<JavaKind, ForeignCallDescriptor>[][]) new EnumMap<?, ?>[2][2]; |
182 |
@SuppressWarnings("unchecked") private static final EnumMap<JavaKind, ForeignCallDescriptor>[][] arraycopyDescriptorsKillAny = (EnumMap<JavaKind, ForeignCallDescriptor>[][]) new EnumMap<?, ?>[2][2]; |
|
43972 | 183 |
|
184 |
private static final ForeignCallDescriptor[][] uninitObjectArraycopyDescriptors = new ForeignCallDescriptor[2][2]; |
|
185 |
private static final ForeignCallDescriptor[] checkcastArraycopyDescriptors = new ForeignCallDescriptor[2]; |
|
186 |
||
187 |
static { |
|
188 |
// Populate the EnumMap instances |
|
189 |
for (int i = 0; i < arraycopyDescriptors.length; i++) { |
|
190 |
for (int j = 0; j < arraycopyDescriptors[i].length; j++) { |
|
191 |
arraycopyDescriptors[i][j] = new EnumMap<>(JavaKind.class); |
|
54084 | 192 |
arraycopyDescriptorsKillAny[i][j] = new EnumMap<>(JavaKind.class); |
43972 | 193 |
} |
194 |
} |
|
195 |
} |
|
196 |
||
46344 | 197 |
private void registerArraycopyDescriptor(EconomicMap<Long, ForeignCallDescriptor> descMap, JavaKind kind, boolean aligned, boolean disjoint, boolean uninit, boolean killAny, long routine) { |
43972 | 198 |
ForeignCallDescriptor desc = descMap.get(routine); |
199 |
if (desc == null) { |
|
200 |
desc = buildDescriptor(kind, aligned, disjoint, uninit, killAny, routine); |
|
201 |
descMap.put(routine, desc); |
|
202 |
} |
|
203 |
if (uninit) { |
|
204 |
assert kind == JavaKind.Object; |
|
205 |
uninitObjectArraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0] = desc; |
|
54084 | 206 |
} else if (killAny) { |
207 |
arraycopyDescriptorsKillAny[aligned ? 1 : 0][disjoint ? 1 : 0].put(kind, desc); |
|
43972 | 208 |
} else { |
209 |
arraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0].put(kind, desc); |
|
210 |
} |
|
211 |
} |
|
212 |
||
213 |
private ForeignCallDescriptor buildDescriptor(JavaKind kind, boolean aligned, boolean disjoint, boolean uninit, boolean killAny, long routine) { |
|
54084 | 214 |
assert !uninit || kind == JavaKind.Object; |
43972 | 215 |
String name = kind + (aligned ? "Aligned" : "") + (disjoint ? "Disjoint" : "") + (uninit ? "Uninit" : "") + "Arraycopy" + (killAny ? "KillAny" : ""); |
216 |
ForeignCallDescriptor desc = new ForeignCallDescriptor(name, void.class, Word.class, Word.class, Word.class); |
|
217 |
LocationIdentity killed = killAny ? LocationIdentity.any() : NamedLocationIdentity.getArrayLocation(kind); |
|
58299 | 218 |
registerForeignCall(desc, routine, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed); |
43972 | 219 |
return desc; |
220 |
} |
|
221 |
||
222 |
private void registerCheckcastArraycopyDescriptor(boolean uninit, long routine) { |
|
52910 | 223 |
String name = "Object" + (uninit ? "Uninit" : "") + "CheckcastArraycopy"; |
43972 | 224 |
// Input: |
225 |
// c_rarg0 - source array address |
|
226 |
// c_rarg1 - destination array address |
|
227 |
// c_rarg2 - element count, treated as ssize_t, can be zero |
|
228 |
// c_rarg3 - size_t ckoff (super_check_offset) |
|
229 |
// c_rarg4 - oop ckval (super_klass) |
|
230 |
// return: 0 = success, n = number of copied elements xor'd with -1. |
|
231 |
ForeignCallDescriptor desc = new ForeignCallDescriptor(name, int.class, Word.class, Word.class, Word.class, Word.class, Word.class); |
|
47798 | 232 |
LocationIdentity killed = NamedLocationIdentity.any(); |
58299 | 233 |
registerForeignCall(desc, routine, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, killed); |
43972 | 234 |
checkcastArraycopyDescriptors[uninit ? 1 : 0] = desc; |
235 |
} |
|
236 |
||
52578 | 237 |
private void registerArrayCopy(JavaKind kind, |
238 |
long routine, |
|
239 |
long alignedRoutine, |
|
240 |
long disjointRoutine, |
|
241 |
long alignedDisjointRoutine) { |
|
43972 | 242 |
registerArrayCopy(kind, routine, alignedRoutine, disjointRoutine, alignedDisjointRoutine, false); |
243 |
} |
|
244 |
||
52578 | 245 |
private void registerArrayCopy(JavaKind kind, |
246 |
long routine, |
|
247 |
long alignedRoutine, |
|
248 |
long disjointRoutine, |
|
249 |
long alignedDisjointRoutine, |
|
250 |
boolean uninit) { |
|
43972 | 251 |
/* |
252 |
* Sometimes the same function is used for multiple cases so share them when that's the case |
|
253 |
* but only within the same Kind. For instance short and char are the same copy routines but |
|
254 |
* they kill different memory so they still have to be distinct. |
|
255 |
*/ |
|
46344 | 256 |
EconomicMap<Long, ForeignCallDescriptor> descMap = EconomicMap.create(); |
43972 | 257 |
registerArraycopyDescriptor(descMap, kind, false, false, uninit, false, routine); |
258 |
registerArraycopyDescriptor(descMap, kind, true, false, uninit, false, alignedRoutine); |
|
259 |
registerArraycopyDescriptor(descMap, kind, false, true, uninit, false, disjointRoutine); |
|
260 |
registerArraycopyDescriptor(descMap, kind, true, true, uninit, false, alignedDisjointRoutine); |
|
261 |
||
54084 | 262 |
if (!uninit) { |
263 |
EconomicMap<Long, ForeignCallDescriptor> killAnyDescMap = EconomicMap.create(); |
|
264 |
registerArraycopyDescriptor(killAnyDescMap, kind, false, false, uninit, true, routine); |
|
265 |
registerArraycopyDescriptor(killAnyDescMap, kind, true, false, uninit, true, alignedRoutine); |
|
266 |
registerArraycopyDescriptor(killAnyDescMap, kind, false, true, uninit, true, disjointRoutine); |
|
267 |
registerArraycopyDescriptor(killAnyDescMap, kind, true, true, uninit, true, alignedDisjointRoutine); |
|
43972 | 268 |
} |
269 |
} |
|
270 |
||
46344 | 271 |
public void initialize(HotSpotProviders providers, OptionValues options) { |
43972 | 272 |
GraalHotSpotVMConfig c = runtime.getVMConfig(); |
58299 | 273 |
registerForeignCall(DEOPTIMIZATION_HANDLER, c.handleDeoptStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
274 |
registerForeignCall(UNCOMMON_TRAP_HANDLER, c.uncommonTrapStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
275 |
registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
43972 | 276 |
|
51126
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
277 |
if (c.enableStackReservedZoneAddress != 0) { |
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
278 |
assert c.throwDelayedStackOverflowErrorEntry != 0 : "both must exist"; |
58299 | 279 |
registerForeignCall(ENABLE_STACK_RESERVED_ZONE, c.enableStackReservedZoneAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
280 |
registerForeignCall(THROW_DELAYED_STACKOVERFLOW_ERROR, c.throwDelayedStackOverflowErrorEntry, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
51126
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
281 |
} |
a25c48c0a1ab
8181855: [Graal] runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
dlong
parents:
50858
diff
changeset
|
282 |
|
58299 | 283 |
registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
284 |
registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
54084 | 285 |
|
286 |
registerMathStubs(c, providers, options); |
|
287 |
||
58299 | 288 |
registerForeignCall(ARITHMETIC_FREM, c.fremAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
289 |
registerForeignCall(ARITHMETIC_DREM, c.dremAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
43972 | 290 |
|
58299 | 291 |
registerForeignCall(LOAD_AND_CLEAR_EXCEPTION, c.loadAndClearExceptionAddress, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, any()); |
43972 | 292 |
|
58299 | 293 |
registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any()); |
294 |
registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, SAFEPOINT, REEXECUTABLE, any()); |
|
43972 | 295 |
|
296 |
CreateExceptionStub.registerForeignCalls(c, this); |
|
297 |
||
298 |
/* |
|
299 |
* This message call is registered twice, where the second one must only be used for calls |
|
300 |
* that do not return, i.e., that exit the VM. |
|
301 |
*/ |
|
58299 | 302 |
registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS); |
303 |
registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
43972 | 304 |
|
51736 | 305 |
linkForeignCall(options, providers, NEW_INSTANCE, c.newInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
306 |
linkForeignCall(options, providers, NEW_ARRAY, c.newArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
|
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
307 |
linkForeignCall(options, providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
52578 | 308 |
linkForeignCall(options, providers, DYNAMIC_NEW_INSTANCE, c.dynamicNewInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE); |
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
309 |
|
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
310 |
if (c.areNullAllocationStubsAvailable()) { |
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
311 |
linkForeignCall(options, providers, NEW_INSTANCE_OR_NULL, c.newInstanceOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
312 |
linkForeignCall(options, providers, NEW_ARRAY_OR_NULL, c.newArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
313 |
linkForeignCall(options, providers, NEW_MULTI_ARRAY_OR_NULL, c.newMultiArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
52578 | 314 |
linkForeignCall(options, providers, DYNAMIC_NEW_INSTANCE_OR_NULL, c.dynamicNewInstanceOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE); |
52033
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
315 |
} |
d6aa9ea2405d
8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents:
51736
diff
changeset
|
316 |
|
46344 | 317 |
link(new ExceptionHandlerStub(options, providers, foreignCalls.get(EXCEPTION_HANDLER))); |
58299 | 318 |
link(new UnwindExceptionToCallerStub(options, providers, |
319 |
registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
320 |
link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NO_VZERO, REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, NO_LOCATIONS))); |
|
50330 | 321 |
|
322 |
EnumMap<BytecodeExceptionKind, ForeignCallDescriptor> exceptionRuntimeCalls = DefaultHotSpotLoweringProvider.RuntimeCalls.runtimeCalls; |
|
58299 | 323 |
link(new ArrayStoreExceptionStub(options, providers, |
324 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.ARRAY_STORE), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
325 |
link(new ClassCastExceptionStub(options, providers, |
|
326 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.CLASS_CAST), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
327 |
link(new NullPointerExceptionStub(options, providers, |
|
328 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.NULL_POINTER), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
329 |
link(new OutOfBoundsExceptionStub(options, providers, |
|
330 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.OUT_OF_BOUNDS), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
331 |
link(new DivisionByZeroExceptionStub(options, providers, |
|
332 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.DIVISION_BY_ZERO), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
333 |
link(new IntegerExactOverflowExceptionStub(options, providers, |
|
334 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.INTEGER_EXACT_OVERFLOW), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
335 |
link(new LongExactOverflowExceptionStub(options, providers, |
|
336 |
registerStubCall(exceptionRuntimeCalls.get(BytecodeExceptionKind.LONG_EXACT_OVERFLOW), SAFEPOINT, NOT_REEXECUTABLE, DESTROYS_ALL_CALLER_SAVE_REGISTERS, any()))); |
|
43972 | 337 |
|
58040
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
338 |
linkForeignCall(options, providers, IDENTITY_HASHCODE, c.identityHashCodeAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, MARK_WORD_LOCATION); |
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
339 |
linkForeignCall(options, providers, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any()); |
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
340 |
linkForeignCall(options, providers, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any()); |
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
341 |
linkForeignCall(options, providers, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, STACK_INSPECTABLE_LEAF, NOT_REEXECUTABLE, any()); |
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
342 |
linkForeignCall(options, providers, NOTIFY, c.notifyAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any()); |
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
343 |
linkForeignCall(options, providers, NOTIFY_ALL, c.notifyAllAddress, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any()); |
46344 | 344 |
linkForeignCall(options, providers, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
345 |
linkForeignCall(options, providers, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
346 |
linkForeignCall(options, providers, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
54601 | 347 |
linkForeignCall(options, providers, VM_ERROR, c.vmErrorAddress, PREPEND_THREAD, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
58040
d99af76d7689
8226953: AOT: assert(oopDesc::is_oop(obj)) failed: not an oop
iveresov
parents:
55509
diff
changeset
|
348 |
linkForeignCall(options, providers, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, LEAF_NO_VZERO, NOT_REEXECUTABLE, NO_LOCATIONS); |
54601 | 349 |
linkForeignCall(options, providers, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
350 |
linkForeignCall(options, providers, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
351 |
linkForeignCall(options, providers, VALIDATE_OBJECT, c.validateObject, PREPEND_THREAD, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
|
43972 | 352 |
|
46344 | 353 |
if (GeneratePIC.getValue(options)) { |
58299 | 354 |
registerForeignCall(WRONG_METHOD_HANDLER, c.handleWrongMethodStub, NativeCall, LEAF_NO_VZERO, REEXECUTABLE, NO_LOCATIONS); |
43972 | 355 |
CompilerRuntimeHotSpotVMConfig cr = new CompilerRuntimeHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore()); |
46344 | 356 |
linkForeignCall(options, providers, RESOLVE_STRING_BY_SYMBOL, cr.resolveStringBySymbol, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION); |
47667 | 357 |
linkForeignCall(options, providers, RESOLVE_DYNAMIC_INVOKE, cr.resolveDynamicInvoke, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, any()); |
46344 | 358 |
linkForeignCall(options, providers, RESOLVE_KLASS_BY_SYMBOL, cr.resolveKlassBySymbol, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, any()); |
359 |
linkForeignCall(options, providers, RESOLVE_METHOD_BY_SYMBOL_AND_LOAD_COUNTERS, cr.resolveMethodBySymbolAndLoadCounters, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS); |
|
51436 | 360 |
linkForeignCall(options, providers, INITIALIZE_KLASS_BY_SYMBOL, cr.initializeKlassBySymbol, PREPEND_THREAD, SAFEPOINT, NOT_REEXECUTABLE, any()); |
46344 | 361 |
linkForeignCall(options, providers, INVOCATION_EVENT, cr.invocationEvent, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS); |
362 |
linkForeignCall(options, providers, BACKEDGE_EVENT, cr.backedgeEvent, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS); |
|
43972 | 363 |
} |
364 |
||
46344 | 365 |
linkForeignCall(options, providers, TEST_DEOPTIMIZE_CALL_INT, c.testDeoptimizeCallInt, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, any()); |
43972 | 366 |
|
367 |
registerArrayCopy(JavaKind.Byte, c.jbyteArraycopy, c.jbyteAlignedArraycopy, c.jbyteDisjointArraycopy, c.jbyteAlignedDisjointArraycopy); |
|
368 |
registerArrayCopy(JavaKind.Boolean, c.jbyteArraycopy, c.jbyteAlignedArraycopy, c.jbyteDisjointArraycopy, c.jbyteAlignedDisjointArraycopy); |
|
369 |
registerArrayCopy(JavaKind.Char, c.jshortArraycopy, c.jshortAlignedArraycopy, c.jshortDisjointArraycopy, c.jshortAlignedDisjointArraycopy); |
|
370 |
registerArrayCopy(JavaKind.Short, c.jshortArraycopy, c.jshortAlignedArraycopy, c.jshortDisjointArraycopy, c.jshortAlignedDisjointArraycopy); |
|
371 |
registerArrayCopy(JavaKind.Int, c.jintArraycopy, c.jintAlignedArraycopy, c.jintDisjointArraycopy, c.jintAlignedDisjointArraycopy); |
|
372 |
registerArrayCopy(JavaKind.Float, c.jintArraycopy, c.jintAlignedArraycopy, c.jintDisjointArraycopy, c.jintAlignedDisjointArraycopy); |
|
373 |
registerArrayCopy(JavaKind.Long, c.jlongArraycopy, c.jlongAlignedArraycopy, c.jlongDisjointArraycopy, c.jlongAlignedDisjointArraycopy); |
|
374 |
registerArrayCopy(JavaKind.Double, c.jlongArraycopy, c.jlongAlignedArraycopy, c.jlongDisjointArraycopy, c.jlongAlignedDisjointArraycopy); |
|
375 |
registerArrayCopy(JavaKind.Object, c.oopArraycopy, c.oopAlignedArraycopy, c.oopDisjointArraycopy, c.oopAlignedDisjointArraycopy); |
|
376 |
registerArrayCopy(JavaKind.Object, c.oopArraycopyUninit, c.oopAlignedArraycopyUninit, c.oopDisjointArraycopyUninit, c.oopAlignedDisjointArraycopyUninit, true); |
|
377 |
||
378 |
registerCheckcastArraycopyDescriptor(true, c.checkcastArraycopyUninit); |
|
379 |
registerCheckcastArraycopyDescriptor(false, c.checkcastArraycopy); |
|
380 |
||
58299 | 381 |
registerForeignCall(GENERIC_ARRAYCOPY, c.genericArraycopy, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
382 |
registerForeignCall(UNSAFE_ARRAYCOPY, c.unsafeArraycopy, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
|
47084 | 383 |
|
43972 | 384 |
if (c.useMultiplyToLenIntrinsic()) { |
58299 | 385 |
registerForeignCall(MULTIPLY_TO_LEN, c.multiplyToLen, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, |
51436 | 386 |
NamedLocationIdentity.getArrayLocation(JavaKind.Int)); |
43972 | 387 |
} |
54084 | 388 |
|
43972 | 389 |
if (c.useSHA1Intrinsics()) { |
58299 | 390 |
registerForeignCall(SHA_IMPL_COMPRESS, c.sha1ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
391 |
registerForeignCall(SHA_IMPL_COMPRESS_MB, c.sha1ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
|
43972 | 392 |
} |
393 |
if (c.useSHA256Intrinsics()) { |
|
58299 | 394 |
registerForeignCall(SHA2_IMPL_COMPRESS, c.sha256ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
395 |
registerForeignCall(SHA2_IMPL_COMPRESS_MB, c.sha256ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
|
43972 | 396 |
} |
397 |
if (c.useSHA512Intrinsics()) { |
|
58299 | 398 |
registerForeignCall(SHA5_IMPL_COMPRESS, c.sha512ImplCompress, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
399 |
registerForeignCall(SHA5_IMPL_COMPRESS_MB, c.sha512ImplCompressMultiBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
|
54084 | 400 |
} |
401 |
if (c.useGHASHIntrinsics()) { |
|
58299 | 402 |
registerForeignCall(GHASH_PROCESS_BLOCKS, c.ghashProcessBlocks, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
43972 | 403 |
} |
54601 | 404 |
if (c.useBase64Intrinsics()) { |
58299 | 405 |
registerForeignCall(BASE64_ENCODE_BLOCK, c.base64EncodeBlock, NativeCall, LEAF, NOT_REEXECUTABLE, NamedLocationIdentity.any()); |
54601 | 406 |
} |
43972 | 407 |
if (c.useMulAddIntrinsic()) { |
58299 | 408 |
registerForeignCall(MUL_ADD, c.mulAdd, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int)); |
43972 | 409 |
} |
410 |
if (c.useMontgomeryMultiplyIntrinsic()) { |
|
58299 | 411 |
registerForeignCall(MONTGOMERY_MULTIPLY, c.montgomeryMultiply, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, |
51436 | 412 |
NamedLocationIdentity.getArrayLocation(JavaKind.Int)); |
43972 | 413 |
} |
414 |
if (c.useMontgomerySquareIntrinsic()) { |
|
58299 | 415 |
registerForeignCall(MONTGOMERY_SQUARE, c.montgomerySquare, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, |
51436 | 416 |
NamedLocationIdentity.getArrayLocation(JavaKind.Int)); |
43972 | 417 |
} |
418 |
if (c.useSquareToLenIntrinsic()) { |
|
58299 | 419 |
registerForeignCall(SQUARE_TO_LEN, c.squareToLen, NativeCall, LEAF_NO_VZERO, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int)); |
43972 | 420 |
} |
421 |
||
422 |
if (c.useAESIntrinsics) { |
|
423 |
/* |
|
424 |
* When the java.ext.dirs property is modified then the crypto classes might not be |
|
425 |
* found. If that's the case we ignore the ClassNotFoundException and continue since we |
|
426 |
* cannot replace a non-existing method anyway. |
|
427 |
*/ |
|
428 |
try { |
|
429 |
// These stubs do callee saving |
|
58299 | 430 |
registerForeignCall(ENCRYPT_BLOCK, c.aescryptEncryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
51436 | 431 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
58299 | 432 |
registerForeignCall(DECRYPT_BLOCK, c.aescryptDecryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
51436 | 433 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
58299 | 434 |
registerForeignCall(DECRYPT_BLOCK_WITH_ORIGINAL_KEY, c.aescryptDecryptBlockStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
43972 | 435 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
436 |
} catch (GraalError e) { |
|
437 |
if (!(e.getCause() instanceof ClassNotFoundException)) { |
|
438 |
throw e; |
|
439 |
} |
|
440 |
} |
|
441 |
try { |
|
442 |
// These stubs do callee saving |
|
58299 | 443 |
registerForeignCall(ENCRYPT, c.cipherBlockChainingEncryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
43972 | 444 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
58299 | 445 |
registerForeignCall(DECRYPT, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
43972 | 446 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
58299 | 447 |
registerForeignCall(DECRYPT_WITH_ORIGINAL_KEY, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, LEAF, NOT_REEXECUTABLE, |
43972 | 448 |
NamedLocationIdentity.getArrayLocation(JavaKind.Byte)); |
449 |
} catch (GraalError e) { |
|
450 |
if (!(e.getCause() instanceof ClassNotFoundException)) { |
|
451 |
throw e; |
|
452 |
} |
|
453 |
} |
|
454 |
} |
|
54084 | 455 |
|
456 |
if (c.useAESCTRIntrinsics) { |
|
457 |
assert (c.counterModeAESCrypt != 0L); |
|
58299 | 458 |
registerForeignCall(COUNTERMODE_IMPL_CRYPT, c.counterModeAESCrypt, NativeCall, LEAF, NOT_REEXECUTABLE, |
54084 | 459 |
NamedLocationIdentity.any()); |
460 |
} |
|
461 |
||
462 |
if (c.useVectorizedMismatchIntrinsic) { |
|
463 |
assert (c.vectorizedMismatch != 0L); |
|
58299 | 464 |
registerForeignCall(VECTORIZED_MISMATCHED, c.vectorizedMismatch, NativeCall, LEAF, NOT_REEXECUTABLE, |
54084 | 465 |
NamedLocationIdentity.any()); |
466 |
||
467 |
} |
|
43972 | 468 |
} |
469 |
||
470 |
public HotSpotForeignCallLinkage getForeignCall(ForeignCallDescriptor descriptor) { |
|
471 |
assert foreignCalls != null : descriptor; |
|
472 |
return foreignCalls.get(descriptor); |
|
473 |
} |
|
54084 | 474 |
|
475 |
@SuppressWarnings("unused") |
|
476 |
protected void registerMathStubs(GraalHotSpotVMConfig hotSpotVMConfig, HotSpotProviders providers, OptionValues options) { |
|
58299 | 477 |
registerForeignCall(SIN.foreignCallDescriptor, hotSpotVMConfig.arithmeticSinAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
478 |
registerForeignCall(COS.foreignCallDescriptor, hotSpotVMConfig.arithmeticCosAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
479 |
registerForeignCall(TAN.foreignCallDescriptor, hotSpotVMConfig.arithmeticTanAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
480 |
registerForeignCall(EXP.foreignCallDescriptor, hotSpotVMConfig.arithmeticExpAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
481 |
registerForeignCall(LOG.foreignCallDescriptor, hotSpotVMConfig.arithmeticLogAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
482 |
registerForeignCall(LOG10.foreignCallDescriptor, hotSpotVMConfig.arithmeticLog10Address, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
483 |
registerForeignCall(POW.foreignCallDescriptor, hotSpotVMConfig.arithmeticPowAddress, NativeCall, LEAF, REEXECUTABLE, NO_LOCATIONS); |
|
54084 | 484 |
} |
43972 | 485 |
} |