[Git][ghc/ghc][wip/T24634-oneshot-bytecode] 2 commits: experiment: use dyn for stubs, but only for serialization

Torsten Schmits (@torsten.schmits) gitlab at gitlab.haskell.org
Thu Aug 1 21:44:34 UTC 2024



Torsten Schmits pushed to branch wip/T24634-oneshot-bytecode at Glasgow Haskell Compiler / GHC


Commits:
1c7cc32c by Torsten Schmits at 2024-08-01T23:43:39+02:00
experiment: use dyn for stubs, but only for serialization

- - - - -
59418ec5 by Torsten Schmits at 2024-08-01T23:43:59+02:00
refactor test config

- - - - -


2 changed files:

- compiler/GHC/Driver/Pipeline/Execute.hs
- testsuite/tests/bytecode/T25090/all.T


Changes:

=====================================
compiler/GHC/Driver/Pipeline/Execute.hs
=====================================
@@ -584,16 +584,20 @@ runHscBackendPhase pipe_env hsc_env mod_name src_flavour location result = do
               (outputFilename, mStub, foreign_files, stg_infos, cg_infos) <-
                 hscGenHardCode hsc_env cgguts mod_location output_fn
 
-              -- When compiling with -fprefer-byte-code, always
-              -- compile foreign stubs as shared objects to ensure
-              -- they can be properly loaded.
-              stub_o <- mapM (compileStub hsc_env) mStub
-              foreign_os <-
-                mapM (uncurry (compileForeign hsc_env)) foreign_files
-              let fos = maybe [] return stub_o ++ foreign_os
-                  iface_fos
-                    | gopt Opt_WriteIfSimplifiedCore dflags = fos
-                    | otherwise = []
+              let foreign_jobs fo_env = do
+                    stub_o <- mapM (compileStub fo_env) mStub
+                    foreign_os <-
+                      mapM (uncurry (compileForeign fo_env)) foreign_files
+                    pure (maybeToList stub_o ++ foreign_os)
+
+              output_fos <- foreign_jobs hsc_env
+              -- When compiling with -fprefer-byte-code, always compile foreign
+              -- stubs as shared objects for serialization to ensure they can be
+              -- properly loaded.
+              iface_fos <-
+                if gopt Opt_WriteIfSimplifiedCore dflags
+                then foreign_jobs (hscUpdateFlags setDynamicNow hsc_env)
+                else pure []
 
               final_iface <- mkFullIface hsc_env partial_iface stg_infos cg_infos iface_fos
 
@@ -611,7 +615,7 @@ runHscBackendPhase pipe_env hsc_env mod_name src_flavour location result = do
               -- have some way to do before the object file is produced
               -- In future we can split up the driver logic more so that this function
               -- is in TPipeline and in this branch we can invoke the rest of the backend phase.
-              return (fos, final_iface, mlinkable, outputFilename)
+              return (output_fos, final_iface, mlinkable, outputFilename)
 
            else
               -- In interpreted mode the regular codeGen backend is not run so we


=====================================
testsuite/tests/bytecode/T25090/all.T
=====================================
@@ -1,15 +1,14 @@
-test('T25090a',
+def test_T25090(name):
+    return test(name,
      [extra_files(['A.hs', 'B.hs', 'C.hs-boot', 'C.hs', 'D.hs']),
       req_th,
+      # TODO why does this not work?
+      js_skip,
       use_specs({'stdout': 'T25090.stdout'}),
       ],
      makefile_test,
      [])
 
-test('T25090b',
-     [extra_files(['A.hs', 'B.hs', 'C.hs-boot', 'C.hs', 'D.hs']),
-      req_th,
-      use_specs({'stdout': 'T25090.stdout'}),
-      ],
-     makefile_test,
-     [])
+test_T25090('T25090a')
+
+test_T25090('T25090b')



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8affc8a4c4794b4be86d21829eff91b52216eb57...59418ec53c8ba7152df98497c923a1a41fc9bf9d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8affc8a4c4794b4be86d21829eff91b52216eb57...59418ec53c8ba7152df98497c923a1a41fc9bf9d
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/20240801/f1ee68ef/attachment-0001.html>


More information about the ghc-commits mailing list