Skip to content

Commit a04c797

Browse files
committed
Bug 1940795: Don't tear aligned subwords in AtomicMemcpy. r=spidermonkey-reviewers,jandem
Reads/writes to integer typed arrays mustn't tear, so they can't be split into single byte operations. Replace single byte copy loops with `AtomicCopy{Down,Up}NoTearIfAlignedUnsynchronized`, which performs additional checks when aligned word or dword copying is needed. Test262 tests: <tc39/test262#4369> Differential Revision: https://phabricator.services.mozilla.com/D233710 UltraBlame original commit: 968d34f043635337c9ab03c4c3f975c39e52f057
1 parent 385e844 commit a04c797

File tree

2 files changed

+809
-96
lines changed

2 files changed

+809
-96
lines changed

js/src/jit/GenerateAtomicOperations.py

Lines changed: 243 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6927,6 +6927,55 @@
69276927
"
69286928
)
69296929

6930+
elif
6931+
size
6932+
=
6933+
=
6934+
2
6935+
:
6936+
6937+
insns
6938+
+
6939+
=
6940+
fmt_insn
6941+
(
6942+
"
6943+
movw
6944+
OFFSET
6945+
(
6946+
%
6947+
[
6948+
src
6949+
]
6950+
)
6951+
%
6952+
[
6953+
scratch
6954+
]
6955+
"
6956+
)
6957+
6958+
insns
6959+
+
6960+
=
6961+
fmt_insn
6962+
(
6963+
"
6964+
movw
6965+
%
6966+
[
6967+
scratch
6968+
]
6969+
OFFSET
6970+
(
6971+
%
6972+
[
6973+
dst
6974+
]
6975+
)
6976+
"
6977+
)
6978+
69306979
elif
69316980
size
69326981
=
@@ -7089,6 +7138,112 @@
70897138
"
70907139
)
70917140

7141+
elif
7142+
size
7143+
=
7144+
=
7145+
2
7146+
:
7147+
7148+
insns
7149+
+
7150+
=
7151+
fmt_insn
7152+
(
7153+
"
7154+
ldrh
7155+
%
7156+
w
7157+
[
7158+
scratch
7159+
]
7160+
[
7161+
%
7162+
x
7163+
[
7164+
src
7165+
]
7166+
OFFSET
7167+
]
7168+
"
7169+
)
7170+
7171+
insns
7172+
+
7173+
=
7174+
fmt_insn
7175+
(
7176+
"
7177+
strh
7178+
%
7179+
w
7180+
[
7181+
scratch
7182+
]
7183+
[
7184+
%
7185+
x
7186+
[
7187+
dst
7188+
]
7189+
OFFSET
7190+
]
7191+
"
7192+
)
7193+
7194+
elif
7195+
size
7196+
=
7197+
=
7198+
4
7199+
:
7200+
7201+
insns
7202+
+
7203+
=
7204+
fmt_insn
7205+
(
7206+
"
7207+
ldr
7208+
%
7209+
w
7210+
[
7211+
scratch
7212+
]
7213+
[
7214+
%
7215+
x
7216+
[
7217+
src
7218+
]
7219+
OFFSET
7220+
]
7221+
"
7222+
)
7223+
7224+
insns
7225+
+
7226+
=
7227+
fmt_insn
7228+
(
7229+
"
7230+
str
7231+
%
7232+
w
7233+
[
7234+
scratch
7235+
]
7236+
[
7237+
%
7238+
x
7239+
[
7240+
dst
7241+
]
7242+
OFFSET
7243+
]
7244+
"
7245+
)
7246+
70927247
else
70937248
:
70947249

@@ -7204,6 +7359,57 @@
72047359
"
72057360
)
72067361

7362+
elif
7363+
size
7364+
=
7365+
=
7366+
2
7367+
:
7368+
7369+
insns
7370+
+
7371+
=
7372+
fmt_insn
7373+
(
7374+
"
7375+
ldrh
7376+
%
7377+
[
7378+
scratch
7379+
]
7380+
[
7381+
%
7382+
[
7383+
src
7384+
]
7385+
#
7386+
OFFSET
7387+
]
7388+
"
7389+
)
7390+
7391+
insns
7392+
+
7393+
=
7394+
fmt_insn
7395+
(
7396+
"
7397+
strh
7398+
%
7399+
[
7400+
scratch
7401+
]
7402+
[
7403+
%
7404+
[
7405+
dst
7406+
]
7407+
#
7408+
OFFSET
7409+
]
7410+
"
7411+
)
7412+
72077413
else
72087414
:
72097415

@@ -8509,7 +8715,43 @@
85098715
gen_copy
85108716
(
85118717
"
8512-
AtomicCopyByteUnsynchronized
8718+
AtomicCopy32Unsynchronized
8719+
"
8720+
"
8721+
uint32_t
8722+
"
8723+
4
8724+
1
8725+
"
8726+
down
8727+
"
8728+
)
8729+
8730+
contents
8731+
+
8732+
=
8733+
gen_copy
8734+
(
8735+
"
8736+
AtomicCopy16Unsynchronized
8737+
"
8738+
"
8739+
uint16_t
8740+
"
8741+
2
8742+
1
8743+
"
8744+
down
8745+
"
8746+
)
8747+
8748+
contents
8749+
+
8750+
=
8751+
gen_copy
8752+
(
8753+
"
8754+
AtomicCopy8Unsynchronized
85138755
"
85148756
"
85158757
uint8_t

0 commit comments

Comments
 (0)