Skip to content

Commit 83f240c

Browse files
committed
[GR-66707] Adopt JDK-8359435 AArch64: add support for SB instruction to MacroAssembler::spin_wait
PullRequest: graal/21280
2 parents aeb2631 + f56eb9a commit 83f240c

29 files changed

+52
-41
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/asm/aarch64/AArch64Assembler.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.REVW;
138138
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.REVX;
139139
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.RORV;
140+
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.SB;
140141
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.SBC;
141142
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.SBCS;
142143
import static jdk.graal.compiler.asm.aarch64.AArch64Assembler.Instruction.SBFM;
@@ -1055,6 +1056,7 @@ public enum Instruction {
10551056
MSR(0xD5100000),
10561057
DC(0xD5087000),
10571058
ISB(0x000000C0),
1059+
SB(0x000000E0),
10581060

10591061
PACIA(0b00001 << 16 | 0b000000 << 10),
10601062
AUTIA(0b00001 << 16 | 0b000100 << 10),
@@ -4020,6 +4022,15 @@ public enum BarrierKind {
40204022
}
40214023
}
40224024

4025+
/**
4026+
* C6.2.75 Data Cache operation.
4027+
*/
4028+
public void dc(DataCacheOperationType type, Register src) {
4029+
assert verifyRegistersR(src);
4030+
4031+
emitInt(DC.encoding | type.encoding() | rt(src));
4032+
}
4033+
40234034
/**
40244035
* C6.2.80 Data Memory Barrier.
40254036
*
@@ -4068,12 +4079,10 @@ public void msr(SystemRegister systemRegister, Register src) {
40684079
}
40694080

40704081
/**
4071-
* C6.2.75 Data Cache operation.
4082+
* C6.2.230 Speculation barrier.
40724083
*/
4073-
public void dc(DataCacheOperationType type, Register src) {
4074-
assert verifyRegistersR(src);
4075-
4076-
emitInt(DC.encoding | type.encoding() | rt(src));
4084+
public void sb() {
4085+
emitInt(SB.encoding | BarrierOp);
40774086
}
40784087

40794088
public void annotatePatchingImmediate(int pos, Instruction instruction, int operandSizeBits, int offsetBits, int shift) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
import jdk.graal.compiler.asm.Label;
4242
import jdk.graal.compiler.asm.aarch64.AArch64Address;
43+
import jdk.graal.compiler.asm.aarch64.AArch64Assembler;
4344
import jdk.graal.compiler.asm.aarch64.AArch64Assembler.ConditionFlag;
4445
import jdk.graal.compiler.asm.aarch64.AArch64Assembler.PrefetchMode;
4546
import jdk.graal.compiler.asm.aarch64.AArch64MacroAssembler;
@@ -481,6 +482,7 @@ private Consumer<AArch64MacroAssembler> onSpinWaitInst() {
481482
case "nop" -> AArch64MacroAssembler::nop;
482483
case "isb" -> AArch64MacroAssembler::isb;
483484
case "yield" -> AArch64MacroAssembler::pause;
485+
case "sb" -> AArch64Assembler::sb;
484486
default -> throw GraalError.shouldNotReachHere("Unknown OnSpinWaitInst " + config.onSpinWaitInst);
485487
};
486488
}

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
@@ -761,7 +761,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
761761
}
762762

763763
// @formatter:off
764-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/share/opto/library_call.cpp#L2981-L3035",
764+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/share/opto/library_call.cpp#L2986-L3040",
765765
sha1 = "353e0d45b0f63ac58af86dcab5b19777950da7e2")
766766
// @formatter:on
767767
private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config, GraphBuilderContext b, ResolvedJavaMethod targetMethod, ForeignCallDescriptor descriptor,
@@ -810,7 +810,7 @@ private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config
810810
}
811811

812812
// @formatter:off
813-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/share/opto/library_call.cpp#L3800-L3884",
813+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/share/opto/library_call.cpp#L3805-L3889",
814814
sha1 = "3e9cfba4d9554f7cd9ab392f0826a31ae6396193")
815815
// @formatter:on
816816
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
@@ -45,7 +45,7 @@
4545
import jdk.graal.compiler.word.Word;
4646

4747
// @formatter:off
48-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/share/opto/library_call.cpp#L4684-L4818",
48+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/share/opto/library_call.cpp#L4689-L4823",
4949
sha1 = "c212d1dbff26d02d4d749e085263d4104895f1ba")
5050
// @formatter:on
5151
public class HotSpotHashCodeSnippets extends IdentityHashCodeSnippets {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
* appropriately to comply with the layouts above.
206206
*/
207207
// @formatter:off
208-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/250eb743c112fbcc45bf2b3ded1c644b19893577/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L157-L463",
208+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L149-L455",
209209
sha1 = "223a88b7bdd10862cd3b112181e1d17682b0fbe2")
210210
// @formatter:on
211211
public class MonitorSnippets implements Snippets {
@@ -428,7 +428,7 @@ private static boolean tryStackLocking(Object object, Word lock, Word mark, Word
428428
}
429429

430430
// @formatter:off
431-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/9eeb86d972ac4cc38d923b2b868b426bbd27a4e8/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L465-L625",
431+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L457-L617",
432432
sha1 = "2d66e0ccf8dbf69f575be2633d5a17f77a20131d")
433433
// @formatter:on
434434
@SuppressWarnings("unused")
@@ -556,7 +556,7 @@ private static boolean tryStackUnlocking(Object object, Word thread, Word lock,
556556
}
557557

558558
// @formatter:off
559-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/250eb743c112fbcc45bf2b3ded1c644b19893577/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L627-L788",
559+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L619-L780",
560560
sha1 = "e88d7b8c4bb85358c6a810ee1d7d92fde5db42e6")
561561
// @formatter:on
562562
private static boolean tryLightweightUnlocking(Object object, Word thread, Word lock, boolean trace, Counters counters) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static boolean checkUnknownSubType(KlassPointer t, KlassPointer sNonNull, Counte
9090
}
9191

9292
// @formatter:off
93-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L4243-L4461",
93+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L4230-L4448",
9494
sha1 = "10849f217123323ad73af5fe2aee2876a2943e1d")
9595
// @formatter:on
9696
static boolean checkSecondarySubType(KlassPointer t, KlassPointer s, boolean isTAlwaysAbstract, Counters counters) {

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/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/share/opto/library_call.cpp#L3586-L3714",
67+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/share/opto/library_call.cpp#L3591-L3719",
6868
sha1 = "59f07096cdbe1aac79b1248db345e9616b54f4a4")
6969
// @formatter:on
7070
public class VirtualThreadUpdateJFRSnippets implements Snippets {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/stubs/LookUpSecondarySupersTableStub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public LookUpSecondarySupersTableStub(OptionValues options, HotSpotProviders pro
6262
}
6363

6464
// @formatter:off
65-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L4463-L4569",
65+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L4450-L4556",
6666
sha1 = "573099757de85d90c3cf8cee8ff332e195fe68c7")
6767
// @formatter:on
6868
@Snippet

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
// @formatter:off
6161
@SyncPort(from = "https://github.com/openjdk/jdk/blob/642816538fbaa5b74c6beb8a14d1738cdde28c10/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L2389-L2498",
6262
sha1 = "4ff403a9b236cce54bc806efd30d1e06e92ccde0")
63-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L6347-L6417",
63+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L6350-L6420",
6464
sha1 = "bf8efe736d39b5dcb6aa69ac4a38b70c6ff17ffe")
6565
// @formatter:on
6666
public final class AArch64ArrayFillOp extends AArch64ComplexVectorOp {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
@SyncPort(from = "https://github.com/openjdk/jdk/blob/15178aa298e43be3e27121343432f25884db4e5d/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L7827-L7847",
5252
sha1 = "4b7c56d39d91df3d900d50ca260ff8ad04815574")
53-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/a8cd01f6e2075bef89fcd82893cf417c9e1fa877/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L4241-L4277",
53+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L4244-L4280",
5454
sha1 = "33649be9177daf5f0b4817d807458a5ff8c00365")
5555
// @formatter:on
5656
public final class AArch64BigIntegerMulAddOp extends AArch64LIRInstruction {

0 commit comments

Comments
 (0)