[Git][ghc/ghc][wip/26626] 13 commits: Add support for building bytecode libraries
recursion-ninja pushed to branch wip/26626 at Glasgow Haskell Compiler / GHC Commits: e36a5fcb by Matthew Pickering at 2025-12-05T16:25:57-05:00 Add support for building bytecode libraries A bytecode library is a collection of bytecode files (.gbc) and a library which combines together additional object files. A bytecode library is created by invoking GHC with the `-bytecodelib` flag. A library can be created from in-memory `ModuleByteCode` linkables or by passing `.gbc` files as arguments on the command line. Fixes #26298 - - - - - 8f9ae339 by Matthew Pickering at 2025-12-05T16:25:57-05:00 Load bytecode libraries to satisfy package dependencies This commit allows you to use a bytecode library to satisfy a package dependency when using the interpreter. If a user enables `-fprefer-byte-code`, then if a package provides a bytecode library, that will be loaded and used to satisfy the dependency. The main change is to separate the relevant parts of the `LoaderState` into external and home package byte code. Bytecode is loaded into either the home package or external part (similar to HPT/EPS split), HPT bytecode can be unloaded. External bytecode is never unloaded. The unload function has also only been called with an empty list of "stable linkables" for a long time. It has been modified to directly implement a complete unloading of the home package bytecode linkables. At the moment, the bytecode libraries are found in the "library-dirs" field from the package description. In the future when `Cabal` implements support for "bytecode-library-dirs" field, we can read the bytecode libraries from there. No changes to the Cabal submodule are necessary at the moment. Four new tests are added in testsuite/tests/cabal, which generate fake package descriptions and test loading the libraries into GHCi. Fixes #26298 - - - - - 54458ce4 by mangoiv at 2025-12-05T16:26:50-05:00 ExplicitLevelImports: improve documentation of the code - more explicit names for variable names like `flg` or `topLevel` - don't pass the same value twice to functions - some explanations of interesting but undocumented code paths - adjust comment to not mention non-existent error message - - - - - c7061392 by mangoiv at 2025-12-05T16:27:42-05:00 driver: don't expect nodes to exist when checking paths between them In `mgQueryZero`, previously node lookups were expected to never fail, i.e. it was expected that when calculating the path between two nodes in a zero level import graph, both nodes would always exist. This is not the case, e.g. in some situations involving exact names (see the test-case). The fix is to first check whether the node is present in the graph at all, instead of panicking, just to report that there is no path. Closes #26568 - - - - - d6cf8463 by Peng Fan at 2025-12-06T11:06:28-05:00 NCG/LA64: Simplify genCCall into two parts genCCall is too long, so it's been simplified into two parts: genPrim and genLibCCall. Suggested by Andreas Klebinger - - - - - 9d371d23 by Matthew Pickering at 2025-12-06T11:07:09-05:00 hadrian: Use a response file to invoke GHC for dep gathering. In some cases we construct an argument list too long for GHC to handle directly on windows. This happens when we generate the dependency file because the command line will contain references to a large number of .hs files. To avoid this we now invoke GHC using a response file when generating dependencies to sidestep length limitations. Note that we only pass the actual file names in the dependency file. Why? Because this side-steps #26560 - - - - - 0043bfb0 by Marc Scholten at 2025-12-06T11:08:03-05:00 update xhtml to 3000.4.0.0 haddock-api: bump xhtml bounds haddock-api: use lazy text instead of string to support xhtml 3000.4.0.0 Bumping submodule xhtml to 3000.4.0.0 add xhtml to stage0Packages remove unused import of writeUtf8File Remove redundant import Update haddock golden files for xhtml 3000.4.0.0 Metric Decrease: haddock.Cabal haddock.base - - - - - fc958fc9 by Julian Ospald at 2025-12-06T11:08:53-05:00 rts: Fix object file format detection in loadArchive Commit 76d1041dfa4b96108cfdd22b07f2b3feb424dcbe seems to have introduced this bug, ultimately leading to failure of test T11788. I can only theorize that this test isn't run in upstream's CI, because they don't build a static GHC. The culprit is that we go through the thin archive, trying to follow the members on the filesystem, but don't re-identify the new object format of the member. This pins `object_fmt` to `NotObject` from the thin archive. Thanks to @angerman for spotting this. - - - - - 0f297f6e by mangoiv at 2025-12-06T11:09:44-05:00 users' guide: don't use f strings in the python script to ensure compatibility with python 3.5 - - - - - 3bfe7aa2 by Matthew Pickering at 2025-12-07T12:18:57-05:00 ci: Try using multi repl in ghc-in-ghci test This should be quite a bit faster than the ./hadrian/ghci command as it doesn't properly build all the dependencies. - - - - - 2ef1601a by Rodrigo Mesquita at 2025-12-07T12:19:38-05:00 Stack.Decode: Don't error on bitmap size 0 A RET_BCO may have a bitmap with no payload. In that case, the bitmap = 0. One can observe this by using -ddump-bcos and interpreting ``` main = pure () ``` Observe, for instance, that the BCO for this main function has size 0: ``` ProtoBCO Main.main#0: \u [] breakmain:Main,0() GHC.Internal.Base.pure GHC.Internal.Base.$fApplicativeIO GHC.Internal.Tuple.() bitmap: 0 [] BRK_FUN <breakarray> main:Main 0 <cc> PACK () 0 PUSH_G GHC.Internal.Base.$fApplicativeIO PUSH_APPLY_PP PUSH_G GHC.Internal.Base.pure ENTER ``` Perhaps we never tried to decode a stack in which a BCO like this was present. However, for the debugger, we want to decode stacks of threads stopped at breakpoints, and these kind of BCOs do get on a stack under e.g. `stg_apply_interp_info` frames. See the accompanying test in the next commit for an example to trigger the bug this commit fixes. Fixes #26640 - - - - - 747153d2 by Rodrigo Mesquita at 2025-12-07T12:19:38-05:00 Add test for #26640 - - - - - 48923c66 by Recursion Ninja at 2025-12-09T10:34:56-05:00 Decouple 'Language.Haskell.Syntax.Type' from 'GHC.Utils.Panic' - Remove the *original* defintion of 'hsQTvExplicit' defined within 'Language.Haskell.Syntax.Type' - Redefine 'hsQTvExplicit' as 'hsq_explicit' specialized to 'GhcPass' exported by 'GHC.Utils.Panic' - Define 'hsQTvExplicitBinders' as 'hsq_explicit' specialized to 'DocNameI' exported by 'Haddock.GhcUtils'. - Replace all call sites of the original 'hsQTvExplicit' definition with either: 1. 'hsQTvExplicit' updated definition 2. 'hsQTvExplicitBinders' All call sites never entered the 'XLHsQTyVars' constructor branch, but a call to 'panic' existed on this code path because the type system was not strong enought to guarantee that the 'XLHsQTyVars' construction was impossible. These two specialized functions provide the type system with enough information to make that guarantee, and hence the dependancy on 'panic' can be removed. - - - - - 101 changed files: - .gitlab-ci.yml - compiler/GHC/ByteCode/Linker.hs - compiler/GHC/ByteCode/Serialize.hs - compiler/GHC/CmmToAsm/LA64/CodeGen.hs - compiler/GHC/Driver/Backpack.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/Driver/Errors/Types.hs - compiler/GHC/Driver/Make.hs - compiler/GHC/Driver/Phases.hs - compiler/GHC/Driver/Pipeline.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Type.hs - + compiler/GHC/Linker/ByteCode.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Linker/Types.hs - compiler/GHC/Rename/Splice.hs - compiler/GHC/Runtime/Debugger.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Settings.hs - compiler/GHC/Tc/Solver/Monad.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Unit/Home/PackageTable.hs - compiler/GHC/Unit/Info.hs - compiler/GHC/Unit/Module/Graph.hs - compiler/GHC/Unit/State.hs - compiler/Language/Haskell/Syntax/Type.hs - compiler/ghc.cabal.in - docs/users_guide/conf.py - docs/users_guide/phases.rst - hadrian/src/Builder.hs - hadrian/src/Rules/ToolArgs.hs - hadrian/src/Settings/Builders/Ghc.hs - hadrian/src/Settings/Default.hs - libraries/ghc-boot/GHC/Unit/Database.hs - libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs - libraries/xhtml - rts/linker/LoadArchive.c - testsuite/config/ghc - testsuite/mk/boilerplate.mk - + testsuite/tests/bytecode/T26640.hs - + testsuite/tests/bytecode/T26640.script - + testsuite/tests/bytecode/T26640.stdout - testsuite/tests/bytecode/all.T - + testsuite/tests/cabal/Bytecode.hs - + testsuite/tests/cabal/BytecodeForeign.c - + testsuite/tests/cabal/BytecodeForeign.hs - testsuite/tests/cabal/Makefile - testsuite/tests/cabal/all.T - + testsuite/tests/cabal/bytecode.pkg - + testsuite/tests/cabal/bytecode.script - + testsuite/tests/cabal/bytecode_foreign.pkg - + testsuite/tests/cabal/bytecode_foreign.script - testsuite/tests/cabal/ghcpkg03.stderr - testsuite/tests/cabal/ghcpkg03.stderr-mingw32 - testsuite/tests/cabal/ghcpkg05.stderr - testsuite/tests/cabal/ghcpkg05.stderr-mingw32 - + testsuite/tests/cabal/pkg_bytecode.stderr - + testsuite/tests/cabal/pkg_bytecode.stdout - + testsuite/tests/cabal/pkg_bytecode_foreign.stderr - + testsuite/tests/cabal/pkg_bytecode_foreign.stdout - + testsuite/tests/cabal/pkg_bytecode_with_gbc.stderr - + testsuite/tests/cabal/pkg_bytecode_with_gbc.stdout - + testsuite/tests/cabal/pkg_bytecode_with_o.stderr - + testsuite/tests/cabal/pkg_bytecode_with_o.stdout - testsuite/tests/driver/bytecode-object/Makefile - testsuite/tests/driver/bytecode-object/all.T - testsuite/tests/driver/bytecode-object/bytecode_object19.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object20.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object21.stderr - + testsuite/tests/driver/bytecode-object/bytecode_object21.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object23.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object24.stdout - + testsuite/tests/th/T26568.hs - + testsuite/tests/th/T26568.stderr - testsuite/tests/th/all.T - utils/ghc-pkg/Main.hs - utils/haddock/cabal.project - utils/haddock/haddock-api/haddock-api.cabal - utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Names.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Themes.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs - utils/haddock/haddock-api/src/Haddock/Doc.hs - utils/haddock/haddock-api/src/Haddock/GhcUtils.hs - utils/haddock/haddock-api/src/Haddock/Utils.hs - utils/haddock/html-test/ref/Bug26.html - utils/haddock/html-test/ref/Bug298.html - utils/haddock/html-test/ref/Bug458.html - utils/haddock/html-test/ref/Nesting.html - utils/haddock/html-test/ref/TitledPicture.html - utils/haddock/html-test/ref/Unicode.html - utils/haddock/html-test/ref/Unicode2.html The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7434d76a8558ef928eb6dbab73f80b1... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7434d76a8558ef928eb6dbab73f80b1... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
recursion-ninja (@recursion-ninja)