[Git][ghc/ghc][wip/bytecode-library] 21 commits: Add support for generating bytecode objects
Matthew Pickering pushed to branch wip/bytecode-library at Glasgow Haskell Compiler / GHC Commits: cea3c2a6 by Matthew Pickering at 2025-10-08T10:50:51+01:00 Add support for generating bytecode objects This commit adds the `-fwrite-byte-code` option which makes GHC emit a `.gbc` file which contains a serialised representation of bytecode. The bytecode can be loaded by the compiler to avoid having to reinterpret a module when using the bytecode interpreter (for example, in GHCi). There are also the new options: * -gbcdir=<DIR>: Specify the directory to place the gbc files * -gbcsuf=<suffix>: Specify the suffix for gbc files The option `-fbyte-code-and-object-code` now implies `-fwrite-byte-code`. These performance tests fail due to https://github.com/haskell/directory/issues/204 ------------------------- Metric Increase: MultiComponentModules MultiLayerModules MultiComponentModulesRecomp MultiLayerModulesRecomp MultiLayerModulesTH_Make MultiLayerModulesTH_OneShot T13701 ------------------------- The bytecode serialisation part was implemented by Cheng Shao Co-authored-by: Cheng Shao <terrorjack@type.dance> - - - - - ce6f68c5 by Matthew Pickering at 2025-10-08T10:52:53+01:00 Bytecode library - - - - - 01037f98 by Matthew Pickering at 2025-10-08T10:53:17+01:00 Load bytecode objects into the linker when they are loaded. - - - - - cb075bb1 by Matthew Pickering at 2025-10-08T10:53:19+01:00 Missing file - - - - - 275d780c by Matthew Pickering at 2025-10-08T10:53:19+01:00 library - - - - - 0e40fcc0 by Matthew Pickering at 2025-10-08T10:53:19+01:00 Don't link against Haskell libraries when creating shared object to load with dlopen - - - - - 068e2b60 by Matthew Pickering at 2025-10-08T10:53:19+01:00 Missing test files - - - - - 20b4ced3 by Matthew Pickering at 2025-10-08T10:53:30+01:00 Rebase fixes - - - - - e5e73a1b by Matthew Pickering at 2025-10-08T10:53:31+01:00 Cabal commit - - - - - 32dd9d3f by Matthew Pickering at 2025-10-08T10:53:31+01:00 Fix warnings - - - - - 6ea81de5 by Matthew Pickering at 2025-10-08T10:53:31+01:00 remove unused constructor - - - - - 44a64547 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Fix recompilation checking - - - - - 6f8ed98b by Matthew Pickering at 2025-10-08T10:53:31+01:00 proper error message - - - - - 5124d868 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Add bytecodelib docs - - - - - cb7d8394 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Fix haddock comments - - - - - 9e334750 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Normalise testsuite output for package tests - - - - - 4d39d719 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Use LinkingHomePackage, for now, this is broken but only for bytecode libraries - - - - - fafba12b by Matthew Pickering at 2025-10-08T10:53:31+01:00 Accept new output for T9930fail - - - - - 8211b041 by Matthew Pickering at 2025-10-08T10:53:31+01:00 Missing stdout files - - - - - ff7cfe0c by Matthew Pickering at 2025-10-08T10:53:31+01:00 Fix tests - - - - - 9a3ca0c2 by Matthew Pickering at 2025-10-08T11:53:32+01:00 Update test output - - - - - 101 changed files: - compiler/GHC/Builtin/PrimOps.hs - compiler/GHC/ByteCode/Breakpoints.hs - + compiler/GHC/ByteCode/Serialize.hs - compiler/GHC/ByteCode/Types.hs - compiler/GHC/Data/FlatBag.hs - compiler/GHC/Data/SmallArray.hs - compiler/GHC/Driver/Backend.hs - compiler/GHC/Driver/Backpack.hs - + compiler/GHC/Driver/ByteCode.hs - compiler/GHC/Driver/CodeOutput.hs - compiler/GHC/Driver/Config/Finder.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/Flags.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Make.hs - compiler/GHC/Driver/Messager.hs - compiler/GHC/Driver/Pipeline.hs - compiler/GHC/Driver/Pipeline/Execute.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/HsToCore/Breakpoints.hs - compiler/GHC/HsToCore/Usage.hs - + compiler/GHC/Linker/ByteCode.hs - compiler/GHC/Linker/Deps.hs - compiler/GHC/Linker/Dynamic.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Linker/Types.hs - compiler/GHC/Platform.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Runtime/Interpreter.hs - compiler/GHC/Types/Error/Codes.hs - compiler/GHC/Types/SptEntry.hs - compiler/GHC/Types/Tickish.hs - compiler/GHC/Unit/Finder.hs - compiler/GHC/Unit/Finder/Types.hs - compiler/GHC/Unit/Home/PackageTable.hs - compiler/GHC/Unit/Info.hs - compiler/GHC/Unit/Module/Graph.hs - compiler/GHC/Unit/Module/Location.hs - compiler/GHC/Unit/Module/ModSummary.hs - compiler/GHC/Unit/Module/WholeCoreBindings.hs - compiler/GHC/Unit/State.hs - compiler/GHC/Utils/Binary.hs - compiler/ghc.cabal.in - docs/users_guide/phases.rst - docs/users_guide/separate_compilation.rst - libraries/Cabal - libraries/ghc-boot/GHC/Unit/Database.hs - testsuite/tests/bytecode/T24634/T24634a.stdout - testsuite/tests/bytecode/T24634/T24634b.stdout - + 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/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/count-deps/CountDepsAst.stdout - testsuite/tests/count-deps/CountDepsParser.stdout - + testsuite/tests/driver/bytecode-object/A.hs - + testsuite/tests/driver/bytecode-object/BytecodeForeign.c - + testsuite/tests/driver/bytecode-object/BytecodeForeign.hs - + testsuite/tests/driver/bytecode-object/BytecodeMain.hs - + testsuite/tests/driver/bytecode-object/BytecodeTest.hs - + testsuite/tests/driver/bytecode-object/Makefile - + testsuite/tests/driver/bytecode-object/all.T - + testsuite/tests/driver/bytecode-object/bytecode_object12.stderr - + testsuite/tests/driver/bytecode-object/bytecode_object13.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object14.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object15.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object16.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object17.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object18.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object19.script - + 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/driver/bytecode-object/bytecode_object25.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object4.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object5.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object6.stdout - testsuite/tests/driver/fat-iface/T22405/T22405.stdout - testsuite/tests/driver/fat-iface/T22405/T22405b.stdout - testsuite/tests/driver/fat-iface/fat011.stderr - testsuite/tests/ghc-e/should_fail/T9930fail.stderr - testsuite/tests/perf/compiler/Makefile - + testsuite/tests/perf/compiler/MultiLayerModulesDefsGhciWithBytecodeFiles.script - testsuite/tests/perf/compiler/all.T - testsuite/tests/simplStg/should_compile/T22840.stderr - utils/ghc-pkg/Main.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2cbf543cd7099744ae0ea52bd871e6d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2cbf543cd7099744ae0ea52bd871e6d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Matthew Pickering (@mpickering)