Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
4a7ddc7b
by Sylvain Henry at 2026-03-07T05:04:59-05:00
15 changed files:
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Runtime/Interpreter/JS.hs
- testsuite/tests/ghci/should_run/all.T
- + testsuite/tests/javascript/T24886.hs
- + testsuite/tests/javascript/T24886.stderr
- + testsuite/tests/javascript/T24886.stdout
- testsuite/tests/javascript/all.T
- testsuite/tests/overloadedrecflds/should_compile/all.T
- testsuite/tests/overloadedrecflds/should_run/all.T
- testsuite/tests/quasiquotation/qq005/test.T
- testsuite/tests/quasiquotation/qq006/test.T
- testsuite/tests/saks/should_compile/all.T
- testsuite/tests/showIface/all.T
- testsuite/tests/th/all.T
- testsuite/tests/vdq-rta/should_compile/all.T
Changes:
| ... | ... | @@ -2910,7 +2910,7 @@ jsCodeGen hsc_env srcspan i this_mod stg_binds_with_deps binding_id = do |
| 2910 | 2910 | initLoaderState interp hsc_env
|
| 2911 | 2911 | |
| 2912 | 2912 | -- Take lock for the actual work.
|
| 2913 | - (dep_linkables, dep_units) <- modifyLoaderState interp $ \pls -> do
|
|
| 2913 | + (dep_linkables, needed_units) <- modifyLoaderState interp $ \pls -> do
|
|
| 2914 | 2914 | let link_opts = initLinkDepsOpts hsc_env
|
| 2915 | 2915 | |
| 2916 | 2916 | -- Find what packages and linkables are required
|
| ... | ... | @@ -2924,13 +2924,8 @@ jsCodeGen hsc_env srcspan i this_mod stg_binds_with_deps binding_id = do |
| 2924 | 2924 | -- FIXME: we should make the JS linker load new_objs here, instead of
|
| 2925 | 2925 | -- on-demand.
|
| 2926 | 2926 | |
| 2927 | - -- FIXME: we don't report needed units because we would have to find a way
|
|
| 2928 | - -- to build a meaningful LoadedPkgInfo (see the mess in
|
|
| 2929 | - -- GHC.Linker.Loader.{loadPackage,loadPackages'}). Detecting what to load
|
|
| 2930 | - -- and actually loading (using the native interpreter) are intermingled, so
|
|
| 2931 | - -- we can't directly reuse this code.
|
|
| 2932 | 2927 | let pls' = pls { objs_loaded = objs_loaded' }
|
| 2933 | - pure (pls', (ldAllLinkables deps, emptyUDFM {- ldNeededUnits deps -}) )
|
|
| 2928 | + pure (pls', (ldAllLinkables deps, ldUnits deps))
|
|
| 2934 | 2929 | |
| 2935 | 2930 | |
| 2936 | 2931 | let foreign_stubs = NoStubs
|
| ... | ... | @@ -2945,7 +2940,7 @@ jsCodeGen hsc_env srcspan i this_mod stg_binds_with_deps binding_id = do |
| 2945 | 2940 | -- link code containing binding "id_sym = expr", using id_sym as root
|
| 2946 | 2941 | withJSInterp i $ \inst -> do
|
| 2947 | 2942 | let roots = mkExportedModFuns this_mod [id_sym]
|
| 2948 | - jsLinkObject logger tmpfs tmp_dir js_config unit_env inst out_obj roots
|
|
| 2943 | + jsLinkObject logger tmpfs tmp_dir js_config unit_env inst out_obj roots needed_units
|
|
| 2949 | 2944 | |
| 2950 | 2945 | -- look up "id_sym" closure and create a StablePtr (HValue) from it
|
| 2951 | 2946 | href <- lookupClosure interp (IFaststringSymbol id_sym) >>= \case
|
| ... | ... | @@ -2955,7 +2950,11 @@ jsCodeGen hsc_env srcspan i this_mod stg_binds_with_deps binding_id = do |
| 2955 | 2950 | binding_fref <- withJSInterp i $ \inst ->
|
| 2956 | 2951 | mkForeignRef href (freeReallyRemoteRef inst href)
|
| 2957 | 2952 | |
| 2958 | - return (castForeignRef binding_fref, dep_linkables, dep_units)
|
|
| 2953 | + -- FIXME: we don't report needed units because we would have to find a way to
|
|
| 2954 | + -- build a meaningful LoadedPkgInfo (see the mess in
|
|
| 2955 | + -- GHC.Linker.Loader.{loadPackage,loadPackages'}).
|
|
| 2956 | + let pkgs_loaded = emptyUDFM
|
|
| 2957 | + return (castForeignRef binding_fref, dep_linkables, pkgs_loaded)
|
|
| 2959 | 2958 | |
| 2960 | 2959 | |
| 2961 | 2960 | {- **********************************************************************
|
| ... | ... | @@ -287,8 +287,8 @@ jsLinkInterp logger tmpfs tmp_dir cfg unit_env inst = do |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | -- | Link object files
|
| 290 | -jsLinkObjects :: Logger -> TmpFs -> TempDir -> StgToJSConfig -> UnitEnv -> ExtInterpInstance JSInterpExtra -> [FilePath] -> (ExportedFun -> Bool) -> IO ()
|
|
| 291 | -jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root = do
|
|
| 290 | +jsLinkObjects :: Logger -> TmpFs -> TempDir -> StgToJSConfig -> UnitEnv -> ExtInterpInstance JSInterpExtra -> [FilePath] -> (ExportedFun -> Bool) -> [UnitId] -> IO ()
|
|
| 291 | +jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root extra_units = do
|
|
| 292 | 292 | let link_cfg = JSLinkConfig
|
| 293 | 293 | { lcNoStats = True -- we don't need the stats
|
| 294 | 294 | , lcNoRts = True -- we don't need the RTS (already linked)
|
| ... | ... | @@ -300,7 +300,7 @@ jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root = do |
| 300 | 300 | , lcLinkCsources = True -- enable C sources, if any
|
| 301 | 301 | }
|
| 302 | 302 | |
| 303 | - let units = preloadUnits (ue_homeUnitState unit_env)
|
|
| 303 | + let units = preloadUnits (ue_homeUnitState unit_env) ++ extra_units
|
|
| 304 | 304 | |
| 305 | 305 | -- compute dependencies
|
| 306 | 306 | let link_spec = LinkSpec
|
| ... | ... | @@ -322,11 +322,11 @@ jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root = do |
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | -- | Link an object file using the given functions as roots
|
| 325 | -jsLinkObject :: Logger -> TmpFs -> TempDir -> StgToJSConfig -> UnitEnv -> ExtInterpInstance JSInterpExtra -> FilePath -> [ExportedFun] -> IO ()
|
|
| 326 | -jsLinkObject logger tmpfs tmp_dir cfg unit_env inst obj roots = do
|
|
| 325 | +jsLinkObject :: Logger -> TmpFs -> TempDir -> StgToJSConfig -> UnitEnv -> ExtInterpInstance JSInterpExtra -> FilePath -> [ExportedFun] -> [UnitId] -> IO ()
|
|
| 326 | +jsLinkObject logger tmpfs tmp_dir cfg unit_env inst obj roots extra_units = do
|
|
| 327 | 327 | let is_root f = Set.member f (Set.fromList roots)
|
| 328 | 328 | let objs = [obj]
|
| 329 | - jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root
|
|
| 329 | + jsLinkObjects logger tmpfs tmp_dir cfg unit_env inst objs is_root extra_units
|
|
| 330 | 330 | |
| 331 | 331 | |
| 332 | 332 | -- | Link the given link plan
|
| ... | ... | @@ -91,7 +91,7 @@ test('T22958a', just_ghci, compile_and_run, ['']) |
| 91 | 91 | test('T22958b', just_ghci, compile_and_run, [''])
|
| 92 | 92 | test('T22958c', just_ghci, compile_and_run, [''])
|
| 93 | 93 | test('GhciMainIs', just_ghci, compile_and_run, ['-main-is otherMain'])
|
| 94 | -test('LargeBCO', [extra_files(['LargeBCO_A.hs']), req_interp, extra_hc_opts("-O -fbyte-code-and-object-code -fprefer-byte-code")], compile_and_run, [''])
|
|
| 94 | +test('LargeBCO', [extra_files(['LargeBCO_A.hs']), req_th, extra_hc_opts("-O -fbyte-code-and-object-code -fprefer-byte-code")], compile_and_run, [''])
|
|
| 95 | 95 | |
| 96 | 96 | test('T24115', just_ghci + [extra_run_opts("-e ':add T24115.hs'")], ghci_script, ['T24115.script'])
|
| 97 | 97 |
| 1 | +{-# LANGUAGE TemplateHaskell #-}
|
|
| 2 | +module T24886 where
|
|
| 3 | + |
|
| 4 | +import GHC.Exts.Heap
|
|
| 5 | +import Control.Monad.IO.Class
|
|
| 6 | + |
|
| 7 | +-- this is a TH splice importing from ghc-heap, testing that the JS linker
|
|
| 8 | +-- can find the ghc-heap package during TH evaluation (see #24886)
|
|
| 9 | +do
|
|
| 10 | + let !_b = asBox "foo"
|
|
| 11 | + liftIO $ putStrLn "ok"
|
|
| 12 | + return [] |
| 1 | +ok |
| 1 | +ok |
| ... | ... | @@ -27,3 +27,4 @@ test('T23479', normal, makefile_test, ['T23479']) |
| 27 | 27 | test('T24744', normal, makefile_test, ['T24744'])
|
| 28 | 28 | |
| 29 | 29 | test('T25633', normal, compile_and_run, [''])
|
| 30 | +test('T24886', normal, compile, ['']) |
| ... | ... | @@ -48,7 +48,7 @@ test('BootFldReexport' |
| 48 | 48 | # the final module (BootFldReexport), but not fail earlier.
|
| 49 | 49 | , ['BootFldReexport', '-v0'])
|
| 50 | 50 | test('T23220'
|
| 51 | - , [req_th, extra_files(['T23220_aux.hs']), js_broken(24886)]
|
|
| 51 | + , [req_th, extra_files(['T23220_aux.hs'])]
|
|
| 52 | 52 | , multimod_compile, ['T23220_aux.hs T23220.hs', '-v0'])
|
| 53 | 53 | test('T22106_A', [extra_files(['T22106_aux.hs'])], multimod_compile, ['T22106_A', '-v0'])
|
| 54 | 54 | test('T22106_B', [extra_files(['T22106_aux.hs'])], multimod_compile, ['T22106_B', '-v0'])
|
| ... | ... | @@ -3,7 +3,7 @@ test('overloadedrecfldsrun01', [], multimod_compile_and_run, |
| 3 | 3 | test('overloadedrecfldsrun02', [extra_files(['OverloadedRecFldsRun02_A.hs'])], multimod_compile_and_run,
|
| 4 | 4 | ['overloadedrecfldsrun02', ''])
|
| 5 | 5 | test('overloadedrecfldsrun03', normal, compile_and_run, [''])
|
| 6 | -test('overloadedrecfldsrun04', [req_th,omit_ways(prof_ways), js_broken(24886)], compile_and_run, [''])
|
|
| 6 | +test('overloadedrecfldsrun04', [req_th,omit_ways(prof_ways)], compile_and_run, [''])
|
|
| 7 | 7 | test('overloadedrecfldsrun05', normal, compile_and_run, [''])
|
| 8 | 8 | test('overloadedrecfldsrun07', normal, compile_and_run, [''])
|
| 9 | 9 | test('overloadedrecflds_generics', normal, compile_and_run, [''])
|
| ... | ... | @@ -5,6 +5,6 @@ test('qq005', |
| 5 | 5 | # profiling ways, due to the TH use, so for now we just
|
| 6 | 6 | # omit the profiling ways
|
| 7 | 7 | omit_ways(prof_ways),
|
| 8 | - req_interp],
|
|
| 8 | + req_th],
|
|
| 9 | 9 | multimod_compile_and_run,
|
| 10 | 10 | ['Main', '']) |
| 1 | 1 | test('qq006', [extra_files(['Expr.hs', 'Main.hs']),
|
| 2 | 2 | when(fast(), skip),
|
| 3 | - req_interp], multimod_compile_fail,
|
|
| 3 | + req_th], multimod_compile_fail,
|
|
| 4 | 4 | ['Main', '-v0']) |
| ... | ... | @@ -37,5 +37,5 @@ test('T16721', normal, ghci_script, ['T16721.script']) |
| 37 | 37 | test('T16756a', normal, compile, [''])
|
| 38 | 38 | |
| 39 | 39 | test('saks027', req_th, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
|
| 40 | -test('saks028', [req_th, js_broken(24886)], compile, [''])
|
|
| 40 | +test('saks028', req_th, compile, [''])
|
|
| 41 | 41 | test('T17164', req_th, compile, ['-v0 -ddump-splices -dsuppress-uniques']) |
| ... | ... | @@ -3,7 +3,7 @@ test('DocsInHiFile0', extra_files(['DocsInHiFile.hs']), makefile_test, []) |
| 3 | 3 | test('DocsInHiFile1', extra_files(['DocsInHiFile.hs']), makefile_test, [])
|
| 4 | 4 | test('T17871', [extra_files(['T17871a.hs'])], multimod_compile, ['T17871', '-v0'])
|
| 5 | 5 | test('DocsInHiFileTH',
|
| 6 | - [extra_files(['DocsInHiFileTHExternal.hs', 'DocsInHiFileTH.hs']), req_th, js_broken(24886)],
|
|
| 6 | + [extra_files(['DocsInHiFileTHExternal.hs', 'DocsInHiFileTH.hs']), req_th],
|
|
| 7 | 7 | makefile_test, [])
|
| 8 | 8 | test('NoExportList', normal, makefile_test, [])
|
| 9 | 9 | test('PragmaDocs', normal, makefile_test, [])
|
| ... | ... | @@ -321,7 +321,7 @@ test('T1476', normal, compile, ['-v0']) |
| 321 | 321 | test('T1476b', normal, compile, ['-v0'])
|
| 322 | 322 | test('T8031', normal, compile, ['-v0'])
|
| 323 | 323 | test('T8624', only_ways(['normal']), makefile_test, ['T8624'])
|
| 324 | -test('TH_Lift', js_broken(24886), compile, ['-v0 -ddump-splices -dsuppress-uniques'])
|
|
| 324 | +test('TH_Lift', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
|
|
| 325 | 325 | test('T10047', only_ways(['ghci']), ghci_script, ['T10047.script'])
|
| 326 | 326 | test('T10019', only_ways(['ghci']), ghci_script, ['T10019.script'])
|
| 327 | 327 | test('T10267', [], multimod_compile_fail,
|
| ... | ... | @@ -30,8 +30,8 @@ test('T25127_infix', normal, compile, ['']) |
| 30 | 30 | |
| 31 | 31 | test('T22326_th_dump1', req_th, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
|
| 32 | 32 | test('T23739_th_dump1', req_th, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
|
| 33 | -test('T22326_th_pprint1', [req_th, js_broken(24886)], compile, [''])
|
|
| 34 | -test('T23739_th_pprint1', [req_th, js_broken(24886)], compile, [''])
|
|
| 33 | +test('T22326_th_pprint1', req_th, compile, [''])
|
|
| 34 | +test('T23739_th_pprint1', req_th, compile, [''])
|
|
| 35 | 35 | test('T23738_th', req_th, compile, [''])
|
| 36 | 36 | |
| 37 | 37 | test('T24159_viewpat', normal, compile, [''])
|