[Git][ghc/ghc][master] JS: fix codegen of static string data
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Sep 10 14:48:17 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
05715994 by Sylvain Henry at 2024-09-10T10:47:55-04:00
JS: fix codegen of static string data
Before this patch, when string literals are made trivial, we would
generate `h$("foo")` instead of `h$str("foo")`. This was
introduced by mistake in 6bd850e887b82c5a28bdacf5870d3dc2fc0f5091.
- - - - -
2 changed files:
- compiler/GHC/StgToJS/Symbols.hs
- compiler/GHC/StgToJS/Types.hs
Changes:
=====================================
compiler/GHC/StgToJS/Symbols.hs
=====================================
@@ -1212,3 +1212,6 @@ hdStlStr = fsLit "h$stl"
hdStiStr :: FastString
hdStiStr = fsLit "h$sti"
+
+hdStrStr :: FastString
+hdStrStr = fsLit "h$str"
=====================================
compiler/GHC/StgToJS/Types.hs
=====================================
@@ -284,7 +284,7 @@ instance ToJExpr StaticLit where
toJExpr (IntLit i) = toJExpr i
toJExpr NullLit = null_
toJExpr (DoubleLit d) = toJExpr (unSaneDouble d)
- toJExpr (StringLit t) = app hdStr [toJExpr t]
+ toJExpr (StringLit t) = app hdStrStr [toJExpr t]
toJExpr (BinLit b) = app hdRawStr [toJExpr (map toInteger (BS.unpack b))]
toJExpr (LabelLit _isFun lbl) = global lbl
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/057159947ae88f6bad703cc357913d8ca60384d0
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/057159947ae88f6bad703cc357913d8ca60384d0
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/20240910/2a17599d/attachment-0001.html>
More information about the ghc-commits
mailing list