[Git][ghc/ghc][wip/js-staging] JavaScript ShrinkSmallMutableArrayOp_Char & GetSizeofSmallMutableArrayOp
Josh Meredith (@JoshMeredith)
gitlab at gitlab.haskell.org
Mon Sep 26 17:28:34 UTC 2022
Josh Meredith pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
4c452b24 by Josh Meredith at 2022-09-26T17:28:09+00:00
JavaScript ShrinkSmallMutableArrayOp_Char & GetSizeofSmallMutableArrayOp
- - - - -
2 changed files:
- compiler/GHC/StgToJS/Prim.hs
- rts/js/mem.js
Changes:
=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -1214,8 +1214,9 @@ genPrim prof ty op = case op of
------------------------------ Unhandled primops -------------------
- ShrinkSmallMutableArrayOp_Char -> unhandledPrimop op
- GetSizeofSmallMutableArrayOp -> unhandledPrimop op
+ ShrinkSmallMutableArrayOp_Char -> \[] [a,n] -> PrimInline $ appS "h$shrinkMutableCharArray" [a,n]
+ GetSizeofSmallMutableArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "length"
+
AtomicReadAddrOp_Word -> \[r] [a,o] -> PrimInline $ r |= dv_u32 a o
=====================================
rts/js/mem.js
=====================================
@@ -992,6 +992,10 @@ function h$shrinkMutableByteArray(a, n) {
}
}
+function h$shrinkMutableArray(a, n) {
+ a.length = n;
+}
+
function h$compareByteArrays(a1,o1,a2,o2,n) {
for(var i = 0; i < n; i++) {
var x = a1.u8[i + o1];
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c452b24e26217dabc83e690ba1f1b9fdd23fb6f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c452b24e26217dabc83e690ba1f1b9fdd23fb6f
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220926/3c5db323/attachment-0001.html>
More information about the ghc-commits
mailing list