src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/TestSHASubstitutions.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
32 import org.junit.internal.AssumptionViolatedException; |
32 import org.junit.internal.AssumptionViolatedException; |
33 |
33 |
34 import org.graalvm.compiler.api.test.Graal; |
34 import org.graalvm.compiler.api.test.Graal; |
35 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
35 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; |
36 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
36 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; |
37 import org.graalvm.compiler.hotspot.replacements.SHA2Substitutions; |
37 import org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins; |
38 import org.graalvm.compiler.hotspot.replacements.SHA5Substitutions; |
|
39 import org.graalvm.compiler.hotspot.replacements.SHASubstitutions; |
|
40 import org.graalvm.compiler.runtime.RuntimeProvider; |
38 import org.graalvm.compiler.runtime.RuntimeProvider; |
41 |
39 |
42 import jdk.vm.ci.code.InstalledCode; |
40 import jdk.vm.ci.code.InstalledCode; |
43 import jdk.vm.ci.meta.ResolvedJavaMethod; |
41 import jdk.vm.ci.meta.ResolvedJavaMethod; |
44 |
42 |
72 } |
70 } |
73 |
71 |
74 @Test |
72 @Test |
75 public void testSha1() { |
73 public void testSha1() { |
76 if (getConfig().useSHA1Intrinsics()) { |
74 if (getConfig().useSHA1Intrinsics()) { |
77 testWithInstalledIntrinsic("sun.security.provider.SHA", SHASubstitutions.implCompressName, "testDigest", "SHA-1", getData()); |
75 String implCompressName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(getConfig(), "sun/security/provider/SHA", "implCompress0", "implCompress"); |
|
76 testWithInstalledIntrinsic("sun.security.provider.SHA", implCompressName, "testDigest", "SHA-1", getData()); |
78 } |
77 } |
79 } |
78 } |
80 |
79 |
81 void testWithInstalledIntrinsic(String className, String methodName, String testSnippetName, Object... args) { |
80 void testWithInstalledIntrinsic(String className, String methodName, String testSnippetName, Object... args) { |
82 Class<?> c; |
81 Class<?> c; |
105 } |
104 } |
106 |
105 |
107 @Test |
106 @Test |
108 public void testSha256() { |
107 public void testSha256() { |
109 if (getConfig().useSHA256Intrinsics()) { |
108 if (getConfig().useSHA256Intrinsics()) { |
110 testWithInstalledIntrinsic("sun.security.provider.SHA2", SHA2Substitutions.implCompressName, "testDigest", "SHA-256", getData()); |
109 String implCompressName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(getConfig(), "sun/security/provider/SHA", "implCompress0", "implCompress"); |
|
110 testWithInstalledIntrinsic("sun.security.provider.SHA2", implCompressName, "testDigest", "SHA-256", getData()); |
111 } |
111 } |
112 } |
112 } |
113 |
113 |
114 @Test |
114 @Test |
115 public void testSha512() { |
115 public void testSha512() { |
116 if (getConfig().useSHA512Intrinsics()) { |
116 if (getConfig().useSHA512Intrinsics()) { |
117 testWithInstalledIntrinsic("sun.security.provider.SHA5", SHA5Substitutions.implCompressName, "testDigest", "SHA-512", getData()); |
117 String implCompressName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(getConfig(), "sun/security/provider/SHA", "implCompress0", "implCompress"); |
|
118 testWithInstalledIntrinsic("sun.security.provider.SHA5", implCompressName, "testDigest", "SHA-512", getData()); |
118 } |
119 } |
119 } |
120 } |
120 |
121 |
121 } |
122 } |