summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2023-02-24 10:02:50 +0100
committerBen Gamari <ben@smart-cactus.org>2023-03-02 10:16:55 -0500
commitb821cdbd91183d1abb6ae573fe6e048e3efbf667 (patch)
tree0fa50a01d46d6852356c4062e479c4ff0c323bbf /compiler
parent8f1ba948e05c123e6d39d703b02979742a986d14 (diff)
downloadhaskell-b821cdbd91183d1abb6ae573fe6e048e3efbf667.tar.gz
JS: fix for overlap with copyMutableByteArray# (#23033)
The code wasn't taking into account some kind of overlap. cgrun070 has been extended to test the missing case. (cherry picked from commit 8b77f9bfceb456115f63349ad0ff66a5cea7ab59)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/StgToJS/Prim.hs11
1 files changed, 2 insertions, 9 deletions
diff --git a/compiler/GHC/StgToJS/Prim.hs b/compiler/GHC/StgToJS/Prim.hs
index 6085b110cf..33c6dcf11b 100644
--- a/compiler/GHC/StgToJS/Prim.hs
+++ b/compiler/GHC/StgToJS/Prim.hs
@@ -573,11 +573,7 @@ genPrim prof bound ty op = case op of
[ d .! (Add di i) |= s .! (Add si i)
, postDecrS i
]
- CopySmallMutableArrayOp -> \[] [s,si,d,di,n] -> PrimInline $
- loopBlockS (Sub n one_) (.>=. zero_) \i ->
- [ d .! (Add di i) |= s .! (Add si i)
- , postDecrS i
- ]
+ CopySmallMutableArrayOp -> \[] [s,si,d,di,n] -> PrimInline $ appS "h$copyMutableArray" [s,si,d,di,n]
CloneSmallArrayOp -> \[r] [a,o,n] -> PrimInline $ cloneArray r a (Just o) n
CloneSmallMutableArrayOp -> \[r] [a,o,n] -> PrimInline $ cloneArray r a (Just o) n
FreezeSmallArrayOp -> \[r] [a,o,n] -> PrimInline $ cloneArray r a (Just o) n
@@ -719,10 +715,7 @@ genPrim prof bound ty op = case op of
CopyByteArrayOp -> \[] [a1,o1,a2,o2,n] ->
PrimInline . boundsChecked bound a1 (Add o1 (Sub n 1))
. boundsChecked bound a2 (Add o2 (Sub n 1))
- $ loopBlockS (Sub n one_) (.>=. zero_) \i ->
- [ write_u8 a2 (Add i o2) (read_u8 a1 (Add i o1))
- , postDecrS i
- ]
+ $ appS "h$copyMutableByteArray" [a1,o1,a2,o2,n]
CopyMutableByteArrayOp -> \[] xs@[_a1,_o1,_a2,_o2,_n] -> genPrim prof bound ty CopyByteArrayOp [] xs
CopyByteArrayToAddrOp -> \[] xs@[_a1,_o1,_a2,_o2,_n] -> genPrim prof bound ty CopyByteArrayOp [] xs
CopyMutableByteArrayToAddrOp -> \[] xs@[_a1,_o1,_a2,_o2,_n] -> genPrim prof bound ty CopyByteArrayOp [] xs