[Git][ghc/ghc][wip/T26226] ghci: always enable the internal-interpreter flag
Teo Camarasu pushed to branch wip/T26226 at Glasgow Haskell Compiler / GHC Commits: 9da5afc5 by Teo Camarasu at 2025-07-25T19:29:51+01:00 ghci: always enable the internal-interpreter flag Building iserv requires the modules hidden behind the ghci internal-interpreter flag. This flag exists because these modules depend on parts of the TemplateHaskell interface, and historically we couldn't distinguish between the boot and the in-tree TH interface. This meant that these modules could only be built in stage0 if we've ensured that the boot TH interface matches the in-tree one. This restriction no longer holds as of https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12306. Removing this flag simplifies our logic, and is a step towards enabling using TH in bootstrapping (https://gitlab.haskell.org/ghc/ghc/-/issues/24624). - - - - - 3 changed files: - hadrian/src/Settings/Packages.hs - libraries/ghci/GHCi/Run.hs - libraries/ghci/ghci.cabal.in Changes: ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -128,39 +128,9 @@ packageArgs = do --------------------------------- ghci --------------------------------- , package ghci ? mconcat - [ - -- The use case here is that we want to build @iserv-proxy@ for the - -- cross compiler. That one needs to be compiled by the bootstrap - -- compiler as it needs to run on the host. Hence @iserv@ needs - -- @GHCi.TH@, @GHCi.Message@, @GHCi.Run@, and @GHCi.Server@ from - -- @ghci@. And those are behind the @-finternal-interpreter@ flag. - -- - -- But it may not build if we have made some changes to ghci's - -- dependencies (see #16051). - -- - -- To fix this properly Hadrian would need to: - -- * first build a compiler for the build platform (stage1 is enough) - -- * use it as a bootstrap compiler to build the stage1 cross-compiler - -- - -- The issue is that "configure" would have to be executed twice (for - -- the build platform and for the cross-platform) and Hadrian would - -- need to be fixed to support two different stage1 compilers. - -- - -- The workaround we use is to check if the bootstrap compiler has - -- the same version as the one we are building. In this case we can - -- avoid the first step above and directly build with - -- `-finternal-interpreter`. - -- - -- TODO: Note that in that case we also do not need to build most of - -- the Stage1 libraries, as we already know that the bootstrap - -- compiler comes with the same versions as the one we are building. - -- - builder (Cabal Setup) ? cabalExtraDirs ffiIncludeDir ffiLibraryDir + [ builder (Cabal Setup) ? cabalExtraDirs ffiIncludeDir ffiLibraryDir , builder (Cabal Flags) ? mconcat - [ ifM stage0 - (andM [cross, bootCross] `cabalFlag` "internal-interpreter") - (arg "internal-interpreter") - , stage0 `cabalFlag` "bootstrap" + [ stage0 `cabalFlag` "bootstrap" ] ] ===================================== libraries/ghci/GHCi/Run.hs ===================================== @@ -260,7 +260,11 @@ sandboxIO opts io = do -- rethrow :: EvalOpts -> IO a -> IO a rethrow EvalOpts{..} io = +#if MIN_VERSION_base(4,20,0) catchNoPropagate io $ \(ExceptionWithContext cx se) -> do +#else + catch io $ \se -> do +#endif -- If -fbreak-on-error, we break unconditionally, -- but with care of not breaking twice if breakOnError && not breakOnException @@ -271,7 +275,11 @@ rethrow EvalOpts{..} io = Just UserInterrupt -> return () -- In any other case, we don't want to break _ -> poke exceptionFlag 0 +#if MIN_VERSION_base(4,20,0) rethrowIO (ExceptionWithContext cx se) +#else + throwIO se +#endif -- -- While we're waiting for the sandbox thread to return a result, if ===================================== libraries/ghci/ghci.cabal.in ===================================== @@ -17,11 +17,6 @@ cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md -Flag internal-interpreter - Description: Build with internal interpreter support. - Default: False - Manual: True - Flag bootstrap Description: Enabled when building the stage1 compiler in order to vendor the in-tree @@ -56,23 +51,19 @@ library TupleSections UnboxedTuples - if flag(internal-interpreter) - CPP-Options: -DHAVE_INTERNAL_INTERPRETER + if !arch(javascript) exposed-modules: - GHCi.Run - GHCi.Debugger - GHCi.CreateBCO - GHCi.ObjLink - GHCi.Signals - GHCi.StaticPtrTable - GHCi.TH - GHCi.Server - - if !arch(javascript) - exposed-modules: - GHCi.InfoTable + GHCi.InfoTable exposed-modules: + GHCi.Run + GHCi.Debugger + GHCi.CreateBCO + GHCi.ObjLink + GHCi.Signals + GHCi.StaticPtrTable + GHCi.TH + GHCi.Server GHCi.BreakArray GHCi.BinaryArray GHCi.Message View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9da5afc52e16ce6c584b1bad9e67d07e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9da5afc52e16ce6c584b1bad9e67d07e... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Teo Camarasu (@teo)