[Git][ghc/ghc][wip/T23479] Naive attempt to add `StgLitArg (LitString bs)`

Serge S. Gulin (@gulin.serge) gitlab at gitlab.haskell.org
Fri Aug 30 21:41:52 UTC 2024



Serge S. Gulin pushed to branch wip/T23479 at Glasgow Haskell Compiler / GHC


Commits:
982efb5a by Serge S. Gulin at 2024-08-31T00:41:16+03:00
Naive attempt to add `StgLitArg (LitString bs)`

- - - - -


1 changed file:

- compiler/GHC/StgToJS/Apply.hs


Changes:

=====================================
compiler/GHC/StgToJS/Apply.hs
=====================================
@@ -47,11 +47,13 @@ import GHC.StgToJS.Stack
 import GHC.StgToJS.Symbols
 import GHC.StgToJS.Types
 import GHC.StgToJS.Utils
+import GHC.StgToJS.Linker.Utils (decodeModifiedUTF8)
 
 import GHC.Types.Id
 import GHC.Types.Id.Info
 import GHC.Types.CostCentre
 import GHC.Types.RepType (mightBeFunTy)
+import GHC.Types.Literal
 
 import GHC.Stg.Syntax
 
@@ -116,6 +118,12 @@ genApp ctx i args
     , [top] <- concatMap typex_expr (ctxTarget ctx)
     = (,ExprInline) . (|=) top . app hdDecodeUtf8Z <$> varsForId v
 
+    | [StgLitArg (LitString bs)] <- args
+    , Just d <- decodeModifiedUTF8 bs
+    , idName i == unsafeUnpackJSStringUtf8ShShName
+    , [top] <- concatMap typex_expr (ctxTarget ctx)
+    = return . (,ExprInline) $ top |= toJExpr d
+
     -- let-no-escape
     | Just n <- ctxLneBindingStackSize ctx i
     = do



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/982efb5a014d03a2dc923096448908e542df1957

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/982efb5a014d03a2dc923096448908e542df1957
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/20240830/d048b70b/attachment-0001.html>


More information about the ghc-commits mailing list