[Git][ghc/ghc][wip/js-th] JS: always recompile when TH is enabled (cf #23013)

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Thu Jun 1 13:08:23 UTC 2023



Sylvain Henry pushed to branch wip/js-th at Glasgow Haskell Compiler / GHC


Commits:
dadec553 by Sylvain Henry at 2023-06-01T15:13:47+02:00
JS: always recompile when TH is enabled (cf #23013)

- - - - -


3 changed files:

- compiler/GHC/Driver/Main.hs
- compiler/GHC/Iface/Recomp.hs
- + testsuite/tests/driver/th-new-test/th-new-test.stdout-javascript-unknown-ghcjs


Changes:

=====================================
compiler/GHC/Driver/Main.hs
=====================================
@@ -261,6 +261,8 @@ import GHC.Utils.Misc
 import GHC.Utils.Logger
 import GHC.Utils.TmpFs
 
+import qualified GHC.LanguageExtensions as LangExt
+
 import GHC.Data.FastString
 import GHC.Data.Bag
 import GHC.Data.StringBuffer
@@ -871,6 +873,15 @@ hscRecompStatus
            , IsBoot <- isBootSummary mod_summary -> do
                msg UpToDate
                return $ HscUpToDate checked_iface emptyHomeModInfoLinkable
+
+           -- Always recompile with the JS backend when TH is enabled until
+           -- #23013 is fixed.
+           | ArchJavaScript <- platformArch (targetPlatform lcl_dflags)
+           , xopt LangExt.TemplateHaskell lcl_dflags
+           -> do
+              msg $ needsRecompileBecause THWithJS
+              return $ HscRecompNeeded $ Just $ mi_iface_hash $ mi_final_exts $ checked_iface
+
            | otherwise -> do
                -- Do need linkable
                -- 1. Just check whether we have bytecode/object linkables and then


=====================================
compiler/GHC/Iface/Recomp.hs
=====================================
@@ -197,6 +197,7 @@ data RecompReason
   | MismatchedDynHiFile
   | ObjectsChanged
   | LibraryChanged
+  | THWithJS
   deriving (Eq)
 
 instance Outputable RecompReason where
@@ -229,6 +230,7 @@ instance Outputable RecompReason where
     MismatchedDynHiFile     -> text "Mismatched dynamic interface file"
     ObjectsChanged          -> text "Objects changed"
     LibraryChanged          -> text "Library changed"
+    THWithJS                -> text "JS backend always recompiles modules using Template Haskell for now (#23013)"
 
 recompileRequired :: RecompileRequired -> Bool
 recompileRequired UpToDate = False


=====================================
testsuite/tests/driver/th-new-test/th-new-test.stdout-javascript-unknown-ghcjs
=====================================
@@ -0,0 +1,26 @@
+[1 of 6] Compiling B
+[2 of 6] Compiling A
+[3 of 6] Compiling D
+[4 of 6] Compiling C
+[5 of 6] Compiling Main
+[6 of 6] Linking Main
+[1 of 6] Compiling B [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[2 of 6] Compiling A [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[3 of 6] Compiling D [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[4 of 6] Compiling C [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[6 of 6] Linking Main [Objects changed]
+[1 of 6] Compiling B [Source file changed]
+[2 of 6] Compiling A [B[TH] changed]
+[3 of 6] Compiling D [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[4 of 6] Compiling C [D[TH] changed]
+[6 of 6] Linking Main [Objects changed]
+[1 of 6] Compiling B [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[2 of 6] Compiling A [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[3 of 6] Compiling D [Source file changed]
+[4 of 6] Compiling C [D[TH] changed]
+[6 of 6] Linking Main [Objects changed]
+[1 of 6] Compiling B [Source file changed]
+[2 of 6] Compiling A [B[TH] changed]
+[3 of 6] Compiling D [Source file changed]
+[4 of 6] Compiling C [D[TH] changed]
+[6 of 6] Linking Main [Objects changed]



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dadec5534075f0a044c42920ddee80e825d6010b
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/20230601/36a09f8a/attachment-0001.html>


More information about the ghc-commits mailing list