[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 15:19:20 UTC 2023



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


Commits:
152719c7 by Sylvain Henry at 2023-06-01T17:24:40+02:00
JS: always recompile when TH is enabled (cf #23013)

- - - - -


8 changed files:

- compiler/GHC/Driver/Main.hs
- compiler/GHC/Iface/Recomp.hs
- testsuite/tests/annotations/should_run/all.T
- + testsuite/tests/driver/OneShotTH.stdout-javascript-unknown-ghcjs
- + testsuite/tests/driver/fat-iface/fat010.stdout-javascript-unknown-ghcjs
- + testsuite/tests/driver/recompHash/recompHash.stdout-javascript-unknown-ghcjs
- + testsuite/tests/driver/recompNoTH/recompNoTH.stdout-javascript-unknown-ghcjs
- + 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/annotations/should_run/all.T
=====================================
@@ -9,6 +9,9 @@ setTestOpts(when(fast(), skip))
 test('annrun01',
      [extra_files(['Annrun01_Help.hs']),
       req_th,
+      js_broken(23013), # strangely, the workaround for #23013 triggers
+                        # a call to an undefined FFI function in bytestring.
+                        # Before, it was slow but not failing.
       when(js_arch(), compile_timeout_multiplier(5)),
       pre_cmd('$MAKE -s --no-print-directory config'),
       omit_ways(['dyn'] + prof_ways)],


=====================================
testsuite/tests/driver/OneShotTH.stdout-javascript-unknown-ghcjs
=====================================


=====================================
testsuite/tests/driver/fat-iface/fat010.stdout-javascript-unknown-ghcjs
=====================================
@@ -0,0 +1,5 @@
+[1 of 3] Compiling THA
+[2 of 3] Compiling THB
+[3 of 3] Compiling THC
+[1 of 3] Compiling THA [JS backend always recompiles modules using Template Haskell for now (#23013)]
+[2 of 3] Compiling THB [Source file changed]


=====================================
testsuite/tests/driver/recompHash/recompHash.stdout-javascript-unknown-ghcjs
=====================================
@@ -0,0 +1,3 @@
+[1 of 2] Compiling B
+[2 of 2] Compiling A
+[2 of 2] Compiling A [JS backend always recompiles modules using Template Haskell for now (#23013)]


=====================================
testsuite/tests/driver/recompNoTH/recompNoTH.stdout-javascript-unknown-ghcjs
=====================================
@@ -0,0 +1,4 @@
+[1 of 2] Compiling B
+[2 of 2] Compiling A
+[1 of 2] Compiling B [Source file changed]
+[2 of 2] Compiling A [JS backend always recompiles modules using Template Haskell for now (#23013)]


=====================================
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/152719c701277de7ae14712dd6563ba99f6c70f2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/152719c701277de7ae14712dd6563ba99f6c70f2
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/27cedc93/attachment-0001.html>


More information about the ghc-commits mailing list