[Git][ghc/ghc][wip/fix-26953] 13 commits: perf: Share Module in Iface Symbol Table
recursion-ninja pushed to branch wip/fix-26953 at Glasgow Haskell Compiler / GHC Commits: 27463426 by Rodrigo Mesquita at 2026-06-26T20:54:58-04:00 perf: Share Module in Iface Symbol Table This commit modifies the structure of the serialized `SymbolTable Name` to then re-use and share the `Module` (both on disk and in memory) across all `Name`s from the same module. The new structure looks like: <total name count> $modules.size for (mod, names) in $modules: $mod $names.size for table_ix, occ in $names $table_ix $occ i.e. we put the module just once, followed by all names in that module. When deserializing, we deserialize the module just once, and all the following `Name`s are constructed with a pointer to that same decoded `Module`. In `hoogle-test`, we must use `DNameEnv` rather than `Map Name`, otherwise the output fixities order was susceptible to changes in the uniques assigned to each Names, which is not stable. Fixes #27401 ------------------------- Metric Decrease: InstanceMatching LinkableUsage01 LinkableUsage02 hard_hole_fits ------------------------- - - - - - 412f1675 by Simon Hengel at 2026-06-26T20:55:41-04:00 Rename `MCDiagnostic` to `InternalMCDiagnostic` `MCDiagnostic` is meant to be used for compiler diagnostics. Any code that creates `MCDiagnostic` directly, without going through `GHC.Driver.Errors.printMessage`, sidesteps `-fdiagnostics-as-json` (see e.g. !14616, !14475, !14492 !14548). To avoid this in the future, this change more narrowly controls who creates `MCDiagnostic` (see #24113). - - - - - 6f212121 by Facundo Domínguez at 2026-06-26T20:56:27-04:00 Encapsulate options of occurAnalysePgm in a record - - - - - adfbb179 by Facundo Domínguez at 2026-06-26T20:56:27-04:00 Allow to configure the occurrence analyser to retain some dead bindings This is needed by plugins that are the only consumers of a binding which is otherwise unused in the program. See Note [Controlling elimination of dead bindings in occurrence analysis] added in this commit, or https://gitlab.haskell.org/ghc/ghc/-/issues/27240 for more discussion. - - - - - c745b11f by Copilot at 2026-06-26T20:56:27-04:00 Address documentation feedback - - - - - 2c2a4a2a by Copilot at 2026-06-26T20:56:27-04:00 Keep the imp_rules parameter of occurPgmAnalysePgm and add occ_opts to OccEnv - - - - - e2262b0e by Copilot at 2026-06-26T20:56:27-04:00 Strengthen T27240.hs with a binding that should be removed - - - - - 5f9d9268 by Copilot at 2026-06-26T20:56:27-04:00 Move the reference #27240 to a related paragraph - - - - - d86d2644 by Simon Hengel at 2026-06-26T20:57:10-04:00 Remove deprecated flag `-ddump-json` (see #24113) This was first deprecated in 9.10.1. - - - - - 3b15ff03 by Simon Jakobi at 2026-06-27T18:48:34+02:00 Tweak mk_mod_usage_info * Use O(log n) `elemModuleEnv` instead of O(n) `elem` to filter the direct imports. * Use `nonDetModuleEnvKeys` to avoid sorting the ent_map keys twice. * Prepend the presumably shorter list when creating all_mods with `(++)`. Actually this eliminates the `(++)` entirely, as it seems to fuse with the `filter` expression. As a result there is a tiny speed-up when generating the .hi-files for modules with many imports. None of the changes affect compilation determinism as the module list is explicitly sorted to ensure a canonical order. - - - - - 2d0fd154 by Alan Zimmerman at 2026-06-29T11:44:00-04:00 EPA: Remove LocatedC / SrcSpanAnnC This is part of a cleanup of the zoo of SrcSpanAnnXXX types for exact print annotations. This one removes SrcSpanAnnC used for storing exact print annotations for contexts. It replaces it with an explicit `HsContext` data type that carries the annotations and the context. So, replace type HsContext pass = [LHsType pass] with type HsContext pass = HsContextDetails pass (LHsType pass) data HsContextDetails pass arg = HsContext { hsc_ext :: !(XHsContext pass) , hsc_ctxt :: [arg] } | XHsContextDetails !(XXHsContextDetails pass) We need the parameterised HsContextDetails because it is used both for HsQual carrying 'LHsExpr p' and "normal" contexts carrying 'LHsType p'. - - - - - 065f1ad1 by Recursion Ninja at 2026-06-30T12:37:12+00:00 Decoupling 'L.H.S' from 'GHC.Types.SourceText' * Migrated 'IntegralLit' to 'L.H.S.Lit'. * Migrated 'FractionalLit' to 'L.H.S.Lit'. * Migrated 'StringLiteral' to 'L.H.S.Lit'. * Added TTG extension points to the types above. * Added nice export list to 'GHC.Hs.Lit'. * Added 'rnOverLitVal' and 'tcOverLitVal' functions to 'GHC.Hs.Lit'. * Added instance 'Anno (StringLiteral (GhcPass p)) = SrcSpanAnnN' * Moved [Notes] about 'SourceText' from 'L.H.S.*' to 'GHC.*'. * Removed all references to 'SourceText' from 'L.H.S'. * Removed the trailing comma record field from 'StringLiteral' * Renamed exported functions for nomenclature consistency. * Deprecated the renamed functions Fixes #26953 - - - - - aac0d693 by Recursion Ninja at 2026-06-30T12:37:12+00:00 Monomorphising GHC pass parameters where appropriate - - - - - 116 changed files: - + changelog.d/add_can_drop_to_occurence_analyser - + changelog.d/remove-ddump-json-flag - compiler/GHC/Builtin/Utils.hs - compiler/GHC/Core/Opt/OccurAnal.hs - compiler/GHC/Core/Opt/Simplify.hs - compiler/GHC/Core/SimpleOpt.hs - compiler/GHC/Driver/Config.hs - compiler/GHC/Driver/Errors.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Main/Passes.hs - compiler/GHC/Driver/Pipeline.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Binds.hs - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Hs/Expr.hs - compiler/GHC/Hs/Instances.hs - compiler/GHC/Hs/Lit.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Expr.hs - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Match/Literal.hs - compiler/GHC/HsToCore/Monad.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Pmc/Solver/Types.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/HsToCore/Usage.hs - compiler/GHC/Iface/Binary.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Warnings.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/HaddockLex.x - compiler/GHC/Parser/Lexer.x - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Parser/PostProcess/Haddock.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/HsType.hs - compiler/GHC/Rename/Lit.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Rename/Names.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Rename/Utils.hs - compiler/GHC/Tc/Deriv.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/Head.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Sig.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/Tc/Utils/Instantiate.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/ThToHs.hs - compiler/GHC/Types/Error.hs - − compiler/GHC/Types/Error.hs-boot - compiler/GHC/Types/PkgQual.hs - compiler/GHC/Types/SourceError.hs - compiler/GHC/Types/SourceText.hs - compiler/GHC/Unit/Module/Env.hs - compiler/GHC/Unit/Module/Warnings.hs - compiler/GHC/Utils/Error.hs - compiler/GHC/Utils/Logger.hs - compiler/Language/Haskell/Syntax/Binds.hs - compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/Language/Haskell/Syntax/Decls/Foreign.hs - compiler/Language/Haskell/Syntax/Expr.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Lit.hs - compiler/Language/Haskell/Syntax/Type.hs - docs/users_guide/debugging.rst - ghc/GHCi/UI.hs - ghc/GHCi/UI/Exception.hs - testsuite/tests/driver/T16167.stderr - − testsuite/tests/driver/T16167.stdout - testsuite/tests/driver/all.T - testsuite/tests/driver/json2.stderr - − testsuite/tests/driver/json_dump.hs - − testsuite/tests/driver/json_dump.stderr - testsuite/tests/ghc-api/T25121_status.stdout - + testsuite/tests/ghc-api/T27240.hs - testsuite/tests/ghc-api/all.T - testsuite/tests/ghc-api/annotations-literals/literals.stdout - testsuite/tests/ghc-api/annotations-literals/parsed.hs - testsuite/tests/overloadedrecflds/should_compile/DRFPatSynExport.stdout - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/parser/should_compile/T15323.stderr - testsuite/tests/printer/Test24533.stdout - testsuite/tests/rename/should_compile/T1792_imports.stdout - testsuite/tests/rename/should_compile/T18264.stdout - testsuite/tests/rename/should_compile/T4239.stdout - testsuite/tests/showIface/DocsInHiFile1.stdout - testsuite/tests/showIface/DocsInHiFileTH.stdout - testsuite/tests/showIface/NoExportList.stdout - testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr - utils/check-exact/ExactPrint.hs - utils/check-exact/Main.hs - utils/check-exact/Preprocess.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/GhcUtils.hs - utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs - utils/haddock/haddock-api/src/Haddock/Interface/Create.hs - utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs - utils/haddock/haddock-api/src/Haddock/Interface/RenameType.hs - utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs - utils/haddock/haddock-api/src/Haddock/Types.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/00568ff76697b50e27ecbd481eb1da7... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/00568ff76697b50e27ecbd481eb1da7... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
recursion-ninja (@recursion-ninja)