Skip to content

Commit 0455d19

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 8b604fb commit 0455d19

File tree

2 files changed

+1231
-211
lines changed

2 files changed

+1231
-211
lines changed

js/src/jit/GenerateAtomicOperations.py

+243-1
Original file line numberDiff line numberDiff line change
@@ -7309,6 +7309,55 @@
73097309
"
73107310
)
73117311

7312+
elif
7313+
size
7314+
=
7315+
=
7316+
2
7317+
:
7318+
7319+
insns
7320+
+
7321+
=
7322+
fmt_insn
7323+
(
7324+
"
7325+
movw
7326+
OFFSET
7327+
(
7328+
%
7329+
[
7330+
src
7331+
]
7332+
)
7333+
%
7334+
[
7335+
scratch
7336+
]
7337+
"
7338+
)
7339+
7340+
insns
7341+
+
7342+
=
7343+
fmt_insn
7344+
(
7345+
"
7346+
movw
7347+
%
7348+
[
7349+
scratch
7350+
]
7351+
OFFSET
7352+
(
7353+
%
7354+
[
7355+
dst
7356+
]
7357+
)
7358+
"
7359+
)
7360+
73127361
elif
73137362
size
73147363
=
@@ -7471,6 +7520,112 @@
74717520
"
74727521
)
74737522

7523+
elif
7524+
size
7525+
=
7526+
=
7527+
2
7528+
:
7529+
7530+
insns
7531+
+
7532+
=
7533+
fmt_insn
7534+
(
7535+
"
7536+
ldrh
7537+
%
7538+
w
7539+
[
7540+
scratch
7541+
]
7542+
[
7543+
%
7544+
x
7545+
[
7546+
src
7547+
]
7548+
OFFSET
7549+
]
7550+
"
7551+
)
7552+
7553+
insns
7554+
+
7555+
=
7556+
fmt_insn
7557+
(
7558+
"
7559+
strh
7560+
%
7561+
w
7562+
[
7563+
scratch
7564+
]
7565+
[
7566+
%
7567+
x
7568+
[
7569+
dst
7570+
]
7571+
OFFSET
7572+
]
7573+
"
7574+
)
7575+
7576+
elif
7577+
size
7578+
=
7579+
=
7580+
4
7581+
:
7582+
7583+
insns
7584+
+
7585+
=
7586+
fmt_insn
7587+
(
7588+
"
7589+
ldr
7590+
%
7591+
w
7592+
[
7593+
scratch
7594+
]
7595+
[
7596+
%
7597+
x
7598+
[
7599+
src
7600+
]
7601+
OFFSET
7602+
]
7603+
"
7604+
)
7605+
7606+
insns
7607+
+
7608+
=
7609+
fmt_insn
7610+
(
7611+
"
7612+
str
7613+
%
7614+
w
7615+
[
7616+
scratch
7617+
]
7618+
[
7619+
%
7620+
x
7621+
[
7622+
dst
7623+
]
7624+
OFFSET
7625+
]
7626+
"
7627+
)
7628+
74747629
else
74757630
:
74767631

@@ -7586,6 +7741,57 @@
75867741
"
75877742
)
75887743

7744+
elif
7745+
size
7746+
=
7747+
=
7748+
2
7749+
:
7750+
7751+
insns
7752+
+
7753+
=
7754+
fmt_insn
7755+
(
7756+
"
7757+
ldrh
7758+
%
7759+
[
7760+
scratch
7761+
]
7762+
[
7763+
%
7764+
[
7765+
src
7766+
]
7767+
#
7768+
OFFSET
7769+
]
7770+
"
7771+
)
7772+
7773+
insns
7774+
+
7775+
=
7776+
fmt_insn
7777+
(
7778+
"
7779+
strh
7780+
%
7781+
[
7782+
scratch
7783+
]
7784+
[
7785+
%
7786+
[
7787+
dst
7788+
]
7789+
#
7790+
OFFSET
7791+
]
7792+
"
7793+
)
7794+
75897795
else
75907796
:
75917797

@@ -9133,7 +9339,43 @@
91339339
gen_copy
91349340
(
91359341
"
9136-
AtomicCopyByteUnsynchronized
9342+
AtomicCopy32Unsynchronized
9343+
"
9344+
"
9345+
uint32_t
9346+
"
9347+
4
9348+
1
9349+
"
9350+
down
9351+
"
9352+
)
9353+
9354+
contents
9355+
+
9356+
=
9357+
gen_copy
9358+
(
9359+
"
9360+
AtomicCopy16Unsynchronized
9361+
"
9362+
"
9363+
uint16_t
9364+
"
9365+
2
9366+
1
9367+
"
9368+
down
9369+
"
9370+
)
9371+
9372+
contents
9373+
+
9374+
=
9375+
gen_copy
9376+
(
9377+
"
9378+
AtomicCopy8Unsynchronized
91379379
"
91389380
"
91399381
uint8_t

0 commit comments

Comments
 (0)