28 import static org.graalvm.compiler.hotspot.HotSpotBackend.BASE64_ENCODE_BLOCK; |
28 import static org.graalvm.compiler.hotspot.HotSpotBackend.BASE64_ENCODE_BLOCK; |
29 import static org.graalvm.compiler.hotspot.HotSpotBackend.GHASH_PROCESS_BLOCKS; |
29 import static org.graalvm.compiler.hotspot.HotSpotBackend.GHASH_PROCESS_BLOCKS; |
30 import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT; |
30 import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT; |
31 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION; |
31 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION; |
32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing; |
32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing; |
33 import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.Java8OrEarlier; |
|
34 |
33 |
35 import java.lang.invoke.ConstantCallSite; |
34 import java.lang.invoke.ConstantCallSite; |
36 import java.lang.invoke.MutableCallSite; |
35 import java.lang.invoke.MutableCallSite; |
37 import java.lang.invoke.VolatileCallSite; |
36 import java.lang.invoke.VolatileCallSite; |
38 import java.lang.reflect.Array; |
37 import java.lang.reflect.Array; |
43 import org.graalvm.compiler.bytecode.BytecodeProvider; |
42 import org.graalvm.compiler.bytecode.BytecodeProvider; |
44 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider; |
43 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider; |
45 import org.graalvm.compiler.core.common.type.ObjectStamp; |
44 import org.graalvm.compiler.core.common.type.ObjectStamp; |
46 import org.graalvm.compiler.core.common.type.StampFactory; |
45 import org.graalvm.compiler.core.common.type.StampFactory; |
47 import org.graalvm.compiler.core.common.type.TypeReference; |
46 import org.graalvm.compiler.core.common.type.TypeReference; |
|
47 import org.graalvm.compiler.debug.GraalError; |
48 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
48 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
|
49 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
49 import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode; |
50 import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode; |
50 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions; |
51 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions; |
51 import org.graalvm.compiler.hotspot.replacements.ArraysSupportSubstitutions; |
52 import org.graalvm.compiler.hotspot.replacements.ArraysSupportSubstitutions; |
52 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions; |
53 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions; |
53 import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions; |
54 import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions; |
99 import org.graalvm.compiler.replacements.NodeIntrinsificationProvider; |
100 import org.graalvm.compiler.replacements.NodeIntrinsificationProvider; |
100 import org.graalvm.compiler.replacements.ReplacementsImpl; |
101 import org.graalvm.compiler.replacements.ReplacementsImpl; |
101 import org.graalvm.compiler.replacements.StandardGraphBuilderPlugins; |
102 import org.graalvm.compiler.replacements.StandardGraphBuilderPlugins; |
102 import org.graalvm.compiler.replacements.arraycopy.ArrayCopyNode; |
103 import org.graalvm.compiler.replacements.arraycopy.ArrayCopyNode; |
103 import org.graalvm.compiler.serviceprovider.GraalServices; |
104 import org.graalvm.compiler.serviceprovider.GraalServices; |
|
105 import org.graalvm.compiler.serviceprovider.JavaVersionUtil; |
104 import org.graalvm.compiler.word.WordOperationPlugin; |
106 import org.graalvm.compiler.word.WordOperationPlugin; |
105 import org.graalvm.compiler.word.WordTypes; |
107 import org.graalvm.compiler.word.WordTypes; |
106 import jdk.internal.vm.compiler.word.LocationIdentity; |
108 import jdk.internal.vm.compiler.word.LocationIdentity; |
107 |
109 |
108 import jdk.vm.ci.code.CodeUtil; |
110 import jdk.vm.ci.code.CodeUtil; |
|
111 import jdk.vm.ci.hotspot.VMIntrinsicMethod; |
109 import jdk.vm.ci.meta.ConstantReflectionProvider; |
112 import jdk.vm.ci.meta.ConstantReflectionProvider; |
110 import jdk.vm.ci.meta.DeoptimizationAction; |
113 import jdk.vm.ci.meta.DeoptimizationAction; |
111 import jdk.vm.ci.meta.JavaKind; |
114 import jdk.vm.ci.meta.JavaKind; |
112 import jdk.vm.ci.meta.MetaAccessProvider; |
115 import jdk.vm.ci.meta.MetaAccessProvider; |
113 import jdk.vm.ci.meta.ResolvedJavaMethod; |
116 import jdk.vm.ci.meta.ResolvedJavaMethod; |
124 * @param constantReflection |
127 * @param constantReflection |
125 * @param snippetReflection |
128 * @param snippetReflection |
126 * @param foreignCalls |
129 * @param foreignCalls |
127 * @param options |
130 * @param options |
128 */ |
131 */ |
129 public static Plugins create(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess, |
132 public static Plugins create(HotSpotGraalRuntimeProvider graalRuntime, |
130 ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, ReplacementsImpl replacements, |
133 CompilerConfiguration compilerConfiguration, |
|
134 GraalHotSpotVMConfig config, |
|
135 HotSpotWordTypes wordTypes, |
|
136 MetaAccessProvider metaAccess, |
|
137 ConstantReflectionProvider constantReflection, |
|
138 SnippetReflectionProvider snippetReflection, |
|
139 ForeignCallsProvider foreignCalls, |
|
140 ReplacementsImpl replacements, |
131 OptionValues options) { |
141 OptionValues options) { |
132 InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, compilerConfiguration); |
142 InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(graalRuntime, config, compilerConfiguration); |
133 |
143 |
134 Plugins plugins = new Plugins(invocationPlugins); |
144 Plugins plugins = new Plugins(invocationPlugins); |
135 NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes); |
145 NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes); |
136 HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes); |
146 HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes); |
137 HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin, config, wordTypes); |
147 HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin, config, wordTypes); |
173 registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider); |
187 registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider); |
174 registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider); |
188 registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider); |
175 registerGHASHPlugins(invocationPlugins, config, metaAccess, foreignCalls); |
189 registerGHASHPlugins(invocationPlugins, config, metaAccess, foreignCalls); |
176 registerCounterModePlugins(invocationPlugins, config, replacementBytecodeProvider); |
190 registerCounterModePlugins(invocationPlugins, config, replacementBytecodeProvider); |
177 registerBase64Plugins(invocationPlugins, config, metaAccess, foreignCalls); |
191 registerBase64Plugins(invocationPlugins, config, metaAccess, foreignCalls); |
178 registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider); |
192 registerUnsafePlugins(invocationPlugins, config, replacementBytecodeProvider); |
179 StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true, false); |
193 StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true, false); |
180 registerArrayPlugins(invocationPlugins, replacementBytecodeProvider); |
194 registerArrayPlugins(invocationPlugins, replacementBytecodeProvider); |
181 registerStringPlugins(invocationPlugins, replacementBytecodeProvider); |
195 registerStringPlugins(invocationPlugins, replacementBytecodeProvider); |
182 registerArraysSupportPlugins(invocationPlugins, config, replacementBytecodeProvider); |
196 registerArraysSupportPlugins(invocationPlugins, config, replacementBytecodeProvider); |
183 |
197 |
238 private static void registerCallSitePlugins(InvocationPlugins plugins) { |
252 private static void registerCallSitePlugins(InvocationPlugins plugins) { |
239 InvocationPlugin plugin = new InvocationPlugin() { |
253 InvocationPlugin plugin = new InvocationPlugin() { |
240 @Override |
254 @Override |
241 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) { |
255 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) { |
242 ValueNode callSite = receiver.get(); |
256 ValueNode callSite = receiver.get(); |
243 ValueNode folded = CallSiteTargetNode.tryFold(GraphUtil.originalValue(callSite), b.getMetaAccess(), b.getAssumptions()); |
257 ValueNode folded = CallSiteTargetNode.tryFold(GraphUtil.originalValue(callSite, true), b.getMetaAccess(), b.getAssumptions()); |
244 if (folded != null) { |
258 if (folded != null) { |
245 b.addPush(JavaKind.Object, folded); |
259 b.addPush(JavaKind.Object, folded); |
246 } else { |
260 } else { |
247 b.addPush(JavaKind.Object, new CallSiteTargetNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), callSite)); |
261 b.addPush(JavaKind.Object, new CallSiteTargetNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), callSite)); |
248 } |
262 } |
274 } |
288 } |
275 }); |
289 }); |
276 r.registerMethodSubstitution(ReflectionSubstitutions.class, "getClassAccessFlags", Class.class); |
290 r.registerMethodSubstitution(ReflectionSubstitutions.class, "getClassAccessFlags", Class.class); |
277 } |
291 } |
278 |
292 |
279 private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementBytecodeProvider) { |
293 private static void registerUnsafePlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider replacementBytecodeProvider) { |
280 Registration r; |
294 Registration r; |
281 if (Java8OrEarlier) { |
295 if (JavaVersionUtil.JAVA_SPEC <= 8) { |
282 r = new Registration(plugins, Unsafe.class, replacementBytecodeProvider); |
296 r = new Registration(plugins, Unsafe.class, replacementBytecodeProvider); |
283 } else { |
297 } else { |
284 r = new Registration(plugins, "jdk.internal.misc.Unsafe", replacementBytecodeProvider); |
298 r = new Registration(plugins, "jdk.internal.misc.Unsafe", replacementBytecodeProvider); |
285 } |
299 } |
286 r.registerMethodSubstitution(HotSpotUnsafeSubstitutions.class, HotSpotUnsafeSubstitutions.copyMemoryName, "copyMemory", Receiver.class, Object.class, long.class, Object.class, long.class, |
300 String substituteMethodName = config.doingUnsafeAccessOffset != Integer.MAX_VALUE ? "copyMemoryGuarded" : "copyMemory"; |
287 long.class); |
301 r.registerMethodSubstitution(HotSpotUnsafeSubstitutions.class, HotSpotUnsafeSubstitutions.copyMemoryName, substituteMethodName, Receiver.class, Object.class, long.class, Object.class, |
|
302 long.class, long.class); |
288 } |
303 } |
289 |
304 |
290 private static final LocationIdentity INSTANCE_KLASS_CONSTANTS = NamedLocationIdentity.immutable("InstanceKlass::_constants"); |
305 private static final LocationIdentity INSTANCE_KLASS_CONSTANTS = NamedLocationIdentity.immutable("InstanceKlass::_constants"); |
291 private static final LocationIdentity CONSTANT_POOL_LENGTH = NamedLocationIdentity.immutable("ConstantPool::_length"); |
306 private static final LocationIdentity CONSTANT_POOL_LENGTH = NamedLocationIdentity.immutable("ConstantPool::_length"); |
292 |
307 |
401 r.setAllowOverwrite(true); |
416 r.setAllowOverwrite(true); |
402 r.registerMethodSubstitution(HotSpotArraySubstitutions.class, "newInstance", Class.class, int.class); |
417 r.registerMethodSubstitution(HotSpotArraySubstitutions.class, "newInstance", Class.class, int.class); |
403 } |
418 } |
404 |
419 |
405 private static void registerStringPlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) { |
420 private static void registerStringPlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) { |
406 if (!Java8OrEarlier) { |
421 if (JavaVersionUtil.JAVA_SPEC > 8) { |
407 final Registration utf16r = new Registration(plugins, "java.lang.StringUTF16", bytecodeProvider); |
422 final Registration utf16r = new Registration(plugins, "java.lang.StringUTF16", bytecodeProvider); |
408 utf16r.registerMethodSubstitution(StringUTF16Substitutions.class, "toBytes", char[].class, int.class, int.class); |
423 utf16r.registerMethodSubstitution(StringUTF16Substitutions.class, "toBytes", char[].class, int.class, int.class); |
409 utf16r.registerMethodSubstitution(StringUTF16Substitutions.class, "getChars", byte[].class, int.class, int.class, char[].class, int.class); |
424 utf16r.registerMethodSubstitution(StringUTF16Substitutions.class, "getChars", byte[].class, int.class, int.class, char[].class, int.class); |
410 } |
425 } |
411 } |
426 } |
426 }); |
441 }); |
427 |
442 |
428 r.registerMethodSubstitution(ThreadSubstitutions.class, "isInterrupted", Receiver.class, boolean.class); |
443 r.registerMethodSubstitution(ThreadSubstitutions.class, "isInterrupted", Receiver.class, boolean.class); |
429 } |
444 } |
430 |
445 |
431 public static final String cbcEncryptName; |
|
432 public static final String cbcDecryptName; |
|
433 public static final String aesEncryptName; |
446 public static final String aesEncryptName; |
434 public static final String aesDecryptName; |
447 public static final String aesDecryptName; |
435 |
448 |
436 public static final String reflectionClass; |
449 public static final String reflectionClass; |
437 public static final String constantPoolClass; |
450 public static final String constantPoolClass; |
438 |
451 |
439 static { |
452 static { |
440 if (Java8OrEarlier) { |
453 if (JavaVersionUtil.JAVA_SPEC <= 8) { |
441 cbcEncryptName = "encrypt"; |
|
442 cbcDecryptName = "decrypt"; |
|
443 aesEncryptName = "encryptBlock"; |
454 aesEncryptName = "encryptBlock"; |
444 aesDecryptName = "decryptBlock"; |
455 aesDecryptName = "decryptBlock"; |
445 reflectionClass = "sun.reflect.Reflection"; |
456 reflectionClass = "sun.reflect.Reflection"; |
446 constantPoolClass = "sun.reflect.ConstantPool"; |
457 constantPoolClass = "sun.reflect.ConstantPool"; |
447 } else { |
458 } else { |
448 cbcEncryptName = "implEncrypt"; |
|
449 cbcDecryptName = "implDecrypt"; |
|
450 aesEncryptName = "implEncryptBlock"; |
459 aesEncryptName = "implEncryptBlock"; |
451 aesDecryptName = "implDecryptBlock"; |
460 aesDecryptName = "implDecryptBlock"; |
452 reflectionClass = "jdk.internal.reflect.Reflection"; |
461 reflectionClass = "jdk.internal.reflect.Reflection"; |
453 constantPoolClass = "jdk.internal.reflect.ConstantPool"; |
462 constantPoolClass = "jdk.internal.reflect.ConstantPool"; |
454 } |
463 } |
|
464 } |
|
465 |
|
466 public static boolean cbcUsesImplNames(GraalHotSpotVMConfig config) { |
|
467 for (VMIntrinsicMethod intrinsic : config.getStore().getIntrinsics()) { |
|
468 if ("com/sun/crypto/provider/CipherBlockChaining".equals(intrinsic.declaringClass)) { |
|
469 if ("encrypt".equals(intrinsic.name)) { |
|
470 return false; |
|
471 } else if ("implEncrypt".equals(intrinsic.name)) { |
|
472 return true; |
|
473 } |
|
474 } |
|
475 } |
|
476 throw GraalError.shouldNotReachHere(); |
455 } |
477 } |
456 |
478 |
457 private static void registerAESPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
479 private static void registerAESPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
458 if (config.useAESIntrinsics) { |
480 if (config.useAESIntrinsics) { |
459 assert config.aescryptEncryptBlockStub != 0L; |
481 assert config.aescryptEncryptBlockStub != 0L; |
461 assert config.cipherBlockChainingEncryptAESCryptStub != 0L; |
483 assert config.cipherBlockChainingEncryptAESCryptStub != 0L; |
462 assert config.cipherBlockChainingDecryptAESCryptStub != 0L; |
484 assert config.cipherBlockChainingDecryptAESCryptStub != 0L; |
463 String arch = config.osArch; |
485 String arch = config.osArch; |
464 String decryptSuffix = arch.equals("sparc") ? "WithOriginalKey" : ""; |
486 String decryptSuffix = arch.equals("sparc") ? "WithOriginalKey" : ""; |
465 Registration r = new Registration(plugins, "com.sun.crypto.provider.CipherBlockChaining", bytecodeProvider); |
487 Registration r = new Registration(plugins, "com.sun.crypto.provider.CipherBlockChaining", bytecodeProvider); |
|
488 |
|
489 boolean implNames = cbcUsesImplNames(config); |
|
490 String cbcEncryptName = implNames ? "implEncrypt" : "encrypt"; |
|
491 String cbcDecryptName = implNames ? "implDecrypt" : "decrypt"; |
|
492 |
466 r.registerMethodSubstitution(CipherBlockChainingSubstitutions.class, cbcEncryptName, Receiver.class, byte[].class, int.class, int.class, byte[].class, int.class); |
493 r.registerMethodSubstitution(CipherBlockChainingSubstitutions.class, cbcEncryptName, Receiver.class, byte[].class, int.class, int.class, byte[].class, int.class); |
467 r.registerMethodSubstitution(CipherBlockChainingSubstitutions.class, cbcDecryptName, cbcDecryptName + decryptSuffix, Receiver.class, byte[].class, int.class, int.class, byte[].class, |
494 r.registerMethodSubstitution(CipherBlockChainingSubstitutions.class, cbcDecryptName, cbcDecryptName + decryptSuffix, Receiver.class, byte[].class, int.class, int.class, byte[].class, |
468 int.class); |
495 int.class); |
|
496 |
469 r = new Registration(plugins, "com.sun.crypto.provider.AESCrypt", bytecodeProvider); |
497 r = new Registration(plugins, "com.sun.crypto.provider.AESCrypt", bytecodeProvider); |
470 r.registerMethodSubstitution(AESCryptSubstitutions.class, aesEncryptName, Receiver.class, byte[].class, int.class, byte[].class, int.class); |
498 r.registerMethodSubstitution(AESCryptSubstitutions.class, aesEncryptName, Receiver.class, byte[].class, int.class, byte[].class, int.class); |
471 r.registerMethodSubstitution(AESCryptSubstitutions.class, aesDecryptName, aesDecryptName + decryptSuffix, Receiver.class, byte[].class, int.class, byte[].class, int.class); |
499 r.registerMethodSubstitution(AESCryptSubstitutions.class, aesDecryptName, aesDecryptName + decryptSuffix, Receiver.class, byte[].class, int.class, byte[].class, int.class); |
472 } |
500 } |
473 } |
501 } |
474 |
502 |
475 private static void registerBigIntegerPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
503 private static void registerBigIntegerPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
476 Registration r = new Registration(plugins, BigInteger.class, bytecodeProvider); |
504 Registration r = new Registration(plugins, BigInteger.class, bytecodeProvider); |
477 if (config.useMultiplyToLenIntrinsic()) { |
505 if (config.useMultiplyToLenIntrinsic()) { |
478 assert config.multiplyToLen != 0L; |
506 assert config.multiplyToLen != 0L; |
479 if (Java8OrEarlier) { |
507 if (JavaVersionUtil.JAVA_SPEC <= 8) { |
480 r.registerMethodSubstitution(BigIntegerSubstitutions.class, "multiplyToLen", "multiplyToLenStatic", int[].class, int.class, int[].class, int.class, |
508 r.registerMethodSubstitution(BigIntegerSubstitutions.class, "multiplyToLen", "multiplyToLenStatic", int[].class, int.class, int[].class, int.class, |
481 int[].class); |
509 int[].class); |
482 } else { |
510 } else { |
483 r.registerMethodSubstitution(BigIntegerSubstitutions.class, "implMultiplyToLen", "multiplyToLenStatic", int[].class, int.class, int[].class, int.class, |
511 r.registerMethodSubstitution(BigIntegerSubstitutions.class, "implMultiplyToLen", "multiplyToLenStatic", int[].class, int.class, int[].class, int.class, |
484 int[].class); |
512 int[].class); |
501 private static void registerSHAPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
529 private static void registerSHAPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
502 boolean useSha1 = config.useSHA1Intrinsics(); |
530 boolean useSha1 = config.useSHA1Intrinsics(); |
503 boolean useSha256 = config.useSHA256Intrinsics(); |
531 boolean useSha256 = config.useSHA256Intrinsics(); |
504 boolean useSha512 = config.useSHA512Intrinsics(); |
532 boolean useSha512 = config.useSHA512Intrinsics(); |
505 |
533 |
506 if (!Java8OrEarlier && (useSha1 || useSha256 || useSha512)) { |
534 if (JavaVersionUtil.JAVA_SPEC > 8 && (useSha1 || useSha256 || useSha512)) { |
507 Registration r = new Registration(plugins, "sun.security.provider.DigestBase", bytecodeProvider); |
535 Registration r = new Registration(plugins, "sun.security.provider.DigestBase", bytecodeProvider); |
508 r.registerMethodSubstitution(DigestBaseSubstitutions.class, "implCompressMultiBlock0", Receiver.class, byte[].class, int.class, int.class); |
536 r.registerMethodSubstitution(DigestBaseSubstitutions.class, "implCompressMultiBlock0", Receiver.class, byte[].class, int.class, int.class); |
509 } |
537 } |
510 |
538 |
511 if (useSha1) { |
539 if (useSha1) { |
600 |
628 |
601 private static void registerCRC32Plugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
629 private static void registerCRC32Plugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { |
602 if (config.useCRC32Intrinsics) { |
630 if (config.useCRC32Intrinsics) { |
603 Registration r = new Registration(plugins, CRC32.class, bytecodeProvider); |
631 Registration r = new Registration(plugins, CRC32.class, bytecodeProvider); |
604 r.registerMethodSubstitution(CRC32Substitutions.class, "update", int.class, int.class); |
632 r.registerMethodSubstitution(CRC32Substitutions.class, "update", int.class, int.class); |
605 if (Java8OrEarlier) { |
633 if (JavaVersionUtil.JAVA_SPEC <= 8) { |
606 r.registerMethodSubstitution(CRC32Substitutions.class, "updateBytes", int.class, byte[].class, int.class, int.class); |
634 r.registerMethodSubstitution(CRC32Substitutions.class, "updateBytes", int.class, byte[].class, int.class, int.class); |
607 r.registerMethodSubstitution(CRC32Substitutions.class, "updateByteBuffer", int.class, long.class, int.class, int.class); |
635 r.registerMethodSubstitution(CRC32Substitutions.class, "updateByteBuffer", int.class, long.class, int.class, int.class); |
608 } else { |
636 } else { |
609 r.registerMethodSubstitution(CRC32Substitutions.class, "updateBytes0", int.class, byte[].class, int.class, int.class); |
637 r.registerMethodSubstitution(CRC32Substitutions.class, "updateBytes0", int.class, byte[].class, int.class, int.class); |
610 r.registerMethodSubstitution(CRC32Substitutions.class, "updateByteBuffer0", int.class, long.class, int.class, int.class); |
638 r.registerMethodSubstitution(CRC32Substitutions.class, "updateByteBuffer0", int.class, long.class, int.class, int.class); |