Skip to content

Commit 530de25

Browse files
committed
[GR-58650] Port JDK-8341013: Optimize x86/aarch64 MD5 intrinsics by reducing data dependency.
PullRequest: graal/18965
2 parents 87c28bd + 8306caa commit 530de25

29 files changed

+46
-41
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
718718
}
719719

720720
// @formatter:off
721-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/96a0502d624e3eff1b00a7c63e8b3a27870b475e/src/hotspot/share/opto/library_call.cpp#L2909-L2964",
721+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/share/opto/library_call.cpp#L2918-L2973",
722722
sha1 = "5c117a305e90a48f0a6fe86ace2c15942393c0ab")
723723
// @formatter:on
724724
private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config, GraphBuilderContext b, ResolvedJavaMethod targetMethod, ForeignCallDescriptor descriptor,
@@ -767,7 +767,7 @@ private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config
767767
}
768768

769769
// @formatter:off
770-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/20d8f58c92009a46dfb91b951e7d87b4cb8e8b41/src/hotspot/share/opto/library_call.cpp#L3741-L3824",
770+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/share/opto/library_call.cpp#L3750-L3833",
771771
sha1 = "d65356dbc0235df26aa56b233bcd100462a5dab4")
772772
// @formatter:on
773773
private static class ContinuationPinningPlugin extends InvocationPlugin {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/HotSpotHashCodeSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import jdk.graal.compiler.word.Word;
4747

4848
// @formatter:off
49-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/96a0502d624e3eff1b00a7c63e8b3a27870b475e/src/hotspot/share/opto/library_call.cpp#L4660-L4794",
49+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/share/opto/library_call.cpp#L4669-L4803",
5050
sha1 = "c212d1dbff26d02d4d749e085263d4104895f1ba")
5151
// @formatter:on
5252
public class HotSpotHashCodeSnippets extends IdentityHashCodeSnippets {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/MonitorSnippets.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@
189189
* appropriately to comply with the layouts above.
190190
*/
191191
// @formatter:off
192-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/0cfd08f55aa166dc3f027887c886fa0b40a2ca21/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L175-L577",
193-
sha1 = "581920c0efef6a8b8fd0541be9145532ef88cecd")
192+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/180affc5718c9bf2f009d6a7aa129cc36335384a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L175-L532",
193+
sha1 = "6269b3e841e4a6be49042270f3489eae292fc05f")
194194
// @formatter:on
195195
public class MonitorSnippets implements Snippets {
196196

@@ -387,7 +387,7 @@ private static boolean tryStackLocking(Object object, Word lock, Word mark, Word
387387
}
388388

389389
// @formatter:off
390-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/0cfd08f55aa166dc3f027887c886fa0b40a2ca21/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L579-L737",
390+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L534-L692",
391391
sha1 = "393458a9c3b055b97fd247e424fe5b7a63840489")
392392
// @formatter:on
393393
@SuppressWarnings("unused")
@@ -515,8 +515,8 @@ private static boolean tryStackUnlocking(Object object, Word thread, Word lock,
515515
}
516516

517517
// @formatter:off
518-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/96a0502d624e3eff1b00a7c63e8b3a27870b475e/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L739-L888",
519-
sha1 = "1c68e25285d8a4de454c2d075ae6bac4e2e3e3d5")
518+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/180affc5718c9bf2f009d6a7aa129cc36335384a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L694-L855",
519+
sha1 = "b062dc05ca49eac14eabe6eda94015070bc0769f")
520520
// @formatter:on
521521
private static boolean tryLightweightUnlocking(Object object, Word thread, Word lock, boolean trace, Counters counters) {
522522
// Load top

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/VirtualThreadUpdateJFRSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* Snippet for updating JFR thread local data on {@code Thread#setCurrentThread} events.
6565
*/
6666
// @formatter:off
67-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/96a0502d624e3eff1b00a7c63e8b3a27870b475e/src/hotspot/share/opto/library_call.cpp#L3535-L3661",
67+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/share/opto/library_call.cpp#L3544-L3670",
6868
sha1 = "1f980401f5d7d9a363577635fd57fc1e24505d91")
6969
// @formatter:on
7070
public class VirtualThreadUpdateJFRSnippets implements Snippets {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64BitSwapOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import jdk.vm.ci.meta.AllocatableValue;
3737

3838
// @formatter:off
39-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/715fa8f9fe7242e86b985aece3d078b226f53fb9/src/hotspot/cpu/aarch64/aarch64.ad#L13269-L13293",
39+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/cpu/aarch64/aarch64.ad#L13277-L13301",
4040
sha1 = "5e7655c00a9d610fa3c992305c0f6aeba32b2d6c")
4141
// @formatter:on
4242
public class AArch64BitSwapOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64MD5Op.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
import jdk.vm.ci.meta.Value;
6464

6565
// @formatter:off
66-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/8032d640c0d34fe507392a1d4faa4ff2005c771d/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L3369-L3603",
67-
sha1 = "cfd2b9fcbbb67a138b8e28e7362ba1fff6a99aec")
66+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/1cf26a5179e619f17909426fdb26a3fb3b748483/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L3371-L3605",
67+
sha1 = "c2068cb8bd0d89f8cbfe2dded139137b7e9a9099")
6868
// @formatter:on
6969
public final class AArch64MD5Op extends AArch64LIRInstruction {
7070

@@ -153,15 +153,15 @@ private static void md5FF(AArch64MacroAssembler masm, Register[] regCache, Regis
153153

154154
private static void md5GG(AArch64MacroAssembler masm, Register[] regCache, Register reg1, Register reg2, Register reg3, Register reg4,
155155
int k, int s, int t, Register rscratch1, Register rscratch2, Register rscratch3, Register rscratch4) {
156-
masm.and(32, rscratch3, reg2, reg4);
157-
masm.bic(32, rscratch4, reg3, reg4);
158156
regCacheExtractU32(masm, regCache, rscratch1, k);
159157
masm.mov(rscratch2, t);
160-
masm.orr(32, rscratch3, rscratch3, rscratch4);
161158
masm.add(32, rscratch4, reg1, rscratch2);
162159
masm.add(32, rscratch4, rscratch4, rscratch1);
163-
masm.add(32, rscratch3, rscratch3, rscratch4);
164-
masm.ror(32, rscratch2, rscratch3, 32 - s);
160+
masm.bic(32, rscratch2, reg3, reg4);
161+
masm.and(32, rscratch3, reg2, reg4);
162+
masm.add(32, rscratch2, rscratch2, rscratch4);
163+
masm.add(32, rscratch2, rscratch2, rscratch3);
164+
masm.ror(32, rscratch2, rscratch2, 32 - s);
165165
masm.add(32, reg1, rscratch2, reg2);
166166
}
167167

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64NormalizedUnsignedCompareOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* Returns -1, 0, or 1 if either x < y, x == y, or x > y.
4242
*/
4343
// @formatter:off
44-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/715fa8f9fe7242e86b985aece3d078b226f53fb9/src/hotspot/cpu/aarch64/aarch64.ad#L8921-L9003",
44+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/cpu/aarch64/aarch64.ad#L8929-L9011",
4545
sha1 = "84da421c1489e188366d61bb4298e0425ccac14b")
4646
// @formatter:on
4747
public class AArch64NormalizedUnsignedCompareOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/g1/AArch64G1PostWriteBarrierOp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
*/
5252
// @formatter:off
5353
@SyncPort(from = "https://github.com/openjdk/jdk/blob/43a2f17342af8f5bf1f5823df9fa0bf0bdfdfce2/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp#L185-L259",
54+
ignore = "GR-58685",
5455
sha1 = "dd42f4d351403eb99f9bd76454131e0659be1565")
5556
// @formatter:on
5657
public class AArch64G1PostWriteBarrierOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/g1/AArch64G1PreWriteBarrierOp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
*/
5151
// @formatter:off
5252
@SyncPort(from = "https://github.com/openjdk/jdk/blob/5860a48c71e324f77a7ecc613c063cbb81580011/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp#L98-L183",
53+
ignore = "GR-58685",
5354
sha1 = "9b21f261fba89d49673568e85193159286db3ef5")
5455
// @formatter:on
5556
public class AArch64G1PreWriteBarrierOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/amd64/AMD64AESDecryptOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import jdk.vm.ci.meta.Value;
4444

4545
// @formatter:off
46-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/ce8399fd6071766114f5f201b6e44a7abdba9f5a/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp#L1119-L1212",
46+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7fa2f229fbee68112cbdd18b811d95721adfe2ec/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp#L1151-L1244",
4747
sha1 = "e87f6c5b4d86975678f423126a4c79c1e31b6833")
4848
// @formatter:on
4949
public final class AMD64AESDecryptOp extends AMD64LIRInstruction {

0 commit comments

Comments
 (0)