Commit 9ac65c9
committed
ARM64: Force acquire semantics on pointer loads to fix weak memory ordering
On ARM64's weakly-ordered memory model, pointer loads (LoadP/LoadN)
can be reordered with subsequent dependent loads by the hardware. This
causes failures in concurrent data structures used by virtual thread
scheduling (SynchronousQueue, LinkedTransferQueue) where a loaded
pointer is immediately dereferenced but the dependent field load sees
stale data.
Force MemNode::acquire at IR creation time in LoadNode::make() for all
LoadP/LoadN nodes on AARCH64 when barrier_data == 0. This must happen
at IR creation rather than instruction selection because C2's optimizer
can eliminate or reorder loads between those phases — a load removed by
LoadNode::Identity() or hoisted by Ideal() will never reach the matcher
to receive a barrier.
Loads with barrier_data != 0 (GC reference barriers) are excluded since
GC barrier patterns emit their own ordering sequences and have no
acquire variants in the .ad file.
Also reverts needs_acquiring_load() to the upstream form (is_acquire()
only), since the opcode-based check is now redundant — all pointer
loads already have acquire set on the IR node.1 parent b8d5fca commit 9ac65c9
1 file changed
Lines changed: 5 additions & 4 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
974 | | - | |
975 | | - | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
976 | 977 | | |
977 | 978 | | |
978 | 979 | | |
| |||
981 | 982 | | |
982 | 983 | | |
983 | 984 | | |
984 | | - | |
| 985 | + | |
985 | 986 | | |
986 | 987 | | |
987 | 988 | | |
| |||
990 | 991 | | |
991 | 992 | | |
992 | 993 | | |
993 | | - | |
| 994 | + | |
994 | 995 | | |
995 | 996 | | |
996 | 997 | | |
| |||
0 commit comments