[Git][ghc/ghc][wip/spj-reinstallable-base2] Allow GHC.Essentials to be hidden
by sheaf (@sheaf) 27 Jul '26
by sheaf (@sheaf) 27 Jul '26
27 Jul '26
sheaf pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
3de0d935 by sheaf at 2026-07-28T00:26:10+02:00
Allow GHC.Essentials to be hidden
- - - - -
15 changed files:
- compiler/GHC/Builtin.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Unit/External.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/State.hs
- libraries/base/base.cabal.in
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3de0d935d98533fcb348ff65424ad39…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3de0d935d98533fcb348ff65424ad39…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/spj-reinstallable-base2] Allow GHC.Essentials to be hidden
by sheaf (@sheaf) 27 Jul '26
by sheaf (@sheaf) 27 Jul '26
27 Jul '26
sheaf pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
1575eb10 by sheaf at 2026-07-28T00:18:35+02:00
Allow GHC.Essentials to be hidden
- - - - -
16 changed files:
- compiler/GHC/Builtin.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Unit/External.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/State.hs
- libraries/base/base.cabal.in
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- utils/dump-decls/Main.hs
Changes:
=====================================
compiler/GHC/Builtin.hs
=====================================
@@ -225,8 +225,7 @@ How known-occ entities work
This is a big reason for (KnownOccNameInvariant): an export list cannot have two
entities with the same OccName.
- When GHC wants to find GHC.Essentials, it just looks for it in the same
- way as any other import.
+ See Note [Finding GHC.Essentials] for how GHC finds the GHC.Essentials module.
* There are three flags that control the treatment of known entities:
-frebindable-known-names
@@ -412,10 +411,9 @@ To make `wombat` into a known-key name, do the following.
* Just like for known-occ names above, in any module in `base` or `ghc-internal` (which
are compiled with -frebindable-known-names), ensure that `wombat` is
in scope by saying `import M( wombat )`.
--}
-{- Note [Known entities and reinstallable base]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Note [Known entities and reinstallable base]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The design of known-entities in GHC, described in Note [Overview of known entities],
is carefully crafted to support a single version of GHC to compile different
versions of base, even though GHC itself is compiled against a fixed version of
@@ -453,6 +451,45 @@ Let's compare two examples: `coerce` and `enumFromTo`.
`enumFromTo` (see `GHC.Iface.Load.lookupKnownOccName`). This means GHC never
needs to know where precisely `enumFromTo` is defined, allowing it to be
defined anywhere (wherever in `base`, or in a module imported by `base`).
+
+Note [Finding GHC.Essentials]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+As explained in Note [Overview of known entities], when compiling a module that
+does not enable -frebindable-known-names, GHC resolves known entities by looking
+them up in GHC.Essentials. Every module that does not enable
+-frebindable-known-names therefore acquires an implicit dependency on GHC.Essentials.
+
+As GHC.Essentials is an implementation detail, we would really rather not insist
+that it be an exposed module (e.g. of 'base'). So we must ensure that GHC can
+still adequately resolve the implicit dependency even if GHC.Essentials is hidden.
+
+Hidden-ness only ever obstructs the resolution of a 'ModuleName' into a 'Module'.
+Thus, to allow GHC.Essentials to be hidden (not available via user-written
+imports) while retaining the ability to resolve known entities, we follow the
+following plan:
+
+ (FindEssentials1)
+ 'GHC.Unit.Finder.findModuleWithIsBoot' has special logic to resolve a
+ possibly hidden GHC.Essentials module, using 'GHC.Unit.Finder.findEssentialsModule'.
+
+ Every code path that needs to find GHC.Essentials despite it being hidden
+ goes through here, including:
+
+ - downsweep GHC.Driver.Downsweep.summariseModuleDispatch
+ - ghc -M GHC.Driver.MakeFile.findDependency
+ - recompilation checking GHC.Iface.Recomp.checkDependencies
+
+ Source-written imports go via 'GHC.Iface.Load.loadSrcInterface_maybe',
+ which uses 'GHC.Unit.Finder.findImportedModule', which rejects hidden modules.
+
+ (FindEssentials2)
+ 'GHC.Unit.Module.Deps.mkDependencies' records the unit that provides
+ GHC.Essentials, so that the implicit dependency appears in the interface file.
+
+ (FindEssentials3)
+ 'GHC.Driver.Make.warnUnusedPackages' has a special case to ensure that we
+ don't flag up the unit that provides GHC.Essentials as unused when it is
+ only implicitly imported.
-}
{-
=====================================
compiler/GHC/Driver/Downsweep.hs
=====================================
@@ -1374,9 +1374,8 @@ summariseModuleDispatch k hsc_env' home_unit is_boot (L _ wanted_mod) mb_pkg exc
hsc_env = hscSetActiveHomeUnit home_unit hsc_env'
find_it :: IO SummariseResult
-
find_it = do
- found <- findImportedModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg
+ found <- findModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg
case found of
Found location mod
| moduleUnitId mod `Set.member` hsc_all_home_unit_ids hsc_env ->
=====================================
compiler/GHC/Driver/MakeFile.hs
=====================================
@@ -305,8 +305,8 @@ findDependency :: HscEnv
-> IO (Either (MsgEnvelope GhcMessage) (Maybe FilePath)) -- Interface file
findDependency hsc_env srcloc pkg imp is_boot include_pkg_deps = do
-- Find the module; this will be fast because
- -- we've done it once during downsweep
- r <- findImportedModuleWithIsBoot hsc_env imp is_boot pkg
+ -- we've done it once during downsweep.
+ r <- findModuleWithIsBoot hsc_env imp is_boot pkg
case r of
Found loc _
-- Home package: just depend on the .hi or hi-boot file
=====================================
compiler/GHC/HsToCore.hs
=====================================
@@ -106,7 +106,7 @@ import GHC.Unit.Module.Deps
import Data.List (partition)
import Data.IORef
import GHC.Types.Unique.FM
-import GHC.Iface.Load (KnownEntitySource(..), lookupKnownKeyName, lookupKnownKeysModule)
+import GHC.Iface.Load (KnownEntitySource(..), lookupKnownKeyName, essentialsUnitId)
import GHC.HsToCore.Types (DsGblEnv(..))
{-
@@ -228,12 +228,12 @@ deSugar hsc_env
; let pluginModules = map lpModule (loadedPlugins (hsc_plugins hsc_env))
home_unit = hsc_home_unit hsc_env
- ; essentials_mod <- liftIO $ lookupKnownKeysModule hsc_env dflags
+ ; essentials_uid <- liftIO $ essentialsUnitId hsc_env dflags
; let deps = mkDependencies home_unit
(tcg_mod tcg_env)
(tcg_imports tcg_env)
(map mi_module pluginModules)
- (moduleUnitId <$> essentials_mod)
+ essentials_uid
; safe_mode <- finalSafeMode dflags tcg_env
=====================================
compiler/GHC/Iface/Errors/Ppr.hs
=====================================
@@ -210,7 +210,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
-- package flags when making suggestions. ToDo: if the original package
-- also has a reexport, prefer that one
pp_sugg (SuggestVisible m mod o) = ppr m <+> provenance o
- where provenance ModHidden = empty
+ where provenance (ModHidden {}) = empty
provenance (ModUnusable _) = empty
provenance (ModOrigin{ fromOrigUnit = e,
fromExposedReexport = res,
@@ -227,7 +227,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
<+> ppr mod)
| otherwise = empty
pp_sugg (SuggestHidden m mod o) = ppr m <+> provenance o
- where provenance ModHidden = empty
+ where provenance (ModHidden {}) = empty
provenance (ModUnusable _) = empty
provenance (ModOrigin{ fromOrigUnit = e,
fromHiddenReexport = rhs })
@@ -261,7 +261,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
where
pprMod (m, o) = text "it is bound as" <+> ppr m <+>
text "by" <+> pprOrigin m o
- pprOrigin _ ModHidden = panic "cantFindErr: bound by mod hidden"
+ pprOrigin _ (ModHidden {}) = panic "cantFindErr: bound by mod hidden"
pprOrigin _ (ModUnusable _) = panic "cantFindErr: bound by mod unusable"
pprOrigin m (ModOrigin e res _ f) = sep $ punctuate comma (
if e == Just True
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -24,7 +24,7 @@ module GHC.Iface.Load (
lookupKnownKeyThing, lookupKnownKeyName,
lookupKnownOccThing, lookupKnownOccName,
loadKnownKeyOccMaps, lookupKnownGRE,
- lookupKnownKeysMap, lookupKnownKeysModule,
+ lookupKnownKeysMap, essentialsUnitId,
-- RnM/TcM functions
loadModuleInterface, loadModuleInterfaces,
@@ -302,13 +302,14 @@ loadKnownKeyOccMaps
-- We don't have a KnownKeyOccMap yet, so create it
-- from the interface file for KnownKeyName
do { hsc_env <- getTopEnv
- ; mb_res <- liftIO $ findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
- ; case mb_res of
- Found _ mod -> Succeeded <$> build_maps mod
- fr -> return (Failed (CantFindEssentials
- (cannotFindModule hsc_env eSSENTIALS_NAME fr)
- UnknownLoadEssentialsReason))
- } } }
+ ; res <- liftIO $ getEssentialsModule hsc_env
+ ; case res of
+ Succeeded mod -> Succeeded <$> build_maps mod
+ Failed err ->
+ return $ Failed $
+ CantFindEssentials err UnknownLoadEssentialsReason
+ }}}
+
where
doc = text "Need interface for KnownKeyNames"
@@ -372,23 +373,39 @@ checkKnownKeyNamesIface known_key_names_occ_map
Just name -> getOccName name /= occ
#endif
--- | Lookup the module exporting the canonical known-entities definitions (GHC.Essentials)
-lookupKnownKeysModule :: HscEnv -> DynFlags {-^ Module dyn flags -} -> IO (Maybe Module)
-lookupKnownKeysModule hsc_env dflags = do
- eps <- hscEPS hsc_env
- case eps_known_keys eps of
- Just (_, kk_mod) -> return (Just kk_mod)
- Nothing -> do
- found_essentials <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
- let rebindable_kn = gopt Opt_RebindableKnownNames dflags
- let essentials_uid
- | rebindable_kn = return Nothing
- | Found _ mod <- found_essentials = return (Just mod)
- | fr <- found_essentials = do
- throwOneError (initSourceErrorContext dflags) $
- mkPlainErrorMsgEnvelope noSrcSpan $ GhcDriverMessage $ DriverInterfaceError $
- CantFindEssentials (cannotFindModule hsc_env eSSENTIALS_NAME fr) LookingForEssentialsModule
- essentials_uid
+-- | Identify the 'GHC.Essentials' module to use.
+getEssentialsModule :: HscEnv -> IO (MaybeErr MissingInterfaceError Module)
+getEssentialsModule hsc_env
+ = do { fr <- findEssentialsModule hsc_env
+ ; return $ case fr of
+ Found _ mod -> Succeeded mod
+ _ -> Failed $ cannotFindModule hsc_env eSSENTIALS_NAME fr }
+
+-- | Find the unit that provides the 'GHC.Essentials' module that is
+-- implicitly depended on.
+--
+-- 'Nothing' when @-frebindable-known-names@ is on, as in that case there is
+-- no implicit dependency.
+--
+-- See Note [Finding GHC.Essentials] in GHC.Builtin.
+essentialsUnitId :: HscEnv -> DynFlags {-^ Module dyn flags -} -> IO (Maybe UnitId)
+essentialsUnitId hsc_env dflags
+ | gopt Opt_RebindableKnownNames dflags
+ = return Nothing
+ | otherwise
+ = do { eps <- hscEPS hsc_env
+ ; case eps_known_keys eps of
+ -- We already resolved it: re-use the cached value.
+ Just (_, kk_mod) -> return (Just (moduleUnitId kk_mod))
+ Nothing ->
+ do { res <- getEssentialsModule hsc_env
+ ; case res of
+ Succeeded mod -> return (Just (moduleUnitId mod))
+ Failed err ->
+ throwOneError (initSourceErrorContext dflags) $
+ mkPlainErrorMsgEnvelope noSrcSpan $
+ GhcDriverMessage $ DriverInterfaceError $
+ CantFindEssentials err LookingForEssentialsModule } }
{- *********************************************************************
* *
=====================================
compiler/GHC/Iface/Make.hs
=====================================
@@ -244,12 +244,12 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary mb_program mb_modBreaks
= do let pluginModules = map lpModule (loadedPlugins (hsc_plugins hsc_env))
let home_unit = hsc_home_unit hsc_env
let dflags = ms_hspp_opts mod_summary
- essentials_mod <- liftIO $ lookupKnownKeysModule hsc_env dflags
+ essentials_uid <- liftIO $ essentialsUnitId hsc_env dflags
let deps = mkDependencies home_unit
(tcg_mod tc_result)
(tcg_imports tc_result)
(map mi_module pluginModules)
- (moduleUnitId <$> essentials_mod)
+ essentials_uid
usage <- mkRecompUsageInfo hsc_env tc_result
docs <- extractDocs dflags tc_result
=====================================
compiler/GHC/Iface/Recomp.hs
=====================================
@@ -638,7 +638,8 @@ checkMergedSignatures hsc_env mod_summary self_recomp = do
checkDependencies :: HscEnv -> ModSummary -> ModIface -> IfG RecompileRequired
checkDependencies hsc_env summary iface
= do
- res_normal <- classify_import (findImportedModule hsc_env)
+ -- See (FindEssentials2) in Note [Finding GHC.Essentials] in GHC.Builtin.
+ res_normal <- classify_import (\mod pkg -> findModuleWithIsBoot hsc_env mod NotBoot pkg)
([(st, p, m) | (st, p, m) <- (ms_textual_imps summary)]
++
[(NormalLevel, NoPkgQual, m) | m <- ms_srcimps summary ])
=====================================
compiler/GHC/Unit/External.hs
=====================================
@@ -156,6 +156,12 @@ data ExternalPackageState
eps_known_keys :: Maybe (KnownKeyNameMaps, Module),
-- ^ See Note [Overview of known entities].
-- Caches the 'Module' where known entities are defined.
+ --
+ -- BEWARE: there is a single 'ExternalPackageState' for
+ -- the whole session, so this caches a single 'GHC.Essentials'
+ -- for all home units. If two home units are compiled
+ -- against two different units both providing GHC.Essentials,
+ -- whichever is resolved first will be used for both.
eps_inst_env :: !PackageInstEnv, -- ^ The total 'InstEnv' accumulated
-- from all the external-package modules
=====================================
compiler/GHC/Unit/Finder.hs
=====================================
@@ -14,7 +14,8 @@ module GHC.Unit.Finder (
FinderCache(..),
initFinderCache,
findImportedModule,
- findImportedModuleWithIsBoot,
+ findModuleWithIsBoot,
+ findEssentialsModule,
findPluginModule,
findExactModule,
findHomeModule,
@@ -43,6 +44,7 @@ import GHC.Data.OsPath
import GHC.Unit.Env
import GHC.Unit.Types
+import GHC.Builtin.Modules( eSSENTIALS_NAME )
import GHC.Unit.Module
import GHC.Unit.Module.Graph
(
@@ -191,11 +193,45 @@ findImportedModule hsc_env mod pkg_qual =
let home_module_name_providers_map = mgHomeModuleNameProvidersMap (hsc_mod_graph hsc_env)
findImportedModuleNoHsc fc fopts (hsc_unit_env hsc_env) home_module_name_providers_map mb_home_unit mod pkg_qual
-findImportedModuleWithIsBoot :: HscEnv -> ModuleName -> IsBootInterface -> PkgQual -> IO FindResult
-findImportedModuleWithIsBoot hsc_env mod is_boot pkg_qual = do
- res <- findImportedModule hsc_env mod pkg_qual
- case (res, is_boot) of
- (Found loc mod, IsBoot) -> return (Found (addBootSuffixLocn loc) mod)
+-- | Resolve a 'ModuleName' into a 'Module'.
+--
+-- Use this wherever GHC resolves a module's dependencies.
+--
+-- Resolving a user-written import must use 'findImportedModule' instead.
+findModuleWithIsBoot :: HscEnv -> ModuleName -> IsBootInterface -> PkgQual -> IO FindResult
+findModuleWithIsBoot hsc_env mod_name is_boot pkg_qual
+ -- Allow GHC.Essentials to be found even when it is hidden.
+ -- See (FindEssentials1) in Note [Finding GHC.Essentials] in GHC.Builtin.
+ | mod_name == eSSENTIALS_NAME
+ , NotBoot <- is_boot
+ = findEssentialsModule hsc_env
+ | otherwise
+ = do res <- findImportedModule hsc_env mod_name pkg_qual
+ case (res, is_boot) of
+ (Found loc mod, IsBoot) -> return (Found (addBootSuffixLocn loc) mod)
+ _ -> return res
+
+-- | Find 'GHC.Essentials' (allowing it to be a hidden module of its unit).
+--
+-- See Note [Finding GHC.Essentials] in GHC.Builtin.
+findEssentialsModule :: HscEnv -> IO FindResult
+findEssentialsModule hsc_env = do
+ res <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
+ case res of
+ NotFound {}
+ | Just mod <- lookupModuleEvenIfHidden (hsc_units hsc_env) eSSENTIALS_NAME
+ -> do let im = fst (getModuleInstantiation mod)
+ r <- findExactModule hsc_env im NotBoot
+ return $ case r of
+ InstalledFound loc -> Found loc mod
+ InstalledNoPackage _ -> NoPackage (moduleUnit mod)
+ InstalledNotFound fps _ ->
+ NotFound { fr_paths = fmap unsafeDecodeUtf fps
+ , fr_pkg = Just (moduleUnit mod)
+ , fr_pkgs_hidden = []
+ , fr_mods_hidden = []
+ , fr_unusables = []
+ , fr_suggestions = [] }
_ -> return res
findImportedModuleNoHsc
=====================================
compiler/GHC/Unit/State.hs
=====================================
@@ -32,12 +32,14 @@ module GHC.Unit.State (
listVisibleModuleNames,
lookupModuleInAllUnits,
lookupModuleWithSuggestions,
+ lookupModuleEvenIfHidden,
lookupModulePackage,
lookupPluginModuleWithSuggestions,
requirementMerges,
LookupResult(..),
ModuleSuggestion(..),
ModuleOrigin(..),
+ HiddenModuleUnit(..),
UnusableUnit(..),
UnusableUnitReason(..),
pprReason,
@@ -81,6 +83,7 @@ import GHC.Platform.Ways
import GHC.Unit.Database
import GHC.Unit.Info
import GHC.Unit.Ppr
+import GHC.Builtin.Modules( eSSENTIALS_NAME )
import GHC.Unit.Types
import GHC.Unit.Module
import GHC.Unit.Home
@@ -168,10 +171,8 @@ import Control.Applicative
-- it could have come into scope. Warning: don't use the record functions,
-- they're partial!
data ModuleOrigin =
- -- | Module is hidden, and thus never will be available for import.
- -- (But maybe the user didn't realize), so we'll still keep track
- -- of these modules.)
- ModHidden
+ -- | The module is hidden (thus not available for a user-written import).
+ ModHidden !HiddenModuleUnit
-- | Module is unavailable because the unit is unusable.
| ModUnusable !UnusableUnit
@@ -193,6 +194,11 @@ data ModuleOrigin =
, fromPackageFlag :: Bool
}
+-- | Is the unit providing a hidden module itself visible in this compilation?
+data HiddenModuleUnit
+ = HiddenModInVisibleUnit
+ | HiddenModInHiddenUnit
+
-- | A unusable unit module origin
data UnusableUnit = UnusableUnit
{ uuUnit :: !Unit -- ^ Unusable unit
@@ -201,7 +207,7 @@ data UnusableUnit = UnusableUnit
}
instance Outputable ModuleOrigin where
- ppr ModHidden = text "hidden module"
+ ppr (ModHidden {}) = text "hidden module"
ppr (ModUnusable _) = text "unusable module"
ppr (ModOrigin e res rhs f) = sep (punctuate comma (
(case e of
@@ -255,7 +261,7 @@ instance Monoid ModuleOrigin where
-- | Is the name from the import actually visible? (i.e. does it cause
-- ambiguity, or is it only relevant when we're making suggestions?)
originVisible :: ModuleOrigin -> Bool
-originVisible ModHidden = False
+originVisible (ModHidden {}) = False
originVisible (ModUnusable _) = False
originVisible (ModOrigin b res _ f) = b == Just True || not (null res) || f
@@ -1819,7 +1825,11 @@ mkModuleNameProvidersMap logger cfg pkg_map vis_map =
esmap = listToUFM (es False) -- parameter here doesn't matter, orig will
-- be overwritten
- hiddens = [(m, mkModMap pk m ModHidden) | m <- hidden_mods]
+ hiddens = [(m, mkModMap pk m (ModHidden hidden_mod_unit)) | m <- hidden_mods]
+
+ hidden_mod_unit
+ | b || not (null rns) = HiddenModInVisibleUnit
+ | otherwise = HiddenModInHiddenUnit
pk = mkUnit pkg
unit_lookup uid = lookupUnit' (unitConfigAllowVirtual cfg) pkg_map uid
@@ -1940,8 +1950,36 @@ lookupModulePackage pkgs mn mfs =
_ -> Nothing
+ -- If we implicitly depend on GHC.Essentials, mark the unit providing it
+ -- as used. See (FindEssentials4) in Note [Finding GHC.Essentials] in GHC.Builtin.
+ LookupHidden {}
+ | mn == eSSENTIALS_NAME
+ -> (\m -> [m]) <$> (lookupUnit pkgs . moduleUnit =<< lookupModuleEvenIfHidden pkgs mn)
+
_ -> Nothing
+-- | Look up the module of this name provided by a /visible/ unit, even when
+-- that module is hidden, i.e. is not in its unit's @exposed-modules@.
+--
+-- This consults unit metadata only. Unlike "GHC.Unit.Finder", it does not
+-- look for the module's interface file on disk, so it can answer \"which unit
+-- provides this module?\" without requiring that unit to have been built yet.
+--
+-- An exposed module always takes precedence over a hidden one, and a module
+-- of a hidden unit is never returned.
+lookupModuleEvenIfHidden :: UnitState -> ModuleName -> Maybe Module
+lookupModuleEvenIfHidden pkgs mod_name =
+ case lookupModuleWithSuggestions pkgs mod_name NoPkgQual of
+ LookupFound m _ -> Just m
+ LookupHidden _ mods_hidden
+ | [m] <- [ m | (m, ModHidden HiddenModInVisibleUnit) <- mods_hidden ]
+ -> Just m
+ | otherwise
+ -> Nothing
+ LookupMultiple {} -> Nothing
+ LookupUnusable {} -> Nothing
+ LookupNotFound {} -> Nothing
+
lookupPluginModuleWithSuggestions :: UnitState
-> ModuleName
-> PkgQual
@@ -1970,7 +2008,7 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn
let origin = filterOrigin mb_pn (mod_unit m) origin0
x = (m, origin)
in case origin of
- ModHidden
+ ModHidden {}
-> (hidden_pkg, x:hidden_mod, unusable, exposed)
ModUnusable _
-> (hidden_pkg, hidden_mod, x:unusable, exposed)
@@ -2003,8 +2041,8 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn
filterOrigin (OtherPkg u) pkg o =
let match_pkg p = u == unitId p
in case o of
- ModHidden
- | match_pkg pkg -> ModHidden
+ ModHidden {}
+ | match_pkg pkg -> o
| otherwise -> mempty
ModUnusable _
| match_pkg pkg -> o
=====================================
libraries/base/base.cabal.in
=====================================
@@ -219,7 +219,6 @@ Library
, GHC.Integer.Logarithms
, GHC.IsList
, GHC.Ix
- , GHC.Essentials
, GHC.List
, GHC.Maybe
, GHC.MVar
@@ -307,6 +306,7 @@ Library
other-modules:
Data.List.NubOrdSet
+ GHC.Essentials
System.CPUTime.Unsupported
System.CPUTime.Utils
if os(windows)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -5295,10 +5295,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event where
-- Safety: Safe
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -5295,10 +5295,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event where
-- Safety: Safe
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -5340,10 +5340,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event.TimeOut where
-- Safety: None
=====================================
utils/dump-decls/Main.hs
=====================================
@@ -68,7 +68,6 @@ ignoredModules =
map mkModuleName $ concat
[ unstableModules
, platformDependentModules
- , internalModules
]
where
unstableModules =
@@ -81,8 +80,6 @@ ignoredModules =
, "GHC.Num.Backend"
, "GHC.Num.Backend.Selected"
]
- internalModules =
- [ "GHC.Essentials" ]
ignoredOccNames :: [OccName]
ignoredOccNames =
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1575eb10deeedd07a263d476e37d33a…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1575eb10deeedd07a263d476e37d33a…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/az/exactprint-annotation-rationalisation] 31 commits: ci: Use shallow submodule clones by default
by Alan Zimmerman (@alanz) 27 Jul '26
by Alan Zimmerman (@alanz) 27 Jul '26
27 Jul '26
Alan Zimmerman pushed to branch wip/az/exactprint-annotation-rationalisation at Glasgow Haskell Compiler / GHC
Commits:
f586c885 by Simon Jakobi at 2026-07-24T18:05:00-04:00
ci: Use shallow submodule clones by default
Limit submodule clones to depth one to reduce CI checkout costs. Keep
fetching full submodule history for the submodule lint jobs, which
inspect commits across a range.
Assisted-by: gpt-5.6-sol via Codex CLI
- - - - -
306120d2 by Duncan Coutts at 2026-07-24T18:05:43-04:00
Fix flaky test T3994 on FreeBSD
On current FreeBSD versions, calling getpgid on a zombie process fails.
In T3994, if we're really unlucky with delays and scheduling then we can
end up in exactly that situation.
Just catch that specific exception and ignore it. It's rare, and not our
fault.
- - - - -
7b116a0b by Cheng Shao at 2026-07-24T18:06:24-04:00
ci: add missing workaround for docker permissions in lint jobs
Some lint jobs use ci-images with default user `ghc`, and the gitlab
ci docker executor requires the `sudo chown` workaround to fix
workspace directory permission issue. This patch adds the missing
workarounds for the lint jobs. Fixes #27554.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
815149f3 by Andrzej Rybczak at 2026-07-25T15:06:43+00:00
Add -Wdefaulted-callstack
Adds a new warning, -Wdefaulted-callstack, which warns when an implicit
CallStack parameter is defaulted to the empty stack. In particular, this
includes call sites where a function with a HasCallStack constraint is called
from a definition that does *not* provide one. At such call sites the call stack
is cut off and does not include the enclosing definition's callers, which can be
a source of surprise if the user wants complete call stacks.
Closes #27077.
- - - - -
f6f2343f by Zubin Duggal at 2026-07-25T17:40:51-04:00
UniqueDFM: alter should preserve insertion order
Before it always inserting new elements at the end.
This is problematic because instances get inserted into the map with
`alterF`, which can change ordering of how instances are printed
with `:info` depending on the order in which we consult interfaces
I expect `alter id k = id` and `alter (fmap f) k = adjust f k`. Moving keys to
the end breaks that (`adjust` already preserves position).
Fixes #27532
- - - - -
f2347216 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: ClsInstDecl with decls as [LHsDecl GhcPs] in GhcPs
Similar to 4fdfe75731e01dad7d7fa474c2703d0d3965afb1, this commit
changes the as-parsed representation of class instance declarations to
[LHsDecl GhcPs], and only separates them by type from the renamer onward.
This also allows us to remove all the AnnSortKey machinery for exact
printing, as it is now no longer needed.
- - - - -
fba59977 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedP from OverlapMode
- - - - -
e818b108 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedP from CType
- - - - -
8babde29 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedP, last use in WarningTxt
- - - - -
0c230543 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedE from WarningCategory
- - - - -
ad62582a by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocateE from XCImport and XCExport
- - - - -
f86db830 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedE from HsRecFields dot
- - - - -
4883ed92 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedE completely, last usage for pats
- - - - -
58219f51 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove AnnList (EpToken "where") usages
This is moving toward removing the parameter from AnnList completely
- - - - -
a3b540e9 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA remove AnnList (EpToken "rec") usages
- - - - -
e6a10acd by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove last parameterised AnnList usage (EpaLocation)
Also remove the parameter
- - - - -
fd235b27 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
TTG: Add extension points to BooleanFormula
They are currently unused, but will be used for exact print annotations next
- - - - -
955829b7 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Remove LocatedBC / SrcSpanBF
- - - - -
97f1029a by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: remove unused addTrailingAnnToL. Squash appropriately
- - - - -
aa82ab90 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPS: Remove NoEpTok/NoEpUniTok, using an unhelpful SrcSpan instead
Also introduce helper functions noEpTok and noEpUniTok to serve
as simple replacements in code inserting an token annotation without
location information.
- - - - -
770924eb by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Some haddock processing tweaks
- - - - -
ab69f608 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
Some haddock exactprint tests
- - - - -
2a74cfde by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: When adding comments honour trailing anns
- - - - -
0a1c7676 by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA: Uses Parsers.parseModule for exactprint tests
This is the advertised way to parse for use for exact printing in the
ghc-exactprint library, make sure we test using it.
- - - - -
38d9008f by Alan Zimmerman at 2026-07-26T13:38:48+01:00
EPA Fix HsCmdDo exact print with comments
TODO: add test based on proc-do-complex-four-out.hs
- - - - -
92d8e2db by Alan Zimmerman at 2026-07-27T19:48:12+01:00
EPA: Add comments about remaining Anno SrcSpan instances
- - - - -
c2b2adc0 by Alan Zimmerman at 2026-07-27T23:06:50+01:00
EPA: First pass implementation of HsList, for ClassDecls
Just as a straight list replacement to start with, no payload.
This shows the scope and invasiveness of the initial change
- - - - -
6c8646d3 by Alan Zimmerman at 2026-07-27T23:07:56+01:00
Enable ppr test for Haddock1. It currently fails
- - - - -
2b779f0c by Alan Zimmerman at 2026-07-27T23:07:56+01:00
WIP on removing NoEpAnn. Likely abandon
- - - - -
72c6a1a3 by Alan Zimmerman at 2026-07-27T23:07:56+01:00
EPA: Add an overview doc for exact printing
- - - - -
2199059c by Simon Peyton Jones at 2026-07-27T23:07:56+01:00
Added an intro section
- - - - -
139 changed files:
- .gitlab-ci.yml
- + ExactPrint.md
- + changelog.d/27532
- + changelog.d/warn-defaulted-callstack
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/BooleanFormula.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Decls/Overlap.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension/Pass.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Warnings.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Class.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/Unique/DFM.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/BooleanFormula.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- docs/users_guide/using-warnings.rst
- libraries/base/changelog.md
- libraries/base/src/GHC/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs
- testsuite/tests/ghc-api/T25121_status.stdout
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/ghci/T16793/T16793.stdout
- testsuite/tests/ghci/T18060/T18060.stdout
- + testsuite/tests/ghci/T27532/Makefile
- + testsuite/tests/ghci/T27532/T27532.stdout
- + testsuite/tests/ghci/T27532/T27532j4.stdout
- + testsuite/tests/ghci/T27532/a.script
- + testsuite/tests/ghci/T27532/all.T
- + testsuite/tests/ghci/T27532/b.script
- + testsuite/tests/ghci/T27532/genT27532Modules
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T4175.stdout
- testsuite/tests/ghci/scripts/T8469.stdout
- testsuite/tests/ghci/scripts/T8535.stdout
- testsuite/tests/ghci/scripts/T9881.stdout
- testsuite/tests/ghci/scripts/ghci020.stdout
- testsuite/tests/ghci/scripts/ghci064.stdout
- testsuite/tests/ghci/should_run/T10145.stdout
- testsuite/tests/ghci/should_run/T18594.stdout
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20718b.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/parser/should_compile/T23315/T23315.stderr
- testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
- testsuite/tests/printer/AnnotationNoListTuplePuns.stdout
- + testsuite/tests/printer/Haddock1.hs
- testsuite/tests/printer/Makefile
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- testsuite/tests/printer/all.T
- testsuite/tests/process/T3994.hs
- testsuite/tests/roles/should_compile/Roles14.stderr
- testsuite/tests/roles/should_compile/Roles3.stderr
- testsuite/tests/roles/should_compile/Roles4.stderr
- testsuite/tests/roles/should_compile/T8958.stderr
- testsuite/tests/typecheck/should_compile/T18406b.stderr
- testsuite/tests/typecheck/should_compile/T18529.stderr
- + testsuite/tests/typecheck/should_compile/WarnDefaultedCallStack.hs
- + testsuite/tests/typecheck/should_compile/WarnDefaultedCallStack.stderr
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T5300.stderr
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Parsers.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.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/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.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/a15493982e6d2926d6877e095f5355…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a15493982e6d2926d6877e095f5355…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] 3 commits: testsuite: skip runtime stats tests on debugged compilers
by Marge Bot (@marge-bot) 27 Jul '26
by Marge Bot (@marge-bot) 27 Jul '26
27 Jul '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f8e3bee9 by Zubin Duggal at 2026-07-27T17:31:49-04:00
testsuite: skip runtime stats tests on debugged compilers
Debugged flavours build the boot libraries without optimisation, so the
runtime numbers do not match the baselines.
- - - - -
1e326770 by Zubin Duggal at 2026-07-27T17:31:50-04:00
testsuite: mark #20706 tests fragile rather than broken
Whether the static linux linker issues manifest depends on the host
toolchain.
- - - - -
c0b13cbe by Zubin Duggal at 2026-07-27T17:31:50-04:00
testsuite: exclude libnuma from mostly-static
It needs static system libraries (libnuma.a) that many platforms do not
ship.
Fixes #26914
- - - - -
10 changed files:
- testsuite/driver/testlib.py
- testsuite/tests/driver/all.T
- testsuite/tests/driver/mostly-static/Makefile
- testsuite/tests/ghci/T13786/all.T
- testsuite/tests/ghci/linking/all.T
- testsuite/tests/ghci/linking/dyn/all.T
- testsuite/tests/package/T20010/all.T
- testsuite/tests/plugins/all.T
- testsuite/tests/rts/all.T
- testsuite/tests/rts/linker/all.T
Changes:
=====================================
testsuite/driver/testlib.py
=====================================
@@ -878,9 +878,11 @@ def _collect_stats(name: TestName, opts, metrics, deviation: Optional[int],
else:
tag = 'runtime'
- # Compiler performance numbers change when debugging is on, making the results
- # useless and confusing. Therefore, skip if debugging is on.
- if config.compiler_debugged and is_compiler_stats_test:
+ # Performance numbers change when debugging is on, making the results
+ # useless and confusing. This applies to runtime numbers too, since
+ # debugged flavours also build the boot libraries without optimisation.
+ # Therefore, skip if debugging is on.
+ if config.compiler_debugged:
opts.skip = True
# If there are any residency testing metrics then turn on RESIDENCY_OPTS
=====================================
testsuite/tests/driver/all.T
=====================================
@@ -124,7 +124,7 @@ test('static001', [extra_files(['Static001.hs']), only_darwin],
makefile_test, ['static001'])
test('dynHelloWorld',
- [only_ways(['dyn']), when(opsys('linux') and not ghc_dynamic() and not arch('wasm32'), expect_broken(20706))],
+ [only_ways(['dyn']), when(opsys('linux') and not ghc_dynamic() and not arch('wasm32'), fragile(20706))],
compile_and_run,
[''])
=====================================
testsuite/tests/driver/mostly-static/Makefile
=====================================
@@ -24,6 +24,6 @@ mostly-static:
"$(RANLIB)" "test/libtest-1.0.a"
"$(GHC_PKG)" init $(LOCAL_PKGCONF)
"$(GHC_PKG)" --no-user-package-db -f $(LOCAL_PKGCONF) register test/test.pkg -v0
- "$(TEST_HC)" $(TEST_HC_OPTS) --make -static-external -exclude-static-external=c,m,rt,dl,pthread,stdc++,atomic,gmp,ffi,iconv,wsock32,gdi32,winmm,dbghelp,psapi,user32,shell32,mingw32,kernel32,advapi32,mingwex,ws2_32,shlwapi,ole32,rpcrt4,ntdll,ucrt -hide-all-packages -package-db $(LOCAL_PKGCONF)/ -package base -package-id test-1.0 Hello.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make -static-external -exclude-static-external=c,m,rt,dl,pthread,stdc++,atomic,gmp,ffi,iconv,numa,wsock32,gdi32,winmm,dbghelp,psapi,user32,shell32,mingw32,kernel32,advapi32,mingwex,ws2_32,shlwapi,ole32,rpcrt4,ntdll,ucrt -hide-all-packages -package-db $(LOCAL_PKGCONF)/ -package base -package-id test-1.0 Hello.hs
./Hello
$(LDD) Hello | grep libtest || true
=====================================
testsuite/tests/ghci/T13786/all.T
=====================================
@@ -1,4 +1,4 @@
test('T13786',
- [when(unregisterised(), fragile(17018)), req_c, when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ [when(unregisterised(), fragile(17018)), req_c, when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, [])
=====================================
testsuite/tests/ghci/linking/all.T
=====================================
@@ -33,7 +33,7 @@ test('ghcilink005',
unless(doing_ghci, skip),
req_dynamic_lib_support,
req_interp,
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, ['ghcilink005'])
test('ghcilink006',
=====================================
testsuite/tests/ghci/linking/dyn/all.T
=====================================
@@ -3,7 +3,7 @@ setTestOpts(req_dynamic_lib_support)
test('load_short_name', [ extra_files(['A.c'])
, unless(doing_ghci, skip)
, req_c
- , when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))
+ , when(opsys('linux') and not ghc_dynamic(), fragile(20706))
],
makefile_test, ['load_short_name'])
@@ -13,7 +13,7 @@ test('T1407',
pre_cmd('$MAKE -s --no-print-directory compile_libT1407'),
extra_hc_opts('-L"$PWD/T1407dir"'),
js_broken(22359),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, [])
test('T3242',
=====================================
testsuite/tests/package/T20010/all.T
=====================================
@@ -1,4 +1,4 @@
# Test that GHC links to the C++ standard library as expected
# when the system-cxx-std-lib package is used.
test('T20010', req_c, makefile_test, [])
-test('T20010-ghci', [req_c, extra_files(['T20010_c.cpp', 'T20010.hs']), when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))], makefile_test, [])
+test('T20010-ghci', [req_c, extra_files(['T20010_c.cpp', 'T20010.hs']), when(opsys('linux') and not ghc_dynamic(), fragile(20706))], makefile_test, [])
=====================================
testsuite/tests/plugins/all.T
=====================================
@@ -131,7 +131,7 @@ test('T10294a',
pre_cmd('$MAKE -s --no-print-directory -C annotation-plugin package.T10294a TOP={top}')],
makefile_test, [])
-test('frontend01', [extra_files(['FrontendPlugin.hs']), when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+test('frontend01', [extra_files(['FrontendPlugin.hs']), when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, [])
test('T11244',
@@ -368,14 +368,14 @@ test('test-echo-in-line-many-args',
test('plugins-external',
[extra_files(['shared-plugin/']),
pre_cmd('$MAKE -s --no-print-directory -C shared-plugin package.plugins01 TOP={top}'),
- when(opsys('mingw32') or (opsys('linux') and not ghc_dynamic()), expect_broken(20706))],
+ when(opsys('mingw32') or (opsys('linux') and not ghc_dynamic()), fragile(20706))],
makefile_test, [])
test('test-phase-hooks-plugin',
[extra_files(['hooks-plugin/']),
pre_cmd('$MAKE -s --no-print-directory -C hooks-plugin package.test-phase-hooks-plugin TOP={top}'),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
compile,
['-package-db hooks-plugin/pkg.test-phase-hooks-plugin/local.package.conf -fplugin Hooks.PhasePlugin -package hooks-plugin ' + config.plugin_way_flags])
=====================================
testsuite/tests/rts/all.T
=====================================
@@ -524,7 +524,7 @@ test('test-zeroongc', extra_run_opts('-DZ'), compile_and_run, ['-debug'])
test('T13676',
[when(opsys('mingw32'), expect_broken(17447)),
extra_files(['T13676.hs']),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
ghci_script, ['T13676.script'])
test('InitEventLogging',
[ only_ways(['normal'])
=====================================
testsuite/tests/rts/linker/all.T
=====================================
@@ -74,7 +74,7 @@ test('T5435_v_asm_a',
req_rts_linker,
fragile(22970),
when(arch('arm'), expect_broken(17559)),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, ['T5435_v_asm_a'])
# this one just needs to run on linux, as darwin/mingw32 are covered
# by the _a test already.
@@ -84,14 +84,14 @@ test('T5435_v_asm_b',
fragile(22970),
when(arch('arm'), expect_broken(17559)),
when(opsys('darwin') or opsys('mingw32'), skip),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, ['T5435_v_asm_b'])
test('T5435_v_gcc',
[extra_files(['T5435.hs', 'T5435_gcc.c']),
req_rts_linker,
fragile(22970),
when(arch('arm'), expect_broken(17559)),
- when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+ when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, ['T5435_v_gcc'])
test('T5435_dyn_asm',
[extra_files(['T5435.hs', 'T5435_asm.c']),
@@ -152,7 +152,7 @@ test('T7072',
req_rts_linker],
makefile_test, ['T7072'])
-test('T20494', [req_rts_linker, when(opsys('linux') and not ghc_dynamic(), expect_broken(20706))],
+test('T20494', [req_rts_linker, when(opsys('linux') and not ghc_dynamic(), fragile(20706))],
makefile_test, ['T20494'])
test('T20918',
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6cce494a7ec43953c7a949e0d8ce71…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6cce494a7ec43953c7a949e0d8ce71…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] 2 commits: Introduce global unit database cache
by Marge Bot (@marge-bot) 27 Jul '26
by Marge Bot (@marge-bot) 27 Jul '26
27 Jul '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
5d0ab71a by fendor at 2026-07-27T17:31:05-04:00
Introduce global unit database cache
As a first step for better sharing of `UnitInfo` across `UnitEnv`,
we introduce a new datatype called `ExternalUnitDatabases`.
It primarily serves as an in-memory representation of *all*
`UnitDatabase`s across `UnitEnv`. This means, if multiple `HomeUnitEnv`s
depend on the same database, one way or another, we make sure that we
don't parse from disk every time.
Instead, we store the in-memory representation in `ExternalUnitDatabases`.
`ExternalUnitDatabaseCache` is the equivalent of `ExternalUnitState` in
the `UnitEnv`. It is a mutable variable wrapping `ExternalUnitDatabases`.
The mutable `ExternalUnitDatabaseCache` is used in `initUnits` to make
sure we don't parse the same unit database multiple times.
Almost by accident, we change the semantics of `initUnits` to honour
modifications to `packageDBFlags`.
The inability to change `packageDBFlags` while also reusing the already
parsed `UnitDatabase`s was reported in #26423 as a bug.
Hence, we think this behaviour change is warranted and acceptable,
especially since it comes with a breaking change to the `initUnits` API.
Add regression test for #26423
Closes #26423
- - - - -
6cce494a by fendor at 2026-07-27T17:31:05-04:00
Introduce UnitIndex for global external unit caching
`UnitInfo`s have been observed to cause a lot of memory usage in #27500.
Especially with multiple home units, as the same (external) units are
processed from scratch, even though most of the time we end up with
exactly the same `UnitInfo`.
We introduce a `UnitEnv` global cache that allows us to store external
unit information that is used across all `HomeUnitEnv`s.
The most important change in this commit is the introduction of the `UnitIndex`.
It stores a global mapping of `UnitId` -> `UnitInfo`, and `initUnits`
always uses the cached `UnitInfo` entry to populate each
`HomeUnitEnv`'s `UnitState`.
This allows us to ensure the following property:
> Each `UnitInfo` should be alive exactly once in GHC.
All `UnitState`s should reference 'UnitInfo's stored in the 'UnitIndex'.
This ensured by calling 'initUnits' with the 'UnitIndex'.
In addition, the `ExternalUnitDatabases` may also hold a reference
to each on-disk representation of `UnitInfo`.
This means, we impose an hard upper bound on the number of `UnitInfo`s
alive in the GHC session:
> The number of alive `UnitInfo`s closure objects must be the
> sum of all loaded unit database times two.
We add performance regression tests that make sure the number of live
`UnitInfo` cannot exceed this threshold.
Closes #27500
-------------------------
Metric Decrease:
MultiComponentModules
MultiComponentModulesRecomp
MultiComponentModulesRecomp100
mhu-perf
LinkableUsage02
-------------------------
These metrics increases are especially notable, as we are not even
sharing anything big but merely the global package database with 50
entries.
It shows how careful sharing of `UnitInfo` can improve memory usage.
We expect this to be much more notable when the whole cabal package
database is shared across multiple home units.
`LinkableUsage02` metric decreases on unreg and i386 platform, only.
---
Technical details
To share the `UnitInfo`s correctly, it is important that we extract
the `WireMap` into the `UnitIndex`. At the moment of writing, `WireMap`
must be globally the same for all `HomeUnitEnv`s.
This is important, as we could otherwise not cache the "fully-resolved"
`UnitInfo`, as we don't change the `UnitId` or `unitAbiHash` when
resolving wired-in units. Thus, there could be ambiguities, when the
`WireMap` is not the same for all `UnitState`s across the `UnitEnv`.
We consider a `UnitInfo` fully-resolved, if wired-in units have been
updated, the `UnitInfo` has been validated and variables in the unit
config, such as `${pkgroot}` have been resolved.
Updating the wired-in units requires the `WireMap` to be globally the
same.
- - - - -
46 changed files:
- + changelog.d/T26423
- + changelog.d/unit-index
- compiler/GHC.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Main/Hsc.hs
- compiler/GHC/Driver/Main/Interactive.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Unit/Env.hs
- + compiler/GHC/Unit/External/Database.hs
- + compiler/GHC/Unit/External/Index.hs
- + compiler/GHC/Unit/External/ModuleOrigin.hs
- + compiler/GHC/Unit/External/Providers.hs
- + compiler/GHC/Unit/External/Query.hs
- + compiler/GHC/Unit/External/Substitution.hs
- + compiler/GHC/Unit/External/Validate.hs
- + compiler/GHC/Unit/External/Visibility.hs
- + compiler/GHC/Unit/External/Wired.hs
- compiler/GHC/Unit/Home/Graph.hs
- compiler/GHC/Unit/Info.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Unit/State.hs-boot
- compiler/GHC/Unit/Types.hs
- compiler/ghc.cabal.in
- ghc/GHCi/UI.hs
- hadrian/src/Rules/Generate.hs
- testsuite/tests/count-deps/CountDepsParser.stdout
- + testsuite/tests/driver/T26423/Hello.hs
- + testsuite/tests/driver/T26423/Makefile
- + testsuite/tests/driver/T26423/T26423.hs
- + testsuite/tests/driver/T26423/T26423.stderr
- + testsuite/tests/driver/T26423/T26423.stdout
- + testsuite/tests/driver/T26423/all.T
- + testsuite/tests/driver/T26423/test/Test.hs
- + testsuite/tests/driver/T26423/test/test.pkg
- + testsuite/tests/driver/TUnitInfo/Foo.hs
- + testsuite/tests/driver/TUnitInfo/Makefile
- + testsuite/tests/driver/TUnitInfo/all.T
- + testsuite/tests/driver/TUnitInfo/genMhu.sh
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space-mhu.stdout
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space-single.stdout
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space.hs
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space.stdout
- utils/haddock/haddock-api/src/Haddock.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6f2343fbbfdfd8aaed9babf5983e3…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6f2343fbbfdfd8aaed9babf5983e3…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/9.14.2-backports] 2 commits: hadrian: need libffi before linking the dynamic rts
by Zubin (@wz1000) 27 Jul '26
by Zubin (@wz1000) 27 Jul '26
27 Jul '26
Zubin pushed to branch wip/9.14.2-backports at Glasgow Haskell Compiler / GHC
Commits:
e9e7e8ec by Zubin Duggal at 2026-07-28T01:21:28+05:30
hadrian: need libffi before linking the dynamic rts
The rts link passes -lffi but never needed libffi.
Whether the build succeeded or not was a race depending on
if we managed to copy the libary before the link.
- - - - -
5c2425a1 by Zubin Duggal at 2026-07-28T01:21:28+05:30
Prepare 9.14.2
Bump filpath submodule to 1.5.5.0
Bump Win32 submodule to 2.14.2.2
Metric Increase:
T4029
T13379
libdir
Metric Decrease:
T5030
T24602_perf_size
T25046_perf_size_gzip
T25046_perf_size_unicode
T25046_perf_size_unicode_gzip
- - - - -
46 changed files:
- − changelog.d/26616
- − changelog.d/T26978
- − changelog.d/T26979
- − changelog.d/T27046
- − changelog.d/T27047
- − changelog.d/T27123.md
- − changelog.d/T27124.md
- − changelog.d/T27131
- − changelog.d/T27182.md
- − changelog.d/T27202
- − changelog.d/T27225
- − changelog.d/T27386
- − changelog.d/bump-process
- − changelog.d/deterministic-usage-order
- − changelog.d/fix-absent-dict-projection
- − changelog.d/fix-blackhole-handling
- − changelog.d/fix-cmm-atomic-load-store
- − changelog.d/fix-compacting-gc-ap-27434
- − changelog.d/fix-exponential-case-desugar-27383
- − changelog.d/fix-finalizers-27072
- − changelog.d/fix-layout-stack-fcall
- − changelog.d/fix-peekitbl-no-tntc
- − changelog.d/fix-use-std-ap-thunk
- − changelog.d/ghc-pkg-faster-closure
- − changelog.d/hadrian-stale-package-confs-26661
- − changelog.d/jobserver-leak-fix
- − changelog.d/more-efficient-home-unit-imports-finding
- − changelog.d/reexported-module-errors
- − changelog.d/semaphore-v2
- − changelog.d/tag-inference-27005
- − changelog.d/unused-type
- − changelog.d/wasm-fix-serviceworker
- − changelog.d/windows-rethrow-overlapped-exception
- configure.ac
- docs/users_guide/9.14.2-notes.rst
- hadrian/bootstrap/generate_bootstrap_plans
- + hadrian/bootstrap/plan-9_10_3.json
- + hadrian/bootstrap/plan-9_12_4.json
- + hadrian/bootstrap/plan-bootstrap-9_10_3.json
- + hadrian/bootstrap/plan-bootstrap-9_12_4.json
- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Register.hs
- libraries/Win32
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/filepath
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1ba96b2fb2ad00b4c08472723f5d3d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1ba96b2fb2ad00b4c08472723f5d3d…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/sjakobi/udfm-placement] 151 commits: Tweak mk_mod_usage_info
by Simon Jakobi (@sjakobi) 27 Jul '26
by Simon Jakobi (@sjakobi) 27 Jul '26
27 Jul '26
Simon Jakobi pushed to branch wip/sjakobi/udfm-placement at Glasgow Haskell Compiler / GHC
Commits:
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'.
- - - - -
cca0d589 by Luite Stegeman at 2026-06-30T13:33:40-04:00
rts: handle large AP closures in compacting GC
The function update_fwd_large in the compacting GC could run into
an unexpected object with the following error:
internal error: update_fwd_large: unknown/strange object 24
Closure type 24 is the AP closure, which was not handled in
upd_fwd_large. This patch adds handling them.
fixes #27434
- - - - -
42935858 by Luite Stegeman at 2026-06-30T13:33:40-04:00
testsuite: use compacting_gc way instead of hardcoding +RTS -c
- - - - -
bf7b5ce6 by Alan Zimmerman at 2026-06-30T13:34:23-04:00
EPA: Remove LocatedLW from LStmtLR
HsDo already had its XDo extension point for an
AnnList, which also appeared in LocatedLW.
So we remove the redundant one and use the one inside HsDo
as originally intended.
Also delete LocatedLC/LocatedLS as they were unused
- - - - -
d7cfea49 by Recursion Ninja at 2026-06-30T21:37:12-04: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
- - - - -
a1f2558b by Recursion Ninja at 2026-06-30T21:37:12-04:00
Monomorphising GHC pass parameters where appropriate
- - - - -
7bf9e3c5 by Teo Camarasu at 2026-06-30T21:38:03-04:00
Make Q abstract
This patch aims to clearly demarcate the internal and external interfaces
of Q.
In the past the `Quasi` typeclass was both part of the external,
public-facing interface, and was used to give the implementation of `Q`.
Now we separate out these two distinct roles. `Quasi` continues to exist
in the public interface, but we introduce a new `MetaHandlers` type,
which is equivalent to `Dict Quasi`.
`Q a` is now defined to be `MetaHandlers -> IO a`, and, crucially,
the constructor and the new `MetaHandlers` type are not exposed from the
public interface.
This gives us the ability to vary the interface on the GHC side without
forcing a breaking change on the `template-haskell` side.
Similarly `template-haskell` has more freedom to change the `Quasi`
typeclass without needing any changes in `lib:ghc`.
Implements https://github.com/ghc-proposals/ghc-proposals/pull/700
Resolves #27341
- - - - -
4262af36 by L0neGamer at 2026-06-30T21:38:56-04:00
generically defines mconcat in terms of internal type's Semigroup instance
add changelog entry
use simpler definition for mconcat
`nonEmpty` isn't available yet; inline branches in case
add test case
fixup generically defines mconcat in terms of internal type's Semigroup instance
add comment on Generically and deriving mishaps
swap mconcat to foldr version
add some strictness testing for mconcat
add to `base` changelog entry
- - - - -
e22ad997 by Cheng Shao at 2026-06-30T21:39:43-04:00
hadrian/rts: fix unregisterised build for gcc 15+
This patch fixes unregisterised build for gcc 15+:
- Pass -optc-Wno-error in hadrian when +werror enables -optc-Werror,
see added comment for details.
- For RTS functions that the codegen would emit calls, ensure their
real prototype is hidden when the header is included in .hc fies
(IN_STG_CODE), and the dummy prototype is provided to match the EFF_
convention.
In the future we should get rid of EFF_ (#14647) and remove these
hacks, but for now this patch makes unregisterised work again on newer
toolchains. Fixes #27404.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
3f00f234 by Cheng Shao at 2026-06-30T21:40:32-04:00
compiler: fix missing handling of CmmUnsafeForeignCall node in LayoutStack
This patch fixes missing handling of `CmmUnsafeForeignCall` middle
node in the `LayoutStack` pass.
Before proc-points splitting, this pass computes liveliness of local
registers, and spills those alive across a Cmm native call onto the
stack. It need to traverse all middle nodes in each block and check
whether a local register is an assignee, if so then the previous
mapping in `sm_regs` is invalidated and needs to be dropped. However,
it didn't handle `CmmUnsafeForeignCall` node which may also assign to
a local register. When proc-points splitting is enabled, this can
produce an invalid basic block that doesn't properly backup the
updated local register to the stack before doing a Cmm call, resulting
in completely invalid runtime behavior.
The patch also adds a `T27447` regression test. With no-TNTC or with
LLVM backend, without the fix the test case would output a stale
0x1111111111111111 value, instead of the expected 0x2222222222222222
output.
Fixes #27447.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
701088db by Ben Gamari at 2026-07-01T10:34:03-04:00
gitlab-ci: Drop vestigial references to make build system
- - - - -
62d54a53 by Ben Gamari at 2026-07-01T10:34:03-04:00
gitlab-ci: Add support for running specifying a job's testsuite ways
- - - - -
7f97ac2c by Ben Gamari at 2026-07-01T10:34:03-04:00
gitlab-ci: Run llvm testsuite ways in llvm jobs
Addresses #25762.
- - - - -
7ea75116 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Add normalise_ddump_deriv setup function
Some tests check the result of -ddump-deriv, which may contain INLINE pragmas depending on optimization flags.
With normalise_ddump_deriv setup function, INLINE pragmas are stripped off.
- - - - -
c7a8199f by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Use -dsuppress-idinfo to make tests more robust
Previously, T18052a and T21755 were failing on 'optasm' and 'optllvm' ways because of visibility of unfoldings.
- - - - -
a12122e5 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Use a trick to keep large objects alive
Previously, T17574 and T19381 were failing on 'optasm' and 'optllvm' ways because of compiler optimizations.
Change them to use NOINLINE to prevent unwanted optimizations.
- - - - -
1a95b327 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Only run T24224 in 'normal' way
This test is a frontend-only one and breaks if optimizations are enabled.
- - - - -
8abea737 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Ignore T18118's stderr
When optimizations are enabled, the compiler emits a warning (You cannot SPECIALISE ...).
The message is not important, so ignore it.
- - - - -
9453a722 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Mark T816 and tc216 broken with optimizations
These tests are about type checking, so we should not care too much if they are broken with optimizations.
See #26952
- - - - -
0aef9ec0 by Ben Gamari at 2026-07-01T10:34:03-04:00
testsuite: ds014 is not longer broken
It now appears to pass in the ways it was marked as broken in.
Closes #14901.
- - - - -
4692d1e4 by Ben Gamari at 2026-07-01T10:34:03-04:00
testsuite: Only run stack cloning tests in the normal way
These are too dependent upon code generation specifics to pass in most
other ways.
- - - - -
c154df26 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Update options_ghc_fbyte-code
The `-fbyte-code` option used to be overriden by `-fllvm` but it is no longer true since !14872 was merged.
I updated the test to accept the new behavior.
Closes #27049
- - - - -
5d8bb7b5 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Only run T22744 in 'normal' way
This test takes a long time on optimized ways.
- - - - -
d1e74c8e by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Disable tests that use -finfo-table-map on llvm ways
Currently, -finfo-table-map does not work with -fllvm. See #26435
- - - - -
3bf38c84 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Don't run T24726 on optimized ways
If optimizations are enabled, the rewrite rule just fires and -drule-check will report nothing.
- - - - -
e4eef116 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Use -fno-unoptimized-core-for-interpreter when running LinkableUsage01/02
Optimizations for the bytecode interpreter are considered experimental, and need a flag to be enabled.
- - - - -
234a9872 by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Suppress unwanted optimizations on T25284
- - - - -
99a2af2f by ARATA Mizuki at 2026-07-01T10:34:03-04:00
testsuite: Don't run stack_big_ret with optimizations
Stack layout may change with optimizations enabled.
- - - - -
04c836df by ARATA Mizuki at 2026-07-01T10:34:04-04:00
testsuite: Mark memo001 broken on optimized ways
See #27396
- - - - -
1a8a24f4 by ARATA Mizuki at 2026-07-01T10:34:04-04:00
testsuite: Mark syn-perf broken on optimized ways
See #27398
- - - - -
40412093 by Duncan Coutts at 2026-07-01T10:34:50-04:00
Add a test for thread scheduler fairness
It also tests that the interval timer and context switching works.
We also test that fairness is lost when the context switching interval
is too coarse for the duration of the test.
We add this test before doing surgery on the interval timer, so we have
decent coverage.
- - - - -
3f34d557 by Duncan Coutts at 2026-07-01T10:34:50-04:00
Make exported stop/startTimer no-ops, and rename internal functions
Specifically, internally rename:
stop/startTimer to pause/unpauseTimer
stop/startTicker to pause/unpauseTicker
and keep stop/startTimer as exported functions, but now as no-ops.
In the past the stop/startTicker actions were used incorrectly as if
they were synchronous, which they are not. See issue #27105. We now
document pause/unpackTicker as being async and not to be used for the
purpose of concurrency safety.
The existing stop/startTimer (note Timer not Ticker, the Timer calls the
Ticker!) are also exported from the RTS as a public API. This was
historically because the ticker used signals and it was important to
suspend the timer signel over a process fork. So these functions were
exported to be used by the process and unix libraries.
We cannot just remove the RTS exports, but we now make them no-ops, and
they can be removed from the process and unix library later. This
was already documented in a changelog.d entry no-more-timer-signal but
due to changes during the MR process the change to make stop/startTicker
into no-ops didn't make it into the earlier MR.
- - - - -
02e84e5f by Duncan Coutts at 2026-07-01T10:34:51-04:00
Make exitTicker/exitTimer unconditionally synchronous
We never use them asynchronously, and we should never need to do so.
And update some related comments.
- - - - -
13db6a72 by Duncan Coutts at 2026-07-01T10:34:51-04:00
posix ticker: update and improve comments on (un)pause and exit
Clarify what is async vs sync.
- - - - -
43d9a07d by Duncan Coutts at 2026-07-01T10:34:51-04:00
posix ticker: split out ppoll/select helper functions
Move the #ifdefs out of the main code body by introducing local helper
functions and types, which themselves have two implementations (with a
common API) based on ppoll or select.
This helps improve clarity/readability.
- - - - -
a5491baa by Duncan Coutts at 2026-07-01T10:34:51-04:00
posix ticker: improve the implementation
The existing implementation supported pausing and exiting, with the
implementation of pausing reling on a mutex and condition variable.
It needed to check the pause and stop shared variables on every
iteration. It relies on ppoll or select, to wait on the timeout and also
wait on an interrupt fd. The interrupt fd was only used for prompt
exit/shutdown, and not for pausing or other notification. The pause only
needed a lock and a memory operation, but the pause was not prompt. The
resume used a lock, and signaling a cond var.
The new implementation uses a somewhat more regular design: every
notification is done by setting a shared variable and
interrupting/notifying the ticker via the fd. The ticker thread does not
need to check any shared variables on normal timer expiry, only when it
recevies notification. This may be a micro-optimisation, but the tick
occurs 100 times a second by default so any improvements in the hot path
are amplified. When the ticker thread does receive notification it can
check the various shared variables and update its local state. The
blocking relies on using ppoll/select but without a timeout. This avoids
the condition var and also allows further notifications when paused
(also used for unpausing).
This design can be extended with further notification types if needed by
using and checking further shared vars (or making existing shared vars
an enum or counter). This may be used in future for additional
notifications to the ticker thread. This will likely be used to proxy
wakeUpRts from a single handler context for example. And this approach,
avoiding mutexes, is compatible with use from signal handlers.
So overall, it's:
* slightly simpler / more regular;
* easier to extend with additional notifications;
* probably slightly more efficient (but a micro-optimisation);
* and supports calling notification from signal handlers
- - - - -
5b20821e by Duncan Coutts at 2026-07-01T10:34:51-04:00
posix ticker: further minor local renaming for code clarity
Improve the clarity with better choice of names for several local vars
and function.
- - - - -
1f3ec5e0 by Duncan Coutts at 2026-07-01T10:34:51-04:00
win32 ticker: split out local helper functions
- - - - -
596e7307 by Duncan Coutts at 2026-07-01T10:34:51-04:00
win32 ticker: provide guarantee about concurrency and idempotency
Use a lock to ensure pause/unpause can be used concurrently. Use a
paused variable, protected by the lock, to ensure that pause and unpause
are both idempotent. This is what the portable API expects.
- - - - -
1870edd7 by Duncan Coutts at 2026-07-01T10:34:51-04:00
win32 ticker: make the initial tick be after one wait interval
There is no need to tick immediately. This is consistent with the
posix implementation.
- - - - -
7c15ab5b by Duncan Coutts at 2026-07-01T10:34:51-04:00
ticker: remove now-unnecessary layer of enable/disable
There was an atomic variable used to block *part* of the actions of the
tick handler. This still did not make stopTimer synchronous, even for
the part of the the handle_tick actions it covered. It also added a more
expensive (sequentuially consistent) atomic operation in the hot path
for the handle_tick action, whereas our new design requires no atomic
ops at all.
Now that we have eliminate the need for synchronous stop/startTicker,
we don't need this not-quite-working-anyway atomic protocol. The new
pause/unpauseTicker is explicitly asynchronous and idempotent.
- - - - -
8585f8cb by Duncan Coutts at 2026-07-01T10:34:51-04:00
ticker: add TODOs about issue #27250: too much being done from handle_tick
The handle_tick should not perform I/O, block, perform long-running
operations or call arbitrary user code. Unfortunately, everything to
do with the eventlog (at the moment) falls into all those categories.
- - - - -
6e381626 by Duncan Coutts at 2026-07-01T22:29:55+01:00
Adjust releaseCapability_ precondition to allow cap->running_task == NULL
There are two use cases for releaseCapability_:
1. The current Task (cap->running_task) releases the Capability.
The Capability is marked free, and if there is any work to do,
an appropriate Task is woken up.
2. There is no current task (cap->task == NULL), and thus the
Capability is idle, and we want to wake up an idle Task to animate
the Capability. This case uses always_wakeup.
Currently, the precondition for releaseCapability_ is
cap->running_task != NULL
and so the 2nd use cases have to set cap->running_task (which is then
immediately overwritten) just to satisfy the precondition. See the
use cases in sendMessage and prodCapability.
So we can relax the precondition to be:
cap->running_task != NULL || always_wakeup
so that in the always_wakeup case, we say it is ok for the
cap->running_task to be NULL.
This lets us simplify sendMessage and prodCapability. In particular it
will allow prodCapability to not need a Task parameter.
The ulterior motive for all this is that I want to be able to call
prodCapability from an OS thread that is not itself a Task, in persuit
of issue #27086: disentangle I/O managers from wakeUpRts. The most
straightforward way to wake the RTS is using prodCapability, but the
context in which we will need to do that are threads that are not Tasks.
- - - - -
89404ebc by Duncan Coutts at 2026-07-01T22:29:55+01:00
prodCapability no longer needs to take a Task param
Now that releaseCapability_ can accept cap->running_task == NULL then it
is no longer necessary for prodCapability to require a Task.
- - - - -
4e60c5f6 by Duncan Coutts at 2026-07-01T22:29:56+01:00
Define prodOneCapability
There was an existing declaration for this in the header file, but no
definition.
Similarly, there is a declaration for prodAllCapabilities but no
definition, and we don't need it, so remove the declaration.
- - - - -
2527026f by Duncan Coutts at 2026-07-01T22:29:56+01:00
Add a wakeUpRtsViaTicker feature to the posix ticker
It proxies a call to wakeUpRts, but crucially, this can be called from
a signal handler context. It will be used for ctl-c handling.
- - - - -
aa5a03a5 by Duncan Coutts at 2026-07-01T22:29:56+01:00
Change how wakeUpRts works
Previously it would call wakeupIOManager to get a capability to wake up
and run. This works but it entangles the I/O managers with unrelated
features: ctl-c handling and idle gc (the two features that use wakeUpRts).
The reason it used wakeupIOManager is that this action is safe to use
from a posix signal handler, since it just posts bytes to a pipe.
Otherwise the more direct approach (used e.g. by sendMessage when the
target capability is idle) is to use releaseCapability. But that uses
condition variables and mutexes, which are not safe to use from within a
signal handler.
So instead of entangling the (multiple) I/O managers with this, we make
wakeUpRts use the direct approach (using prodOneCapability). On win32
the ctl-c console handler can call wakeUpRts directly, since it is
called in a proper thread. On posix, to deal with the signal handler
problem, we make the signal handler ask the ticker thread to proxy the
call to wakeUpRts, since the ticker thread is also a proper thread.
This will allow the I/O managers to no longer be concerned with this.
This is good because there are many I/O managers (and they're
complicated), but there is (on posix) only one ticker implementation. So
this is an overall reduction in coupling and complexity.
Fixes issue #27086
- - - - -
c6d53c16 by sheaf at 2026-07-02T21:35:44-04:00
Test driver: normalise line numbers into libraries
When comparing the stdout of tests that print out callstacks, we can't
rely on the stability of exact line:column spans pointing into libraries
(e.g. ghc-internal), as any change (such as adding a comment) can change
them.
This commit addresses this by normalising away line:column in callstacks,
but only when those point into internal libraries. We don't do this in
general, as the exact span might be important to the test (e.g. for a
span within the test module itself).
Fixes #27387
- - - - -
81ee62e0 by Alan Zimmerman at 2026-07-02T21:36:33-04:00
EPA: Remove LocatedLW from MatchGroup
This is the last usage of LocatedLW / SrcSpanAnnLW
- - - - -
925959db by Recursion Ninja at 2026-07-04T04:14:12-04:00
Decoupling 'L.H.S' from 'GHC.Hs.Doc'
* Migrated 'GHC.Hs.Doc' and 'GHC.Hs.DocString' AST defintions from 'GHC.*' namespace,
to new 'Language.Haskell.Syntax.Doc' module in the 'L.H.S' "namespace."
* Updated 'HsDocString to be TTG-parameterised as 'HsDocString pass'.
* Added 'GHC.Hs.Extension.Pass': splits 'GhcPass'/'Pass' and all 'HsDocString'
TTG instances out of 'GHC.Hs.Extension', which re-exports it unchanged
(this is backwards compatible and prevents the introduction of a boot file).
* Deleted 'GHC.Hs.Doc.hs-boot'; removed all 'L.H.S.*' imports of 'GHC.Hs.Doc'.
* Updated 'GHC.Hs.DocString' to be TTG pass-parameterised throughout; moved
'mkHsDocStringChunk'/'unpackHDSC' here (require 'GHC.Utils.Encoding').
* Split 'GHC.Rename.Doc.rnHsDoc' from 'rnHsDocIdentifiersOnly'.
* Updated parser, renamer, typechecker, HIE, and exact-print for new types.
* Added 'HsDocString' TTG instances for 'DocNameI' to 'Haddock.Types'.
* Killed the last module loop between GHC.* and LHS.*.
- Only edges from LHS.* to GHC.Data.FastString now!
Resolves #26971
- - - - -
b7e24044 by mangoiv at 2026-07-04T04:14:56-04:00
ci: retry fetching test metrics
Retry fetching test metrics to make the CI not fail if the services is
temporarily unavailable
- - - - -
4180af3f by Zubin Duggal at 2026-07-04T04:15:38-04:00
Bump semaphore-compat submodule to 2.0.1
This versions includes some cruicial fixes for darwin
- - - - -
242d4317 by sheaf at 2026-07-04T04:16:19-04:00
Remove outdated comment in GHC.Data.ShortText
There was a long comment in GHC.Data.ShortText about a workaround that
was necessary when bootstrapping with GHC 9.2 and below. The actual
logic has since been dropped, but the comment remained. This commit
removes the vestigial comment.
- - - - -
9b714c4c by Zubin Duggal at 2026-07-05T09:40:36+05:30
CorePrep: Don't speculatively evaluate bindings that we have already discovered to be absent
In #25924, we segfault because speculation forces a projection out of a RUBBISH dictionary
(which we generated because it absent).
Solution: Don't speculate on bindings we already know are absent.
Fixes 25924
- - - - -
4a59b3ee by Zubin Duggal at 2026-07-05T09:40:36+05:30
Don't make absent fillers for terminating types
In #25924 we discovered that we could speculatively evaluate an absent filler
for a dictionary, and project a field (a superclass selector) out of it,
resulting in segfaults.
Solution: Never make an absent filler or rubbish literal for a terminating type
like a dictionary. mkAbsentFiller returns Nothing for isTerminatingType, so
worker/wrapper and the specialiser keep the real argument instead.
Some small metric decreases because we do a little less work in the
simplifier now.
Metric Decrease:
T9872a
T9872b
T9872c
TcPlugin_RewritePerf
- - - - -
383ddcd4 by Alan Zimmerman at 2026-07-06T07:08:16-04:00
EPA: Move the 'where' annotation for PatSynBind
This allows us to move it out of the MatchGroup exact print annotation
too
- - - - -
66d1a5d5 by fendor at 2026-07-07T16:57:56-04:00
Add 'backendInfoTableMapValidity' backend predicate
Check whether the backend supports the `-finfo-table-map` flag and
ignore it otherwise.
Improve by-design documentation of `backendCodeOutput`.
`Backend` is **abstract by design**. Make this clearer in
`backendCodeOutput` which is incorrectly being used as a proxy for
`Backend`.
Instead, define the desired property predicates in GHC.Driver.Backend
In the process, make `backendCodeOutput` total.
- - - - -
74f1071d by fendor at 2026-07-07T16:57:56-04:00
Add failing test for `-finfo-table-map` and bytecode backend
If you compile a module using the bytecode backend, with
-finfo-table-map, then the info table map doesn't get populated for the
module.
This is because the -finfo-table-map code path is implemented mostly in
the StgToCmm phase which isn't run when creating bytecode.
Ticket #27039
- - - - -
28d63bca by mangoiv at 2026-07-07T16:59:16-04:00
ci: don't fail nightly if there have been no changes that night
Fixes #27127
- - - - -
4ebfc478 by Rodrigo Mesquita at 2026-07-08T04:47:53-04:00
ttg: Using ShortText over FastString in the AST
To make the AST independent of GHC, this commit replaces usages of
`FastString` with `HText` in the AST, killing the last edge from
Language.Haskell.* to GHC.* modules.
Even though we /do/ want to use FastStrings in general -- critically in
Names or Ids -- there is no particular reason for the FastStrings that
occur in the AST proper to be FastStrings. Strings in the AST are
typically unique and don't benefit particularly from being interned
FastStrings with Uniques for fast comparison.
`HText` is a type synonym for `ShortText` which uses GHC's Modified
UTF-8 encoding exclusively.
Modified UTF-8 must be used to represent the Haskell AST because the
Haskell Report allows surrogate code points. `Data.Text.Text` functions
use Standard UTF-8 which replace surrogates with a placeholder value,
thus `Data.Text.Text` is unsuitable for AST strings. See the
`Language.Haskell.Syntax.Text` module header for more details.
Final progress towards #21592
Closes #21628
- - - - -
d910b353 by Simon Peyton Jones at 2026-07-08T04:48:36-04:00
Update equality-type documenation in GHC.Builtin.Types.Prim
Fix #27466
- - - - -
b2530542 by Simon Peyton Jones at 2026-07-08T04:48:36-04:00
Honour -dsuppress-coercions in GHC.Core.TyCo.pprCo
Fixes #27467
- - - - -
9a73179a by Facundo Domínguez at 2026-07-08T04:49:26-04:00
Add item to MR checklist asking to squash fixup commits after approval
The checklist has an item that reads
All commits are either individually buildable or squashed.
This item could be checked immediately after sending the merge request
though. If reviewers ask for amends later on, and the author amends
the merge request, there was no item that would remind the contributors
to squash the fixup commits before landing.
This commit adds a new item
After all approvals and before landing: all fixup commits are squashed with their originating commits.
which should be harder to mark as done before approvals have been given.
- - - - -
ed09895d by Andreas Klebinger at 2026-07-08T16:53:27-04:00
Fix a profiling race condition resulting in segfaults.
StgToCmm: Don't assume tagged FUN closures in closureCodeBody.
When entering a closure the self/node pointer might not be tagged in
some situations when a thunk is evaluated by multiple threads.
So we most AND away the tag bits rather than subtracting an expected tag.
Apply.cmm: Fix a race condition occuring when a thunk is mutated during GC.
In stg_ap_0_fast when might need to run GC before entering a thunk. If this happens
another thread or the GC itself might mutate the closure making entering it no longer
valid. We now check for this.
Add test and changelog for #27123 fixes.
- - - - -
67c03eb2 by Cheng Shao at 2026-07-08T16:54:09-04:00
ghc-heap: fix invalid srtlen returned by peekItbl when no-TNTC
This patch fixes the no-TNTC code path of `peekItbl` so that it looks
at the right memory address when reading the `srt` field from the
`StgInfoTable_` struct. Also adds a `T27465` regression test that
reproduces the bug on no-TNTC builds before the fix. Fixes #27465.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
2ecabb4f by Zubin Duggal at 2026-07-09T09:23:25-04:00
hadrian: binary-dist-dir should not be the default target
Revert behaviour to pre 23c9b6c392f52ec9d7a8618b204ff6b885f5fba2
In 23c9b6c392f52ec9d7a8618b204ff6b885f5fba2, we applied the following behaviour change:
```
hadrian: Build stage 2 cross compilers
...
* hadrian: Make binary-dist-dir the default build target. This allows us
to have the logic in one place about which libraries/stages to build
with cross compilers. Fixes #24192
```
This is a major regression to development experience, a plain hadrian/build
--freeze1 now takes ages because we rebuild all docs (which need to go in the
binary dist dir).
`binary-dist-dir` is the wrong default target for regular GHC development work
Fixes #27445
- - - - -
e16388e3 by Zubin Duggal at 2026-07-09T09:23:25-04:00
.gitignore: Add the hadrian system.config introduced by commit 23c9b6c392f52ec9d7a8618b204ff6b885f5fba2
Since
commit 23c9b6c392f52ec9d7a8618b204ff6b885f5fba2
Author: Matthew Pickering <matthewtpickering(a)gmail.com>
Date: Thu Dec 21 16:17:41 2023 +0000
hadrian: Build stage 2 cross compilers
./configure produces /hadrian/cfg/system.config.{host,target}
Add these to .gitignore
- - - - -
7e8abf41 by Alan Zimmerman at 2026-07-09T09:24:12-04:00
EPA: Replace AnnListItem with simply [TrailingAnn]
Remove the unnecessary wrapper around a single field.
- - - - -
29032f17 by Zubin Duggal at 2026-07-09T09:24:58-04:00
testsuite: Keep real reason for fragile test failures
- - - - -
c34e03a7 by Zubin Duggal at 2026-07-09T09:24:58-04:00
testsuite: Fall back to the failure reason for empty JUnit bodies
- - - - -
409d40f0 by Zubin Duggal at 2026-07-09T09:24:58-04:00
testsuite: Show output diffs in JUnit output
Also refactor compare_outputs to return essentially a `Maybe Diff`
(`CompareOutput`) instead of a bool, but more pythonic. This
allows us to pass the diff through nice.
- - - - -
06fee1ab by Zubin Duggal at 2026-07-09T09:24:58-04:00
perf notes: include stat deviation and acceptance window in notes so they show up in gitlab
- - - - -
57c0f32c by mangoiv at 2026-07-10T11:08:38-04:00
driver: enable -finter-module-far-jumps by default
this fixes a compatibility bug with certain binutils/gcc versions where
we were seeing jump offset overflow errors.
This commit can probably reverted if we stop supporting the problematic
binutils/gcc verions (2.44 and 14.2, respectively)
Reolves #26994
- - - - -
4396a6f2 by Andrea Vezzosi at 2026-07-10T11:09:25-04:00
[Fix #27287] preserve ModBreaks in ModIface
- - - - -
ed261a7e by Cheng Shao at 2026-07-14T17:59:38-04:00
hadrian: fix HLS support
This patch fixes hadrian's HLS support so one can rely on HLS when
working on the hadrian codebase. Fixes #27480.
Not building/linking shared libraries for hadrian is a severely
premature optimization; this top-level setting in `cabal.project` only
affects home packages while the dependencies in the cabal store are
built with vanilla/dynamic anyway, and even adding dynamic builds to
home packages would not be costly due to cabal's usage of
`-dynamic-too`.
- - - - -
eee8ec5b by Cheng Shao at 2026-07-14T18:00:20-04:00
compiler: fix miscompiled %load_relaxed, add missing %store_relaxed
This patch fixes the %load_relaxed cmm primop compilation logic to
correctly use relaxed memory ordering, and adds the missing
%store_relaxed primop. Parsing logic of %load/%store with explicit
ordering is covered in the AtomicFetch test case. Fixes #27483.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
1718230f by Alan Zimmerman at 2026-07-14T18:01:06-04:00
EPA: Keep binds and sigs together in HsValBindsLR
We combine them into a single list for GhcPs, wrapped in the
ValBind data type, which is the bind equivalent of ValD, having
constructors for binds and sigs.
This simplifies exact print processing, especially when using it to
update the contents of local binds, as we no longer need AnnSortKey
BindTag
- - - - -
6bd1ad2a by Andreas Klebinger at 2026-07-14T18:01:49-04:00
Bump nofib submodule to account for MonoLocalBinds.
New versions of GHC enable MonoLocalBinds by default.
This breaks some of the benchmarks. I've fixed this and
this bump pulls in that fix.
- - - - -
7eb0f1c9 by Cheng Shao at 2026-07-14T18:02:31-04:00
testsuite: fix bytecodeIPE test under +ipe flavours
This patch fixes the bytecodeIPE test under +ipe flavours. It used to
fail under +ipe because the RTS is built with IPE info, then
stg_AP_info in RTS carries IPE info, so whereFrom wouldn't return
Nothing. Now the test checks IPE info of a datacon in the ghci-loaded
module which is not affected by whether the RTS is built with IPE info
or not. Fixes #27498.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
ef038aae by cydparser at 2026-07-15T04:35:41-04:00
Reduce bytes allocated for `capabilities` in RTS (fixes #27487)
In rts/Capability.c, `capabilities` is an array of pointers, but it was allocated as if it were an
array of Capability's.
- - - - -
d377e83e by Cheng Shao at 2026-07-15T04:36:27-04:00
rts: fix missing UNTAG in stg_readTVarIOzh
This patch fixes missing UNTAG on the current value closure read from
StgTVar. UNTAG is a no-op when it's stg_TREC_HEADER_info which is word
aligned; it may be a tagged closure, and reading info table from the
tagged address is an unaligned load which may cause issues on
platforms with strict alignment requirements.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
8ed03842 by Cheng Shao at 2026-07-15T04:36:27-04:00
rts: fix missing UNTAG in stg_control0zh_ll
This patch fixes missing UNTAG on the cont closure returned by
captureContinuationAndAbort. In case it's not NULL,
captureContinuationAndAbort returns a tagged StgContinuation closure,
in which case it must be untagged before accessing the
apply_mask_frame field.
In the past it worked out of luck: when apply_mask_frame was NULL then
mask_frame_offset is also 0 so the control flow didn't diverge to a
wrong path. Still, this is horribly wrong and will crash once
StgContinuation struct is refactored and fields are shuffled around.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
5aa7000a by Cheng Shao at 2026-07-15T04:37:08-04:00
compiler: fix redundant AP thunk codegen when not using -ticky-ap-thunk
This patch fixes a double negation confusion in !7525 that results in
some redundant AP thunk code generation when not using
-ticky-ap-thunk. Now, we use `stgToCmmUseStdApThunk` to indicate
whether precomputed AP thunks in the RTS should be used, which
defaults to `True`, unless `-ticky-ap-thunk` is passed.
`-finfo-table-map` now also implies `-ticky-ap-thunk`, since when
doing IPE profiling we want the generated AP thunks to be unique.
Fixes #27502.
-------------------------
Metric Decrease:
T3064
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
d43a7b7a by Brian McKenna at 2026-07-15T20:10:04+02:00
Strip ticks when desugaring bool guards
The special `considerAccessible` pattern was broken when compiling
with debug info. Compiling with debug info wraps expressions with
`SourceNote` ticks, which broke the internals of the
`desugarBoolGuard` function. Ticks are now ignored within this
function.
Fixes #27360
- - - - -
ede4b17b by Ben Gamari at 2026-07-15T22:59:53-04:00
base: Display ExceptionContext in WhileHandling's textual description
As originally-implemented the implementation for
`WhileHandling(displayExceptionAnnotation)` would display the
`ExceptionContext` of the exception which it carries (as this was the
behavior of `displayException`, in terms of which
`displayExceptionAnnotation` was implemented).
However, in 284ffab3 the definition of `SomeException(displayException)`
was changed to exclude the `ExceptionContext`. This means that
`WhileHandling(displayExceptionAnnotation)` fails to describe the
provenance of the exception which it captures, greatly limiting its
utility.
Return the implementation to its originally-specified behavior by
implementing `WhileHandling(displayExceptionAnnotation)` in terms of
`displayExceptionWithInfo`.
Fixes #27456.
- - - - -
0f64f348 by Cheng Shao at 2026-07-16T15:41:08+00:00
ci: add missing docker permission workaround in abi-test job
- - - - -
660cb239 by Cheng Shao at 2026-07-16T19:37:48+00:00
bindist: Fix make install -j race condition on macos/freebsd
This patch fixes make install -j race condition on macos/freebsd. BSD
install fails with EEXIST when multiple install processes concurrently
create the same prefix directory. So we add an `install_dirs`
prerequisite job that sequentially creates the directories for
subsequent jobs to work with. Fixes #27499.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
08130257 by Cheng Shao at 2026-07-16T19:37:48+00:00
ci: run bindist make install with -j
This patch makes the ci scripts run `make install` with `-j` to reduce
wall clock time when installing the bindist, see related issue for
benchmark numbers. This only affects ghc ci logic, the user-facing
default is up to distributors and is still `-j1`. Closes #27029.
- - - - -
d5ae6906 by Adam Gundry at 2026-07-17T04:57:43-04:00
Mark various language extension flags as deprecated (see #27329)
The following language extensions are now deprecated:
- AlternativeLayoutRule
- AlternativeLayoutRuleTransitional
- ParallelArrays
- PolymorphicComponents
- Rank2Types
In addition, the warning `-Walternative-layout-rule-transitional`
has been marked as deprecated, as it is emitted only under the
deprecated extension `XAlternativeLayoutRuleTransitional`.
- - - - -
fe3b059c by Andrew Lelechenko at 2026-07-17T04:58:26-04:00
base: re-export GHC.Environment.getFullArgs from System.Environment
CLC proposal https://github.com/haskell/core-libraries-committee/issues/431
- - - - -
722236dd by sheaf at 2026-07-18T08:48:31-04:00
Coercion optimisation: avoid double-Sym for InstCo
Ticket #27374 pointed out an issue with GHC.Core.Coercion.Opt.optCoercion's
handling of InstCo: it contravened (LC2) in Note [The LiftingContext in optCoercion]
because it applied the ambient 'sym' to a coercion that was then added
to the lifting context substitution.
Fixes #27374
Co-authored-by: Simon Jakobi <simon.jakobi(a)gmail.com>
- - - - -
ff70fc75 by sheaf at 2026-07-18T08:48:31-04:00
Coercion optimisation: avoid exponential behaviour
The change to coercion optimisation of 'InstCo' in the previous commit
introduces exponential behaviour to the coercion optimiser. To avoid
this, this commit provides a way to push in 'Sym' of an already-optimised
coercion: GHC.Core.Coercion.Opt.mkDeepSymCo.
See Note [Pushing Sym without re-optimising] in GHC.Core.Coercion.Opt.
- - - - -
dfef27f0 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Move THREADED_RTS-conditional struct members to end of Capability
Accessing members of the Capability struct from CMM code rely on
accessor macros. (The macros are generated by deriveConstants).
These macros have a single definition. This means that the offsets of
all struct members must *not* vary based on THREADED_RTS vs
!THREADED_RTS. This requires that any struct members that are
conditional on THREADED_RTS must occur after the unconditional struct
members. Hence we move all the ones that are conditional on
THREADED_RTS to the end.
Add a deriveConstants entry for the iomgr member of the Capability
struct, which was the motivation for this change.
Add warning messages to help our future selves. Debugging this took me
a couple hours in gdb!
- - - - -
c254e022 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Make the IOManager API use CapIOManager rather than Capability
This makes the API somewhat more self-contained and more consistent.
Now the IOManager API and each of the backends takes just the I/O
manager structure. Previously we had a bit of a mixture, depending on
whether the function needed access to the Capability or just the
CapIOManager.
We still need access to the cap, so we introduce a back reference to
reach the capability, via iomgr->cap.
Convert all uses in select and poll backends, but not win32 ones.
Convert callers in the scheduler and elsewhere.
Also convert the three CMM primops that call IOManager APIs. They just
need to use Capability_iomgr(MyCapability()).
- - - - -
4f3d8f31 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Split posix/MIO.c out of posix/Signals.c
The MIO I/O manager was secretly living inside the Signals file.
Now it gets its own file, like any other self-respecting I/O manager.
- - - - -
52ce04a9 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Rationalise some scheduler run queue utilities
Move them all to the same place in the file.
Make some static that were used only internally.
Also remove a redundant assignment after calling truncateRunQueue that
is already done within truncateRunQueue.
- - - - -
75bbdebc by Duncan Coutts at 2026-07-18T08:49:12-04:00
Rename initIOManager{AfterFork} to {re}startIOManager
These are more accurate names, since these actions happen after
initialisation and are really about starting (or restarting) background
threads.
- - - - -
724c0517 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Free per-cap I/O managers during shutdown and forkProcess
Historically this was not strictly necessary. The select and win32
legacy I/O managers did not maintain any dynamically allocated
resources. The new poll one does (an auxillary table), and so this
should be freed.
After forkProcess, all threads get deleted. This includes threads
waiting on I/O or timers. So as of this patch, resetting the I/O
manager is just about tidying things up. For example, for the poll
I/O manager this will reset the size of the AIOP table (which
otherwise grows but never shrinks).
In future however the re-initialising will become neeecessary for
functionality, since some I/O managers will need to re-initialise
wakeup fds that are set CLOEXEC.
- - - - -
c007d122 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Add a TODO to the MIO I/O manager
The direction of travel is to make I/O managers per-capability and have
all their state live in the struct CapIOManager. The MIO I/O manager
however still has a number of global variables.
It's not obvious how handle these globals however.
- - - - -
b65ab7b3 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Add a FIXME note in the Poll I/O manager
- - - - -
daf2bd6f by Duncan Coutts at 2026-07-18T08:49:12-04:00
Add missing updateRemembSetPushClosure in poll I/O manager
For the non-moving GC.
- - - - -
e33ca830 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Minor doc improvement to struct StgAsyncIOOp member outcome
Mention the enumeration names, as well as their numeric values. The rest
of the code uses the enum names.
- - - - -
4edd2579 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Minor doc improvements for StgTSOBlockInfo
Clarify that certain union members are used only by certain legacy
I/O managers. Hopefully we will be able to remove these at some point.
- - - - -
536bedbb by Duncan Coutts at 2026-07-18T08:49:12-04:00
Avoid exporting various win32-specific rts symbols
The BeginPrivate.h / EndPrivate.h scheme works perfectly well on
Windows, but all of the rts/win32/*.h files were not using it.
- - - - -
8139b5ac by Duncan Coutts at 2026-07-18T08:49:12-04:00
Remove wakeupIOManager, ioManagerWakeup and setIOManagerWakeupFd
We no longer need wakeupIOManager for the threaded RTS case, so we can
remove it and the bits only needed to support it. This includes the
pipe/eventfd fd shared between the RTS and the in-library I/O manager
used for waking up the I/O manager thread. The pipe/eventfd still
exists, but it no longer has to be communicated to the RTS, since the
RTS no longer needs to use it.
So we remove the RTS API export setIOManagerWakeupFd, and remove uses of
it within the I/O managers in ghc-internal.
- - - - -
74fe7c66 by Duncan Coutts at 2026-07-18T08:49:12-04:00
Add a new interruptIOManager API for the I/O managers
It will be used to interrupt awaitCompletedTimeoutsOrIO. Also update the
return type and docs for awaitCompletedTimeoutsOrIO to have it return
false when it gets interrupted, and have no useful post condition in
that case.
- - - - -
38792843 by Duncan Coutts at 2026-07-18T08:49:13-04:00
Add interruptIOManager support for select I/O manager
Uses the FdWakup mechanism.
- - - - -
2f3b00aa by Duncan Coutts at 2026-07-18T08:49:13-04:00
Add interruptIOManager support for poll I/O manager
Uses the FdWakup mechanism.
A quirk we have to cope with is that we now need to poll one more fd --
the wakeup_fd_r -- but this fd has no corresponding entry in the
aiop_table. This is awkward since we have set up our aiop_poll_table to
be an auxilliary table with matching indicies.
The solution this patch uses (and described in the comments) is to have
two tables: struct pollfd *aiop_poll_table, *full_poll_table;
and to have the aiop_poll_table alias the tail of the full_poll_table.
The head entry in the full_poll_table is the extra fd. So we poll the
full_poll_table, while the aiop_poll_table still has matching indicies
with the aiop_table.
Hurrah for C aliasing rules.
- - - - -
cee50131 by Duncan Coutts at 2026-07-18T08:49:13-04:00
Add interruptIOManager support for win32 legacy I/O manager
And remove unused related helper resetAbandonRequestWait. It is not
called because the event is created in auto-reset mode, so never needs
to be reset manually.
- - - - -
cf453143 by Duncan Coutts at 2026-07-18T08:49:13-04:00
Note lack of interruptIOManager support for WinIO I/O manager
Though there's a plausible design, we can't sanely test it at the moment
due to related WinIO bugs. Filed as issue #27403.
- - - - -
1b74a0ad by Duncan Coutts at 2026-07-18T08:49:13-04:00
Be more explicit about enum IOReadOrWrite values, and type within cmm
Belt and braces.
- - - - -
b388d093 by Brian McKenna at 2026-07-18T17:51:50-04:00
Ignore ticks in the pattern-match term oracle
The term-oracle in the pattern-match checker is keyed by a canonical
form of the scrutinee, computed by `makeDictsCoherent`. That canonical
form was tick-sensitive: two occurrences of an otherwise identical
expression that happened to carry different ticks were treated as
distinct values, breaking long-distance information.
This shows up in practice under `-finfo-table-map`, because the
desugarer wraps every record-selector use site in a `SourceNote`
carrying that site's span. For example:
data Box = Box { unBox :: Maybe Int }
f b = case unBox b of
Nothing -> 0
Just _ -> let Just x = unBox b in x
The two `unBox b` expressionss carry different SourceNote spans, the
pattern-match checker sees them as different, the long-distance
information from the outer `Just _` branch never reaches the
let-pattern, and `Just x = unBox b` is wrongly reported as
non-exhaustive.
We now strip all ticks in `makeDictsCoherent`. This is documented as
Wrinkle (UD1) of Note [Unique dictionaries in the TmOracle CoreMap].
Fixes #27314
- - - - -
c23e1acb by Mrjtjmn at 2026-07-18T17:52:45-04:00
Add explanations for unsolved Typeable constraints
This commit adds explanations for unsolved 'Typeable' constraints.
GHC will now provide additional explanations for an unsolved constraint
of the form 'Typeable ty', explain why GHC did not solve Typeable constraint.
e.g.:
- 'ty' is a polymorphic type (e.g. forall a. a -> a)
- 'ty' is a qualified type (e.g. Eq Int => Int)
- 'ty' is an unboxed sum type
- 'ty' is an unreduced type family application
- 'ty' whose kind is not typeable
Fixes #26532
- - - - -
cbef021e by Artem Pelenitsyn at 2026-07-19T07:49:55-04:00
ghc-internal: Lock.hs: fix typo and indentation
- - - - -
42918646 by Duncan Coutts at 2026-07-19T07:50:36-04:00
Fix failing test GcStaticPointers for non-moving GC
Minor mistake in asserting something before checking for that same
thing.
Specifically, Bdescr asserts HEAP_ALLOCED_GC, but Bdescr was being used
prior to a guard that checks HEAP_ALLOCED_GC. The solution is just to
move the use of Bdescr after the guard.
Thanks to Simon Jakobi for identifying the problem.
- - - - -
c2f6dcd4 by Sasha Bogicevic at 2026-07-20T10:31:56+02:00
Improve error messages for invalid record wildcards
Record wildcard hints are now shown in more contexts and include
constructor arity; matching with `..` on a fieldless constructor
now produces a dedicated error message.
Fixes #21101
- - - - -
4c02e76b by Duncan Coutts at 2026-07-21T10:37:21-04:00
Mark test T27105 as fragile, citing issue #27522
Scheduler fairness is fine, except when it isn't. And it isn't on CI
machines surprisingly often! See the issue for details.
- - - - -
43dd2b15 by Recursion Ninja at 2026-07-21T17:09:53-04:00
Resolving many TTG related orphan type-class instances
This is part a technical debt removal effort made possible now
that separating out the AST via TTG has come to a close.
As the AST in 'L.H.S' has been incrementally separated from the GHC internals,
there are many accumulated orphan instance of 'Binary', 'NFData', 'Outputable',
and 'Uniquable'. The orphan instance of data-types from within 'L.H.S' have had
their orphan instances moved to either:
1. The module which defines the data-type
2. The module which defines the type-class;
i.e. moving an orphan 'Binary' instance to 'GHC.Utils.Binary'
Orphan instances resolved (37):
| Data-type | Resolved instance(s) | Former orphan module(s) |
| -------------------- | -------------------------- | ------------------------- |
| Role | Binary, NFData, Outputable | GHC.Core.Coercion.Axiom |
| SrcStrictness | Binary, NFData, Outputable | GHC.Core.DataCon |
| SrcUnpackedness | Binary, NFData, Outputable | GHC.Core.DataCon |
| Fixity | Binary, Outputable | GHC.Hs.Basic |
| FixityDirection | Binary, Outputable | GHC.Hs.Basic |
| LexicalFixity | Outputable | GHC.Hs.Basic |
| CCallTarget | NFData | GHC.Hs.Decls.Foreign |
| CType | NFData | GHC.Hs.Decls.Foreign |
| Header | NFData | GHC.Hs.Decls.Foreign |
| OverlapMode | Binary, NFData | GHC.Hs.Decls.Overlap |
| WithHsDocIdentifiers | NFData, Outputable | GHC.Hs.Doc |
| HsDocString | NFData | GHC.Hs.DocString |
| HsDocStringChunk | Binary, Outputable | GHC.Hs.DocString |
| HsDocStringDecorator | Binary, Outputable | GHC.Hs.DocString |
| NamespaceSpecifier | Outputable | GHC.Hs.ImpExp |
| ForAllTyFlag | Binary, NFData, Outputable | GHC.Hs.Specificity |
| Specificity | Binary, NFData | GHC.Hs.Specificity |
| PromotionFlag | Binary, Outputable | GHC.Types.Basic |
| FieldLabelString | Outputable, Uniquable | GHC.Types.FieldLabel |
| InlinePragma | Binary | GHC.Types.InlinePragma |
-------------------------
Metric Decrease:
hard_hole_fits
-------------------------
Closes #21262, #27469
- - - - -
ab9ab895 by Cheng Shao at 2026-07-21T17:10:53-04:00
rts: always use StgInt to represent cost center id
Currently cost center id is modeled as `Int` and it should be `StgInt`
uniformly in the RTS, hence this patch. Fixes #27524.
- - - - -
94d8f83b by Cheng Shao at 2026-07-22T11:30:40-04:00
hadrian: clean up stale cabal package flags in the tree
This patch cleans up stale cabal package flags in the tree and related
hadrian/autoconf logic. Closes #27474.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
0bf1d8c9 by Sasha Bogicevic at 2026-07-22T11:31:21-04:00
parser: don't suggest ImportQualifiedPost when it is already enabled
-Wprepositive-qualified-module unconditionally attached a hint to
enable ImportQualifiedPost, even when the extension was already on
(as it is by default under GHC2021). Record the extension's state in
the PsWarnImportPreQualified diagnostic and drop the hint when it is
already enabled.
Fixes #27380
- - - - -
700a1dd1 by Simon Jakobi at 2026-07-23T11:21:20-04:00
ci: Reduce lint job setup costs
Avoid fetching unnecessary history and submodules for lightweight lint
jobs. Run changelog validation without Hadrian.
Because the lint-author job is now based on the .lint template directly,
we enhance it to allow Git to read from the runner-owned checkouts,
In the previously used .lint-params template, this permissions issue was
addressed via `chown`.
Closes #27521.
Assisted-by: gpt-5.6-sol via Codex CLI
- - - - -
26a44fb0 by ARATA Mizuki at 2026-07-23T11:22:10-04:00
testsuite: Fix memory issues of doublex2_* and simd010
doublex2_* had reads from uninitialized memory.
simd010 had out-of-bounds array access.
Fixes #27544
- - - - -
4d798b17 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Eliminate STM_AWOKEN
It was used as nullary closure for the block_info.closure in the case of
a thread being awoken after an STM transaction.
However, while it was written, it was never read, so contributed nothing
to the behaviour. Furthermore, in the only place it was set (in
tryWakeupThread) the why_blocked was immediately overwritten by the
NotBlocked status, and the block_info was updated accordingly (by
appendToRunQueue).
So it didn't even serve a purpose of clarifying an intermediate state,
there really was no such intermediate state.
Cleaning this up will allow the BlockedOnSTM case to follow the same
pattern as the other why_blocked cases that do not use the block_info,
and in turn this reduces the number of different categories.
- - - - -
e1cece79 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Document that eventlog thread stop code ThreadBlocked is no longer used
It has not been used since GHC 7.0.x (2011). In 7.2 all the BlockedOn*
codes were added, and these were and are used instead of ThreadBlocked.
- - - - -
795db115 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Add a proper mapping to eventlog external thread stop status
That is the mapping from rts-internal codes, to the coes used in the
status field in the eventlog EVENT_STOP_THREAD event.
See issue #9003 for what goes wrong when we mess this up. In that
ticket, people note that we should really not require the internal
tso->why_blocked codes to leak into the external eventlog thread stop
codes. The same principle applies to the StgThreadReturnCode.
This change properly separates them, and explicitly maps between them
using a pair of (compact, constant) tables. These tables are pretty
small (with no alignment constraints) and will soon shrink so it seems
a sensible tradeoff.
We also introduce and use proper EVENT_STOP_THREAD constants in the
event log format header. Previously there was not specification in the
code for these (only in the docs): the values were encoded into the
conversion code.
This will allow us to renumber the internal why_blockd codes without
breaking the eventlog output.
- - - - -
6f1c8efa by Duncan Coutts at 2026-07-23T17:26:18-04:00
Remove unused tso->block_info.wakeup member
Presumably it was used once, but not now.
- - - - -
740b88a9 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Document StgTSOBlockInfo to say what cases use what members
In principle, tso->why_blocked is the tag for the StgTSOBlockInfo union,
so we should be able to say for each union member the why_blocked cases
that use that member.
- - - - -
5b92eae2 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Add a tso->block_info.mvar member and use it
in preference to the generic block_info.closure union member, with
casts.
The plan is that when we know what case we're in (via tso->why_blocked)
then we can always access the correct union member, and so we will only
need to access block_info.closure for generic cases where we don't know
or don't care.
- - - - -
d931715f by Duncan Coutts at 2026-07-23T17:26:18-04:00
Add a tso->block_info.unused member and use it
in preference to the generic block_info.closure union member, with
casts.
The plan is that when we know what case we're in (via tso->why_blocked)
then we can always access the correct union member, and so we will only
need to access block_info.closure for generic cases where we don't know
or don't care.
- - - - -
47e28ebb by Duncan Coutts at 2026-07-23T17:26:18-04:00
Avoid storing to tso->block_info.closure
In one case we can use a specific union member (.prev) instead. In
several cases the stores were in fact redundant because of subsequent
overwrites.
In scavengeTSO we replace setting tso->block_info.closure to a valid
closure, with an assertion that the block_info.unused is already set to
END_TSO_QUEUE which is a valid (static) closure.
- - - - -
96e4749d by Duncan Coutts at 2026-07-23T17:26:18-04:00
Renumber the tso->why_blocked constants
We can do this now because we have separated the internal values from
the external ones used in the eventlog.
This lets us put them back into a deliberate order and consolodate some
gaps.
More importantly, it is a prepation for a slightly more sophisticated
encoding.
- - - - -
8f62661c by Duncan Coutts at 2026-07-23T17:26:18-04:00
Define constants for the existing stg_threadStatuszh return codes
The stg_threadStatuszh reuses the internal tso->why_blocked codes but
also extends them with a couple previously magic values. This is awkward
since we need to know what those magic values are so we don't
accidentally use those values to mean something else. By pulling a
definition up to where the why_blocked codes are defined we will be able
to avoid mistakenly assining those codes some meaning (or just changing
the BlockedThreadComplete, BlockedThreadKilled code if necessary).
- - - - -
42c69ae2 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Extend the tso->why_blocked encoding to indicate block_info closures
We use some bit tricks to cheaply and generically test if a
tso->why_blocked tag implies that the corresponding tso->block_info will
contain a non-trivial valid closure (i.e. not just block_info.unused set
to END_TSO_QUEUE).
In particular we arrange for most why_blocked values to naturally have a
distinguishing bit, but for the BlockedOn{Read,Write,Delay} cases, they
can come in either non-closure or closure forms. We allow an additional
bit to distinguish these cases. The non-closure forms are only from
legacy I/O managers: select and win32-legacy. So this extra bit
mechanism will be able to be retired once the legacy I/O managers are
themselves retired.
This means in a few places we need to untag the why_blocked value before
inspecting it, but in most places we do not.
- - - - -
7c64632b by Duncan Coutts at 2026-07-23T17:26:18-04:00
Use BlockInfoForceNonClosure in the select I/O manager
- - - - -
8fd7104a by Duncan Coutts at 2026-07-23T17:26:18-04:00
Use BlockInfoForceNonClosure in the win32-legacy I/O manager
for the BlockedOn{Read,Write} since these use the non-heap allocated
StgAsyncIOResult.
- - - - -
e0da603b by Duncan Coutts at 2026-07-23T17:26:18-04:00
Enforce the why_blocked and block_info rules in checkTSO
We now check the cases wher IsBlockInfoClosure should hold, the cases
that are supposed to use block_info.unused == END_TSO_QUEUE, and which
cases are allowed to use BlockInfoForceNonClosure.
This partially enforces the use of why_blocked as a tag for the
block_info union. We could be stricter and check for the correct
expected info table for the closure cases.
- - - - -
1dd0f381 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Use IsBlockInfoClosure to simplify several tests
In GC and generic traversal we need to know if we should look at the
block_info.closure or not. Now we can do just that using a cheap bit
test on the why_blocked tag.
This fixes issue 26717, where the problem was that some GC modes did not
know when to look at block_info.closure, because the poll I/O manager
uses a closure for BlockedOn{Read,Write} while the select I/O manager
uses a non-closure. Now this information is in the why_blocked tag
itself.
- - - - -
7a00ffbc by Duncan Coutts at 2026-07-23T17:26:18-04:00
Remove the now-unused scavengeTSOIOManager
The GC no longer has to delegate to the I/O manager, since it can use
IsBlockInfoClosure to decide things itself.
- - - - -
522a481f by Duncan Coutts at 2026-07-23T17:26:18-04:00
Remove duplicate assertion
- - - - -
0874d965 by Duncan Coutts at 2026-07-23T17:26:18-04:00
Follow atomic access rules more consistently for tso->why_blocked
The rule is this:
store block_info *before* why_blocked
store why_blocked using store release
load why_blocked using load acquire
load block_info *after* why_blocked
This is a an atomic store release / load acquire pair and (if the reads
are in a separate thread to the writes, and the read receives the value
stored) then this guarantees a full "happens before" relationship of
these stores and loads.
In some cases, we do not need a full load acquire, because we don't read
the block_info at all and so do not need any ordering. In this case we
just need an atomic relaxed load.
This was being followed in most places, but not all. If there's good
reason in any case that we don't need atomic access, then we should
document that in a comment. In the absence of that I think it's easier
to follow the rule everywhere.
- - - - -
8f0bdbe1 by Duncan Coutts at 2026-07-23T17:26:19-04:00
Add a changelog entry
- - - - -
4fdfe757 by Alan Zimmerman at 2026-07-23T17:27:06-04:00
EPA: Keep decls together in ClassDecl
Similar to 1718230f4d3d19d8c49c0e5d496cb0fb6f399528 for HsValBindsLR,
this commit updates ClassDecl so that it no longer splits out the
assorted `LHsDecl GhcPs` until the renamer.
It does this by inserting a type family (separate from the classic TTG one) for this.
So
data TyClDecl
...
| ClassDecl {
...
tcdDecls :: XClassDecls pass
with
type instance XClassDecls GhcPs = [LHsDecl GhcPs]
type instance XClassDecls GhcRn = ClassDeclX GhcRn
type instance XClassDecls GhcTc = ClassDeclX GhcTc
data ClassDeclX pass
= ClassDeclX { tcdSigs :: [LSig pass], -- ^ Methods' signatures
tcdMeths :: LHsBinds pass, -- ^ Default methods
tcdATs :: [LFamilyDecl pass], -- ^ Associated types;
tcdATDefs :: [LTyFamDefltDecl pass], -- ^ Associated type defaults
tcdDocs :: [LDocDecl pass] -- ^ Haddock docs
}
- - - - -
f586c885 by Simon Jakobi at 2026-07-24T18:05:00-04:00
ci: Use shallow submodule clones by default
Limit submodule clones to depth one to reduce CI checkout costs. Keep
fetching full submodule history for the submodule lint jobs, which
inspect commits across a range.
Assisted-by: gpt-5.6-sol via Codex CLI
- - - - -
306120d2 by Duncan Coutts at 2026-07-24T18:05:43-04:00
Fix flaky test T3994 on FreeBSD
On current FreeBSD versions, calling getpgid on a zombie process fails.
In T3994, if we're really unlucky with delays and scheduling then we can
end up in exactly that situation.
Just catch that specific exception and ignore it. It's rare, and not our
fault.
- - - - -
7b116a0b by Cheng Shao at 2026-07-24T18:06:24-04:00
ci: add missing workaround for docker permissions in lint jobs
Some lint jobs use ci-images with default user `ghc`, and the gitlab
ci docker executor requires the `sudo chown` workaround to fix
workspace directory permission issue. This patch adds the missing
workarounds for the lint jobs. Fixes #27554.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
815149f3 by Andrzej Rybczak at 2026-07-25T15:06:43+00:00
Add -Wdefaulted-callstack
Adds a new warning, -Wdefaulted-callstack, which warns when an implicit
CallStack parameter is defaulted to the empty stack. In particular, this
includes call sites where a function with a HasCallStack constraint is called
from a definition that does *not* provide one. At such call sites the call stack
is cut off and does not include the enclosing definition's callers, which can be
a source of surprise if the user wants complete call stacks.
Closes #27077.
- - - - -
f6f2343f by Zubin Duggal at 2026-07-25T17:40:51-04:00
UniqueDFM: alter should preserve insertion order
Before it always inserting new elements at the end.
This is problematic because instances get inserted into the map with
`alterF`, which can change ordering of how instances are printed
with `:info` depending on the order in which we consult interfaces
I expect `alter id k = id` and `alter (fmap f) k = adjust f k`. Moving keys to
the end breaks that (`adjust` already preserves position).
Fixes #27532
- - - - -
e810c2cc by Simon Jakobi at 2026-07-27T21:39:10+02:00
Word64Map: add compareSize
compareSize m c compares the size of a map to an Int, but unlike
compare (size m) c it stops traversing the map once the outcome is
determined.
Based on https://github.com/haskell/containers/pull/1139
Assisted-by: Claude Opus 5
- - - - -
cf2a67c1 by Simon Jakobi at 2026-07-27T21:39:21+02:00
Use a placement sort for deterministic UniqDFM iteration
Deterministic UniqDFM iteration used a list mergesort, allocating O(n
log n) cons cells and contributing significantly to compiler allocations
(#27459).
Use a placement sort where appropriate, while retaining the mergesort
fallback. See Note [Sorting a UDFM] and Note [Cost of deterministic
iteration].
-------------------------
Metric Decrease:
InstanceMatching
InstanceMatching1
ManyAlternatives
T13719
-------------------------
Assisted-by: gpt-5.6-sol via Codex CLI
- - - - -
570 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/merge_request_templates/Default.md
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitlab/test-metrics.sh
- + changelog.d/21101
- + changelog.d/27380
- + changelog.d/27532
- + changelog.d/AbstractQ
- + changelog.d/T21628
- + changelog.d/T26532
- + changelog.d/T26716
- + changelog.d/T27123.md
- + changelog.d/T27314.md
- + changelog.d/T27329
- + changelog.d/T27360
- + changelog.d/T27374
- + changelog.d/T27456
- + changelog.d/fix-absent-dict-projection
- + changelog.d/fix-cmm-atomic-load-store
- + changelog.d/fix-compacting-gc-ap-27434
- + changelog.d/fix-layout-stack-fcall
- + changelog.d/fix-make-install-j
- + changelog.d/fix-peekitbl-no-tntc
- + changelog.d/fix-unreg
- + changelog.d/fix-use-std-ap-thunk
- + changelog.d/generically-mconcat
- + changelog.d/inter-module-far-jumps-aarch64-default
- changelog.d/semaphore-v2
- + changelog.d/warn-defaulted-callstack
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/ByteCode/Breakpoints.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/FastString.hs
- compiler/GHC/Data/IOEnv.hs
- compiler/GHC/Data/StringBuffer.hs
- compiler/GHC/Data/Word64Map/Internal.hs
- compiler/GHC/Data/Word64Map/Lazy.hs
- compiler/GHC/Data/Word64Map/Strict.hs
- compiler/GHC/Data/Word64Map/Strict/Internal.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main/Compile.hs
- compiler/GHC/Driver/Main/Hsc.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Basic.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Decls/Overlap.hs
- compiler/GHC/Hs/Doc.hs
- − compiler/GHC/Hs/Doc.hs-boot
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension.hs
- + compiler/GHC/Hs/Extension/Pass.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Lit.hs
- − compiler/GHC/Hs/Specificity.hs
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Breakpoints.hs
- + compiler/GHC/HsToCore/Breakpoints/Types.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Warnings.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Errors/Types.hs
- compiler/GHC/Parser/HaddockLex.x
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Parser/Types.hs
- compiler/GHC/Platform/Ways.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Doc.hs
- compiler/GHC/Rename/Env.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/Splice.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/Config.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Hole/FitTypes.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Gen/Splice.hs-boot
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Class.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Types/Rank.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/FieldLabel.hs
- compiler/GHC/Types/Fixity.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/GREInfo.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/InlinePragma.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/PkgQual.hs
- compiler/GHC/Types/SourceText.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Types/Unique/DFM.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/Module/Env.hs
- compiler/GHC/Unit/Module/ModGuts.hs
- compiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/GHC/Unit/Module/WholeCoreBindings.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/Language/Haskell/Syntax.hs
- compiler/Language/Haskell/Syntax/Basic.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/Doc.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- compiler/Language/Haskell/Syntax/Expr.hs-boot
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/Language/Haskell/Syntax/ImpExp.hs
- compiler/Language/Haskell/Syntax/Lit.hs
- compiler/Language/Haskell/Syntax/Module/Name.hs
- compiler/Language/Haskell/Syntax/Specificity.hs
- + compiler/Language/Haskell/Syntax/Text.hs
- compiler/Language/Haskell/Syntax/Type.hs
- − compiler/Language/Haskell/Syntax/Type.hs-boot
- compiler/ghc.cabal.in
- configure.ac
- distrib/configure.ac.in
- docs/users_guide/eventlog-formats.rst
- docs/users_guide/expected-undocumented-flags.txt
- docs/users_guide/exts/rank_polymorphism.rst
- docs/users_guide/exts/static_pointers.rst
- docs/users_guide/using-optimisation.rst
- docs/users_guide/using-warnings.rst
- ghc/GHCi/UI.hs
- hadrian/bindist/Makefile
- hadrian/cabal.project
- hadrian/cfg/system.config.host.in
- hadrian/cfg/system.config.target.in
- hadrian/src/Flavour.hs
- hadrian/src/Oracles/Flag.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Warnings.hs
- libraries/base/changelog.md
- libraries/base/src/GHC/Stack.hs
- libraries/base/src/System/Environment.hs
- libraries/base/tests/T15349.stderr
- libraries/base/tests/all.T
- libraries/ghc-boot/GHC/Data/ShortText.hs
- libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc
- libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingEnabled.hsc
- + libraries/ghc-heap/tests/T27465.hs
- + libraries/ghc-heap/tests/T27465.stdout
- libraries/ghc-heap/tests/all.T
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Conc/Sync.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Manager.hs
- libraries/ghc-internal/src/GHC/Internal/Event/TimerManager.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
- libraries/ghc-internal/src/GHC/Internal/Generics.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lib.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
- libraries/ghc-internal/tests/backtraces/T14532b.stdout
- libraries/ghci/GHCi/TH.hs
- libraries/semaphore-compat
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- m4/fp_check_pthreads.m4
- nofib
- rts/Apply.cmm
- rts/Capability.c
- rts/Capability.h
- rts/ContinuationOps.cmm
- rts/IOManager.c
- rts/IOManager.h
- rts/IOManagerInternals.h
- rts/Messages.c
- rts/PrimOps.cmm
- rts/Profiling.c
- rts/RaiseAsync.c
- rts/RaiseAsync.h
- rts/RtsStartup.c
- rts/RtsSymbols.c
- rts/STM.c
- rts/Schedule.c
- rts/Schedule.h
- rts/StgMiscClosures.cmm
- rts/Threads.c
- rts/Ticker.h
- rts/Timer.c
- rts/Timer.h
- rts/Trace.c
- rts/Trace.h
- rts/TraverseHeap.c
- rts/eventlog/EventLog.c
- rts/eventlog/EventLog.h
- rts/include/Cmm.h
- rts/include/rts/Constants.h
- rts/include/rts/EventLogFormat.h
- rts/include/rts/IOInterface.h
- rts/include/rts/NonMoving.h
- rts/include/rts/Timer.h
- rts/include/rts/storage/Closures.h
- rts/include/rts/storage/TSO.h
- rts/include/stg/MiscClosures.h
- rts/posix/FdWakeup.h
- + rts/posix/MIO.c
- + rts/posix/MIO.h
- rts/posix/Poll.c
- rts/posix/Poll.h
- rts/posix/Select.c
- rts/posix/Select.h
- rts/posix/Signals.c
- rts/posix/Signals.h
- rts/posix/Ticker.c
- rts/posix/Timeout.c
- rts/posix/Timeout.h
- rts/rts.cabal
- rts/sm/Compact.c
- rts/sm/GC.c
- rts/sm/NonMovingMark.c
- rts/sm/Sanity.c
- rts/sm/Scav.c
- rts/win32/AsyncMIO.c
- rts/win32/AsyncMIO.h
- rts/win32/AsyncWinIO.h
- rts/win32/AwaitEvent.c
- rts/win32/AwaitEvent.h
- rts/win32/ConsoleHandler.h
- rts/win32/MIOManager.h
- rts/win32/ThrIOManager.h
- rts/win32/Ticker.c
- rts/win32/WorkQueue.h
- rts/win32/veh_excn.h
- testsuite/driver/junit.py
- testsuite/driver/perf_notes.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/tests/arityanal/should_compile/T21755.stderr
- testsuite/tests/arityanal/should_compile/all.T
- testsuite/tests/backpack/should_compile/T13149.bkp
- testsuite/tests/bytecode/TLinkable/all.T
- testsuite/tests/cmm/should_compile/all.T
- testsuite/tests/cmm/should_run/AtomicFetch.hs
- testsuite/tests/cmm/should_run/AtomicFetch_cmm.cmm
- + testsuite/tests/cmm/should_run/T27447.hs
- + testsuite/tests/cmm/should_run/T27447.stdout
- + testsuite/tests/cmm/should_run/T27447_cmm.cmm
- testsuite/tests/cmm/should_run/all.T
- testsuite/tests/codeGen/should_compile/T25177.stderr
- testsuite/tests/codeGen/should_run/cgrun025.stderr
- + testsuite/tests/concurrent/should_run/T27105.hs
- testsuite/tests/concurrent/should_run/all.T
- testsuite/tests/core-to-stg/T25284/Cls.hs
- + testsuite/tests/core-to-stg/T25924/B.hs
- + testsuite/tests/core-to-stg/T25924/Main.hs
- + testsuite/tests/core-to-stg/T25924/all.T
- + testsuite/tests/core-to-stg/T25924a.hs
- + testsuite/tests/core-to-stg/T25924a.stdout
- testsuite/tests/core-to-stg/all.T
- + testsuite/tests/corelint/T27374.hs
- testsuite/tests/corelint/all.T
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/deSugar/should_fail/all.T
- testsuite/tests/deSugar/should_run/all.T
- testsuite/tests/deriving/should_compile/all.T
- testsuite/tests/determinism/determ017/A.hs
- testsuite/tests/dmdanal/should_compile/T18982.stderr
- testsuite/tests/driver/options_ghc/Mod_fbyte_code.hs
- testsuite/tests/driver/options_ghc/all.T
- testsuite/tests/driver/options_ghc/options_ghc_fbyte-code.stderr
- testsuite/tests/exceptions/T26759.stderr
- testsuite/tests/generics/GenDerivOutput.hs
- testsuite/tests/generics/GenDerivOutput1_0.hs
- testsuite/tests/generics/GenDerivOutput1_1.hs
- testsuite/tests/generics/T10604/T10604_deriving.hs
- testsuite/tests/generics/T10604/all.T
- + testsuite/tests/generics/T27245.hs
- + testsuite/tests/generics/T27245.stdout
- testsuite/tests/generics/all.T
- testsuite/tests/ghc-api/T25121_status.stdout
- testsuite/tests/ghc-api/annotations-literals/literals.stdout
- testsuite/tests/ghc-api/annotations-literals/parsed.hs
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail7.stderr
- testsuite/tests/ghci/T16793/T16793.stdout
- testsuite/tests/ghci/T18060/T18060.stdout
- + testsuite/tests/ghci/T27532/Makefile
- + testsuite/tests/ghci/T27532/T27532.stdout
- + testsuite/tests/ghci/T27532/T27532j4.stdout
- + testsuite/tests/ghci/T27532/a.script
- + testsuite/tests/ghci/T27532/all.T
- + testsuite/tests/ghci/T27532/b.script
- + testsuite/tests/ghci/T27532/genT27532Modules
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T12005.script
- testsuite/tests/ghci/scripts/T4175.stdout
- testsuite/tests/ghci/scripts/T8469.stdout
- testsuite/tests/ghci/scripts/T8535.stdout
- testsuite/tests/ghci/scripts/T9881.stdout
- testsuite/tests/ghci/scripts/all.T
- + testsuite/tests/ghci/scripts/bytecodeIPE.hs
- + testsuite/tests/ghci/scripts/bytecodeIPE.script
- + testsuite/tests/ghci/scripts/bytecodeIPE.stdout
- testsuite/tests/ghci/scripts/ghci020.stdout
- testsuite/tests/ghci/scripts/ghci064.stdout
- testsuite/tests/ghci/should_run/Makefile
- testsuite/tests/ghci/should_run/T10145.stdout
- testsuite/tests/ghci/should_run/T18594.stdout
- + testsuite/tests/ghci/should_run/T27287.hs
- + testsuite/tests/ghci/should_run/T27287.stdout
- testsuite/tests/ghci/should_run/all.T
- testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
- testsuite/tests/haddock/perf/Fold.hs
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
- testsuite/tests/indexed-types/should_fail/T7354.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/template-haskell-exports.stdout
- testsuite/tests/layout/layout001.stdout
- testsuite/tests/layout/layout002.stdout
- testsuite/tests/layout/layout003.stdout
- testsuite/tests/layout/layout004.stdout
- testsuite/tests/layout/layout005.stdout
- testsuite/tests/layout/layout006.stdout
- testsuite/tests/layout/layout007.stdout
- testsuite/tests/layout/layout008.stdout
- testsuite/tests/layout/layout009.stdout
- testsuite/tests/linear/should_compile/T1735Min.hs
- testsuite/tests/mdo/should_fail/mdofail006.stderr
- + testsuite/tests/module/T27380.hs
- + testsuite/tests/module/T27380.stderr
- testsuite/tests/module/all.T
- testsuite/tests/module/mod184.stderr
- testsuite/tests/module/mod185.stderr
- testsuite/tests/numeric/should_compile/T15547.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- + testsuite/tests/parser/should_compile/T13087.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20718b.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/parser/should_compile/T23315/T23315.stderr
- testsuite/tests/parser/should_compile/all.T
- testsuite/tests/parser/should_fail/T8431.stderr
- testsuite/tests/parser/should_fail/readFail038.stderr
- + testsuite/tests/parser/should_run/StringStartsWithNull.hs
- + testsuite/tests/parser/should_run/StringStartsWithNull.stdout
- testsuite/tests/parser/should_run/all.T
- testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
- testsuite/tests/perf/compiler/T3064.hs
- testsuite/tests/perf/compiler/all.T
- testsuite/tests/perf/compiler/hard_hole_fits.stderr
- + testsuite/tests/pmcheck/should_compile/T27314.hs
- + testsuite/tests/pmcheck/should_compile/T27360.hs
- testsuite/tests/pmcheck/should_compile/all.T
- testsuite/tests/polykinds/T7594.hs
- testsuite/tests/printer/AnnotationNoListTuplePuns.stdout
- testsuite/tests/printer/T18052a.stderr
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- testsuite/tests/printer/all.T
- testsuite/tests/process/T3994.hs
- testsuite/tests/profiling/perf/T23103/all.T
- testsuite/tests/profiling/should_run/all.T
- testsuite/tests/programs/thurston-modular-arith/Main.hs
- + testsuite/tests/rename/should_fail/T21101.hs
- + testsuite/tests/rename/should_fail/T21101.stderr
- testsuite/tests/rename/should_fail/T9815.stderr
- testsuite/tests/rename/should_fail/T9815b.stderr
- testsuite/tests/rename/should_fail/T9815bghci.stderr
- testsuite/tests/rename/should_fail/T9815ghci.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/roles/should_compile/Roles14.stderr
- testsuite/tests/roles/should_compile/Roles3.stderr
- testsuite/tests/roles/should_compile/Roles4.stderr
- testsuite/tests/roles/should_compile/T8958.stderr
- testsuite/tests/rts/T17574.hs
- testsuite/tests/rts/T19381.hs
- + testsuite/tests/rts/T27123.hs
- + testsuite/tests/rts/T27434.hs
- + testsuite/tests/rts/T27434.stdout
- testsuite/tests/rts/all.T
- testsuite/tests/rts/ipe/IpeStats/Fold.hs
- testsuite/tests/rts/ipe/T24005/all.T
- testsuite/tests/runghc/T7859.stderr-mingw32
- testsuite/tests/showIface/DocsInHiFile1.stdout
- testsuite/tests/showIface/HaddockSpanIssueT24378.stdout
- testsuite/tests/showIface/MagicHashInHaddocks.stdout
- testsuite/tests/showIface/NoExportList.stdout
- testsuite/tests/simd/should_run/doublex2_arith.hs
- testsuite/tests/simd/should_run/doublex2_arith.stdout
- testsuite/tests/simd/should_run/doublex2_arith_baseline.hs
- testsuite/tests/simd/should_run/doublex2_arith_baseline.stdout
- testsuite/tests/simd/should_run/doublex2_fma.hs
- testsuite/tests/simd/should_run/doublex2_fma.stdout
- testsuite/tests/simd/should_run/simd010.hs
- testsuite/tests/simplCore/should_compile/DataToTagFamilyScrut.stderr
- testsuite/tests/simplCore/should_compile/T11562.hs
- testsuite/tests/simplCore/should_compile/T14978.stdout
- testsuite/tests/simplCore/should_compile/T18013.stderr
- testsuite/tests/simplCore/should_compile/T24229a.stderr
- testsuite/tests/simplCore/should_compile/T24229b.stderr
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/simplCore/should_run/T3591.hs
- testsuite/tests/typecheck/should_compile/DeepSubsumption02.hs
- testsuite/tests/typecheck/should_compile/T12507.hs
- testsuite/tests/typecheck/should_compile/T13951.hs
- testsuite/tests/typecheck/should_compile/T15242.stderr
- testsuite/tests/typecheck/should_compile/T18406b.stderr
- testsuite/tests/typecheck/should_compile/T18529.stderr
- testsuite/tests/typecheck/should_compile/T18920.hs
- testsuite/tests/typecheck/should_compile/T2595.hs
- testsuite/tests/typecheck/should_compile/T7541.hs
- + testsuite/tests/typecheck/should_compile/WarnDefaultedCallStack.hs
- + testsuite/tests/typecheck/should_compile/WarnDefaultedCallStack.stderr
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T15067.stderr
- + testsuite/tests/typecheck/should_fail/T26532.hs
- + testsuite/tests/typecheck/should_fail/T26532.stderr
- testsuite/tests/typecheck/should_fail/T5300.stderr
- testsuite/tests/typecheck/should_fail/T6069.stderr
- testsuite/tests/typecheck/should_fail/T7368a.hs
- testsuite/tests/typecheck/should_fail/T9858b.stderr
- testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr
- testsuite/tests/typecheck/should_fail/all.T
- testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs
- testsuite/tests/typecheck/should_run/T3731-short.hs
- testsuite/tests/typecheck/should_run/T3731.hs
- testsuite/tests/typecheck/should_run/church.hs
- testsuite/tests/typecheck/should_run/tcrun008.hs
- testsuite/tests/typecheck/should_run/tcrun017.hs
- testsuite/tests/typecheck/should_run/tcrun026.hs
- testsuite/tests/typecheck/should_run/tcrun035.hs
- testsuite/tests/typecheck/should_run/tcrun036.hs
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/check-exact/check-exact.cabal
- utils/deriveConstants/Main.hs
- utils/haddock/haddock-api/haddock-api.cabal
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.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/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.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/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2e96e50f9651bf222e05098df6db34…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2e96e50f9651bf222e05098df6db34…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
Zubin pushed to branch wip/9.14.2-backports at Glasgow Haskell Compiler / GHC
Commits:
1ba96b2f by Zubin Duggal at 2026-07-27T22:12:24+05:30
Prepare 9.14.2
Bump filpath submodule to 1.5.5.0
Bump Win32 submodule to 2.14.2.2
Metric Increase:
T4029
T13379
libdir
Metric Decrease:
T5030
T24602_perf_size
T25046_perf_size_gzip
T25046_perf_size_unicode
T25046_perf_size_unicode_gzip
- - - - -
44 changed files:
- − changelog.d/26616
- − changelog.d/T26978
- − changelog.d/T26979
- − changelog.d/T27046
- − changelog.d/T27047
- − changelog.d/T27123.md
- − changelog.d/T27124.md
- − changelog.d/T27131
- − changelog.d/T27182.md
- − changelog.d/T27202
- − changelog.d/T27225
- − changelog.d/T27386
- − changelog.d/bump-process
- − changelog.d/deterministic-usage-order
- − changelog.d/fix-absent-dict-projection
- − changelog.d/fix-blackhole-handling
- − changelog.d/fix-cmm-atomic-load-store
- − changelog.d/fix-compacting-gc-ap-27434
- − changelog.d/fix-exponential-case-desugar-27383
- − changelog.d/fix-finalizers-27072
- − changelog.d/fix-layout-stack-fcall
- − changelog.d/fix-peekitbl-no-tntc
- − changelog.d/fix-use-std-ap-thunk
- − changelog.d/ghc-pkg-faster-closure
- − changelog.d/hadrian-stale-package-confs-26661
- − changelog.d/jobserver-leak-fix
- − changelog.d/more-efficient-home-unit-imports-finding
- − changelog.d/reexported-module-errors
- − changelog.d/semaphore-v2
- − changelog.d/tag-inference-27005
- − changelog.d/unused-type
- − changelog.d/wasm-fix-serviceworker
- − changelog.d/windows-rethrow-overlapped-exception
- configure.ac
- docs/users_guide/9.14.2-notes.rst
- hadrian/bootstrap/generate_bootstrap_plans
- + hadrian/bootstrap/plan-9_10_3.json
- + hadrian/bootstrap/plan-9_12_4.json
- + hadrian/bootstrap/plan-bootstrap-9_10_3.json
- + hadrian/bootstrap/plan-bootstrap-9_12_4.json
- libraries/Win32
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/filepath
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1ba96b2fb2ad00b4c08472723f5d3d1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1ba96b2fb2ad00b4c08472723f5d3d1…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: UniqueDFM: alter should preserve insertion order
by Marge Bot (@marge-bot) 27 Jul '26
by Marge Bot (@marge-bot) 27 Jul '26
27 Jul '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f6f2343f by Zubin Duggal at 2026-07-25T17:40:51-04:00
UniqueDFM: alter should preserve insertion order
Before it always inserting new elements at the end.
This is problematic because instances get inserted into the map with
`alterF`, which can change ordering of how instances are printed
with `:info` depending on the order in which we consult interfaces
I expect `alter id k = id` and `alter (fmap f) k = adjust f k`. Moving keys to
the end breaks that (`adjust` already preserves position).
Fixes #27532
- - - - -
1ca53c1f by fendor at 2026-07-27T11:50:43-04:00
Introduce global unit database cache
As a first step for better sharing of `UnitInfo` across `UnitEnv`,
we introduce a new datatype called `ExternalUnitDatabases`.
It primarily serves as an in-memory representation of *all*
`UnitDatabase`s across `UnitEnv`. This means, if multiple `HomeUnitEnv`s
depend on the same database, one way or another, we make sure that we
don't parse from disk every time.
Instead, we store the in-memory representation in `ExternalUnitDatabases`.
`ExternalUnitDatabaseCache` is the equivalent of `ExternalUnitState` in
the `UnitEnv`. It is a mutable variable wrapping `ExternalUnitDatabases`.
The mutable `ExternalUnitDatabaseCache` is used in `initUnits` to make
sure we don't parse the same unit database multiple times.
Almost by accident, we change the semantics of `initUnits` to honour
modifications to `packageDBFlags`.
The inability to change `packageDBFlags` while also reusing the already
parsed `UnitDatabase`s was reported in #26423 as a bug.
Hence, we think this behaviour change is warranted and acceptable,
especially since it comes with a breaking change to the `initUnits` API.
Add regression test for #26423
Closes #26423
- - - - -
2ebd59b9 by fendor at 2026-07-27T11:50:43-04:00
Introduce UnitIndex for global external unit caching
`UnitInfo`s have been observed to cause a lot of memory usage in #27500.
Especially with multiple home units, as the same (external) units are
processed from scratch, even though most of the time we end up with
exactly the same `UnitInfo`.
We introduce a `UnitEnv` global cache that allows us to store external
unit information that is used across all `HomeUnitEnv`s.
The most important change in this commit is the introduction of the `UnitIndex`.
It stores a global mapping of `UnitId` -> `UnitInfo`, and `initUnits`
always uses the cached `UnitInfo` entry to populate each
`HomeUnitEnv`'s `UnitState`.
This allows us to ensure the following property:
> Each `UnitInfo` should be alive exactly once in GHC.
All `UnitState`s should reference 'UnitInfo's stored in the 'UnitIndex'.
This ensured by calling 'initUnits' with the 'UnitIndex'.
In addition, the `ExternalUnitDatabases` may also hold a reference
to each on-disk representation of `UnitInfo`.
This means, we impose an hard upper bound on the number of `UnitInfo`s
alive in the GHC session:
> The number of alive `UnitInfo`s closure objects must be the
> sum of all loaded unit database times two.
We add performance regression tests that make sure the number of live
`UnitInfo` cannot exceed this threshold.
Closes #27500
-------------------------
Metric Decrease:
MultiComponentModules
MultiComponentModulesRecomp
MultiComponentModulesRecomp100
mhu-perf
LinkableUsage02
-------------------------
These metrics increases are especially notable, as we are not even
sharing anything big but merely the global package database with 50
entries.
It shows how careful sharing of `UnitInfo` can improve memory usage.
We expect this to be much more notable when the whole cabal package
database is shared across multiple home units.
`LinkableUsage02` metric decreases on unreg and i386 platform, only.
---
Technical details
To share the `UnitInfo`s correctly, it is important that we extract
the `WireMap` into the `UnitIndex`. At the moment of writing, `WireMap`
must be globally the same for all `HomeUnitEnv`s.
This is important, as we could otherwise not cache the "fully-resolved"
`UnitInfo`, as we don't change the `UnitId` or `unitAbiHash` when
resolving wired-in units. Thus, there could be ambiguities, when the
`WireMap` is not the same for all `UnitState`s across the `UnitEnv`.
We consider a `UnitInfo` fully-resolved, if wired-in units have been
updated, the `UnitInfo` has been validated and variables in the unit
config, such as `${pkgroot}` have been resolved.
Updating the wired-in units requires the `WireMap` to be globally the
same.
- - - - -
1432b4f7 by Zubin Duggal at 2026-07-27T11:50:44-04:00
testsuite: skip runtime stats tests on debugged compilers
Debugged flavours build the boot libraries without optimisation, so the
runtime numbers do not match the baselines.
- - - - -
313a0675 by Zubin Duggal at 2026-07-27T11:50:44-04:00
testsuite: mark #20706 tests fragile rather than broken
Whether the static linux linker issues manifest depends on the host
toolchain.
- - - - -
2be7ecab by Zubin Duggal at 2026-07-27T11:50:44-04:00
testsuite: exclude libnuma from mostly-static
It needs static system libraries (libnuma.a) that many platforms do not
ship.
Fixes #26914
- - - - -
84 changed files:
- + changelog.d/27532
- + changelog.d/T26423
- + changelog.d/unit-index
- compiler/GHC.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Main/Hsc.hs
- compiler/GHC/Driver/Main/Interactive.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Types/Unique/DFM.hs
- compiler/GHC/Unit/Env.hs
- + compiler/GHC/Unit/External/Database.hs
- + compiler/GHC/Unit/External/Index.hs
- + compiler/GHC/Unit/External/ModuleOrigin.hs
- + compiler/GHC/Unit/External/Providers.hs
- + compiler/GHC/Unit/External/Query.hs
- + compiler/GHC/Unit/External/Substitution.hs
- + compiler/GHC/Unit/External/Validate.hs
- + compiler/GHC/Unit/External/Visibility.hs
- + compiler/GHC/Unit/External/Wired.hs
- compiler/GHC/Unit/Home/Graph.hs
- compiler/GHC/Unit/Info.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Unit/State.hs-boot
- compiler/GHC/Unit/Types.hs
- compiler/ghc.cabal.in
- ghc/GHCi/UI.hs
- hadrian/src/Rules/Generate.hs
- testsuite/driver/testlib.py
- testsuite/tests/count-deps/CountDepsParser.stdout
- + testsuite/tests/driver/T26423/Hello.hs
- + testsuite/tests/driver/T26423/Makefile
- + testsuite/tests/driver/T26423/T26423.hs
- + testsuite/tests/driver/T26423/T26423.stderr
- + testsuite/tests/driver/T26423/T26423.stdout
- + testsuite/tests/driver/T26423/all.T
- + testsuite/tests/driver/T26423/test/Test.hs
- + testsuite/tests/driver/T26423/test/test.pkg
- + testsuite/tests/driver/TUnitInfo/Foo.hs
- + testsuite/tests/driver/TUnitInfo/Makefile
- + testsuite/tests/driver/TUnitInfo/all.T
- + testsuite/tests/driver/TUnitInfo/genMhu.sh
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space-mhu.stdout
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space-single.stdout
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space.hs
- + testsuite/tests/driver/TUnitInfo/generic-unit-info-space.stdout
- testsuite/tests/driver/all.T
- testsuite/tests/driver/mostly-static/Makefile
- testsuite/tests/ghci/T13786/all.T
- testsuite/tests/ghci/T16793/T16793.stdout
- testsuite/tests/ghci/T18060/T18060.stdout
- + testsuite/tests/ghci/T27532/Makefile
- + testsuite/tests/ghci/T27532/T27532.stdout
- + testsuite/tests/ghci/T27532/T27532j4.stdout
- + testsuite/tests/ghci/T27532/a.script
- + testsuite/tests/ghci/T27532/all.T
- + testsuite/tests/ghci/T27532/b.script
- + testsuite/tests/ghci/T27532/genT27532Modules
- testsuite/tests/ghci/linking/all.T
- testsuite/tests/ghci/linking/dyn/all.T
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T4175.stdout
- testsuite/tests/ghci/scripts/T8469.stdout
- testsuite/tests/ghci/scripts/T8535.stdout
- testsuite/tests/ghci/scripts/T9881.stdout
- testsuite/tests/ghci/scripts/ghci020.stdout
- testsuite/tests/ghci/scripts/ghci064.stdout
- testsuite/tests/ghci/should_run/T10145.stdout
- testsuite/tests/ghci/should_run/T18594.stdout
- testsuite/tests/package/T20010/all.T
- testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
- testsuite/tests/plugins/all.T
- testsuite/tests/roles/should_compile/Roles14.stderr
- testsuite/tests/roles/should_compile/Roles3.stderr
- testsuite/tests/roles/should_compile/Roles4.stderr
- testsuite/tests/roles/should_compile/T8958.stderr
- testsuite/tests/rts/all.T
- testsuite/tests/rts/linker/all.T
- testsuite/tests/typecheck/should_compile/T18406b.stderr
- testsuite/tests/typecheck/should_compile/T18529.stderr
- testsuite/tests/typecheck/should_fail/T5300.stderr
- utils/haddock/haddock-api/src/Haddock.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7171578b05172a2b8c3a04cf3202e5…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7171578b05172a2b8c3a04cf3202e5…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/spj-reinstallable-base2] Make GHC.Essentials a hidden module
by sheaf (@sheaf) 27 Jul '26
by sheaf (@sheaf) 27 Jul '26
27 Jul '26
sheaf pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
e986375e by sheaf at 2026-07-27T16:32:29+02:00
Make GHC.Essentials a hidden module
- - - - -
12 changed files:
- compiler/GHC/Builtin.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Parser/Header.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/State.hs
- libraries/base/base.cabal.in
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- utils/dump-decls/Main.hs
Changes:
=====================================
compiler/GHC/Builtin.hs
=====================================
@@ -225,8 +225,7 @@ How known-occ entities work
This is a big reason for (KnownOccNameInvariant): an export list cannot have two
entities with the same OccName.
- When GHC wants to find GHC.Essentials, it just looks for it in the same
- way as any other import.
+ See Note [Finding GHC.Essentials] for how GHC finds the GHC.Essentials module.
* There are three flags that control the treatment of known entities:
-frebindable-known-names
@@ -412,10 +411,9 @@ To make `wombat` into a known-key name, do the following.
* Just like for known-occ names above, in any module in `base` or `ghc-internal` (which
are compiled with -frebindable-known-names), ensure that `wombat` is
in scope by saying `import M( wombat )`.
--}
-{- Note [Known entities and reinstallable base]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Note [Known entities and reinstallable base]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The design of known-entities in GHC, described in Note [Overview of known entities],
is carefully crafted to support a single version of GHC to compile different
versions of base, even though GHC itself is compiled against a fixed version of
@@ -453,6 +451,23 @@ Let's compare two examples: `coerce` and `enumFromTo`.
`enumFromTo` (see `GHC.Iface.Load.lookupKnownOccName`). This means GHC never
needs to know where precisely `enumFromTo` is defined, allowing it to be
defined anywhere (wherever in `base`, or in a module imported by `base`).
+
+Note [Finding GHC.Essentials]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+As GHC.Essentials is an implementation detail for GHC, we would really rather
+not expose this module from base.
+
+Achieving this requires a little bit of care:
+
+ (FindEssentials1)
+ When looking up GHC.Essentials in GHC.Iface.Load.findEssentialsModule,
+ allow the module to be hidden (as long as the unit isn't hidden) by calling
+ 'findImportedModuleAllowHidden'.
+
+ (FindEssentials2)
+ To ensure the implicit module graph edge added in GHC.Parser.Header.getImportEdges
+ is properly resolved during downsweep, we use 'findImportedModuleAllowHidden'
+ in GHC.Driver.Downsweep.
-}
{-
=====================================
compiler/GHC/Driver/Downsweep.hs
=====================================
@@ -78,7 +78,7 @@ import GHC.Types.Unique.Map
import GHC.Types.PkgQual
import GHC.Types.Basic
-
+import GHC.Builtin.Modules( eSSENTIALS_NAME )
import GHC.Unit
import GHC.Unit.Env
import GHC.Unit.Finder
@@ -1373,10 +1373,20 @@ summariseModuleDispatch k hsc_env' home_unit is_boot (L _ wanted_mod) mb_pkg exc
-- happen relative to it
hsc_env = hscSetActiveHomeUnit home_unit hsc_env'
- find_it :: IO SummariseResult
+ find_module :: IO FindResult
+ find_module
+ | wanted_mod == eSSENTIALS_NAME
+ -- The implicit edge to GHC.Essentials added by 'getImportEdges' must be
+ -- resolved even when GHC.Essential is a hidden module.
+ --
+ -- See (FindEssentials2) in Note [Finding GHC.Essentials] in GHC.Builtin.
+ = findImportedModuleAllowHidden hsc_env wanted_mod mb_pkg
+ | otherwise
+ = findImportedModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg
+ find_it :: IO SummariseResult
find_it = do
- found <- findImportedModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg
+ found <- find_module
case found of
Found location mod
| moduleUnitId mod `Set.member` hsc_all_home_unit_ids hsc_env ->
=====================================
compiler/GHC/Iface/Errors/Ppr.hs
=====================================
@@ -210,7 +210,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
-- package flags when making suggestions. ToDo: if the original package
-- also has a reexport, prefer that one
pp_sugg (SuggestVisible m mod o) = ppr m <+> provenance o
- where provenance ModHidden = empty
+ where provenance (ModHidden {}) = empty
provenance (ModUnusable _) = empty
provenance (ModOrigin{ fromOrigUnit = e,
fromExposedReexport = res,
@@ -227,7 +227,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
<+> ppr mod)
| otherwise = empty
pp_sugg (SuggestHidden m mod o) = ppr m <+> provenance o
- where provenance ModHidden = empty
+ where provenance (ModHidden {}) = empty
provenance (ModUnusable _) = empty
provenance (ModOrigin{ fromOrigUnit = e,
fromHiddenReexport = rhs })
@@ -261,7 +261,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst
where
pprMod (m, o) = text "it is bound as" <+> ppr m <+>
text "by" <+> pprOrigin m o
- pprOrigin _ ModHidden = panic "cantFindErr: bound by mod hidden"
+ pprOrigin _ (ModHidden {}) = panic "cantFindErr: bound by mod hidden"
pprOrigin _ (ModUnusable _) = panic "cantFindErr: bound by mod unusable"
pprOrigin m (ModOrigin e res _ f) = sep $ punctuate comma (
if e == Just True
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -302,13 +302,14 @@ loadKnownKeyOccMaps
-- We don't have a KnownKeyOccMap yet, so create it
-- from the interface file for KnownKeyName
do { hsc_env <- getTopEnv
- ; mb_res <- liftIO $ findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
- ; case mb_res of
- Found _ mod -> Succeeded <$> build_maps mod
- fr -> return (Failed (CantFindEssentials
- (cannotFindModule hsc_env eSSENTIALS_NAME fr)
- UnknownLoadEssentialsReason))
- } } }
+ ; res <- liftIO $ findEssentialsModule hsc_env
+ ; case res of
+ Succeeded mod -> Succeeded <$> build_maps mod
+ Failed err ->
+ return $ Failed $
+ CantFindEssentials err UnknownLoadEssentialsReason
+ }}}
+
where
doc = text "Need interface for KnownKeyNames"
@@ -374,21 +375,33 @@ checkKnownKeyNamesIface known_key_names_occ_map
-- | Lookup the module exporting the canonical known-entities definitions (GHC.Essentials)
lookupKnownKeysModule :: HscEnv -> DynFlags {-^ Module dyn flags -} -> IO (Maybe Module)
-lookupKnownKeysModule hsc_env dflags = do
- eps <- hscEPS hsc_env
- case eps_known_keys eps of
- Just (_, kk_mod) -> return (Just kk_mod)
- Nothing -> do
- found_essentials <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual
- let rebindable_kn = gopt Opt_RebindableKnownNames dflags
- let essentials_uid
- | rebindable_kn = return Nothing
- | Found _ mod <- found_essentials = return (Just mod)
- | fr <- found_essentials = do
- throwOneError (initSourceErrorContext dflags) $
- mkPlainErrorMsgEnvelope noSrcSpan $ GhcDriverMessage $ DriverInterfaceError $
- CantFindEssentials (cannotFindModule hsc_env eSSENTIALS_NAME fr) LookingForEssentialsModule
- essentials_uid
+lookupKnownKeysModule hsc_env dflags
+ | gopt Opt_RebindableKnownNames dflags
+ = return Nothing
+ | otherwise
+ = do { eps <- hscEPS hsc_env
+ ; case eps_known_keys eps of
+ { Just (_, kk_mod) -> return (Just kk_mod)
+ ; Nothing ->
+ do { mb_mod <- findEssentialsModule hsc_env
+ ; case mb_mod of
+ { Succeeded mod -> return (Just mod)
+ ; Failed err ->
+ throwOneError (initSourceErrorContext dflags) $
+ mkPlainErrorMsgEnvelope noSrcSpan $
+ GhcDriverMessage $ DriverInterfaceError $
+ CantFindEssentials err LookingForEssentialsModule
+ }}}}
+
+-- | Find the GHC.Essentials module.
+--
+-- See Note [Finding GHC.Essentials] in GHC.Builtin.
+findEssentialsModule :: HscEnv -> IO (MaybeErr MissingInterfaceError Module)
+findEssentialsModule hsc_env = do
+ fr <- findImportedModuleAllowHidden hsc_env eSSENTIALS_NAME NoPkgQual
+ return $ case fr of
+ Found _ mod -> Succeeded mod
+ _ -> Failed $ cannotFindModule hsc_env eSSENTIALS_NAME fr
{- *********************************************************************
* *
=====================================
compiler/GHC/Parser/Header.hs
=====================================
@@ -114,7 +114,8 @@ getImportEdges dflags buf filename source_filename = do
convImport (L _ (i :: ImportDecl GhcPs)) = (convImportLevel (ideclLevelSpec i), ideclPkgQual i, reLoc $ ideclName i)
convImport_src (L _ (i :: ImportDecl GhcPs)) = (reLoc $ ideclName i)
- known_key_name_edges -- Add an edge to GHC.Essentials, unless -frebindable-known-names is on
+ -- Add an edge to GHC.Essentials, unless -frebindable-known-names is on
+ known_key_name_edges
| rebindable_kn = []
| otherwise = [(NormalLevel, NoRawPkgQual, noLoc eSSENTIALS_NAME)]
in
=====================================
compiler/GHC/Unit/Finder.hs
=====================================
@@ -14,6 +14,7 @@ module GHC.Unit.Finder (
FinderCache(..),
initFinderCache,
findImportedModule,
+ findImportedModuleAllowHidden,
findImportedModuleWithIsBoot,
findPluginModule,
findExactModule,
@@ -172,24 +173,42 @@ getDirHash dir = do
return hash
-- -----------------------------------------------------------------------------
--- The three external entry points
-
+-- External entry points
+
+-- | Should a module which is not in its unit's @exposed-modules@ still be
+-- found, provided the unit itself is visible?
+data HiddenModulePolicy
+ -- | Normal behaviour (e.g. user-written imports): don't find hidden modules.
+ = RejectHiddenModules
+ -- | Allow hidden modules (from non-hidden units) to be found.
+ --
+ -- See Note [Finding GHC.Essentials] in GHC.Builtin.
+ | AcceptHiddenModules
-- | Locate a module that was imported by the user. We have the
-- module's name, and possibly a package name. Without a package
-- name, this function will use the search path and the known exposed
-- packages to find the module, if a package is specified then only
-- that package is searched for the module.
-
findImportedModule :: HscEnv -> ModuleName -> PkgQual -> IO FindResult
-findImportedModule hsc_env mod pkg_qual =
+findImportedModule = findImportedModule_policy RejectHiddenModules
+
+-- | Like 'findImportedModule', but also finds hidden modules (from non-hidden units).
+--
+-- See (FindEssentials1) in Note [Finding GHC.Essentials] in GHC.Builtin.
+findImportedModuleAllowHidden :: HscEnv -> ModuleName -> PkgQual -> IO FindResult
+findImportedModuleAllowHidden = findImportedModule_policy AcceptHiddenModules
+
+-- | Internal helper for 'findImportedModule' and 'findImportedModuleAllowHidden'.
+findImportedModule_policy :: HiddenModulePolicy -> HscEnv -> ModuleName -> PkgQual -> IO FindResult
+findImportedModule_policy policy hsc_env mod pkg_qual =
let fc = hsc_FC hsc_env
mb_home_unit = hsc_home_unit_maybe hsc_env
dflags = hsc_dflags hsc_env
fopts = initFinderOpts dflags
in do
let home_module_name_providers_map = mgHomeModuleNameProvidersMap (hsc_mod_graph hsc_env)
- findImportedModuleNoHsc fc fopts (hsc_unit_env hsc_env) home_module_name_providers_map mb_home_unit mod pkg_qual
+ findImportedModuleNoHsc policy fc fopts (hsc_unit_env hsc_env) home_module_name_providers_map mb_home_unit mod pkg_qual
findImportedModuleWithIsBoot :: HscEnv -> ModuleName -> IsBootInterface -> PkgQual -> IO FindResult
findImportedModuleWithIsBoot hsc_env mod is_boot pkg_qual = do
@@ -199,7 +218,8 @@ findImportedModuleWithIsBoot hsc_env mod is_boot pkg_qual = do
_ -> return res
findImportedModuleNoHsc
- :: FinderCache
+ :: HiddenModulePolicy
+ -> FinderCache
-> FinderOpts
-> UnitEnv
-> HomeModuleNameProvidersMap
@@ -207,7 +227,7 @@ findImportedModuleNoHsc
-> ModuleName
-> PkgQual
-> IO FindResult
-findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit mod_name mb_pkg =
+findImportedModuleNoHsc policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name mb_pkg =
case mb_pkg of
NoPkgQual -> unqual_import
ThisPkg uid | (homeUnitId <$> mb_home_unit) == Just uid -> home_import
@@ -231,13 +251,13 @@ findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit
NoPackage (panic "findImportedModule: no home-unit")
home_pkg_import :: (UnitId, FinderOpts) -> IO FindResult
- home_pkg_import = findHomeUnitDepModule fc ue home_module_name_providers_map mod_name
+ home_pkg_import = findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name
pkg_import :: IO FindResult
- pkg_import = findExposedPackageModule fc fopts unit_state mod_name mb_pkg
+ pkg_import = findExposedPackageModule_policy policy fc fopts unit_state mod_name mb_pkg
unqual_import :: IO FindResult
- unqual_import = findHomeOrRegularPackageModule fc fopts ue
+ unqual_import = findHomeOrRegularPackageModule policy fc fopts ue
home_module_name_providers_map mb_home_unit mod_name
unit_state :: UnitState
@@ -263,7 +283,7 @@ findPluginModuleNoHsc
-> ModuleName
-> IO FindResult
findPluginModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit@(Just home_unit) mod_name =
- findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map
+ findHomeModuleAmongDeps RejectHiddenModules fc fopts ue home_module_name_providers_map
mb_home_unit mod_name
`orIfNotFound`
findExposedPluginPackageModule fc fopts unit_state mod_name
@@ -339,21 +359,23 @@ homeUnitDepsFinderOpts ue home_module_name_providers_map unit_state mod_name =
-- | Search for @mod_name@ in the given home unit.
findHomeUnitDepModule
- :: FinderCache
+ :: HiddenModulePolicy
+ -> FinderCache
-> UnitEnv
-> HomeModuleNameProvidersMap
-> ModuleName
-> (UnitId, FinderOpts)
-> IO FindResult
-findHomeUnitDepModule fc ue home_module_name_providers_map mod_name (uid, opts)
+findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name (uid, opts)
-- If the module is reexported, then look for it as if it was from the
-- perspective of the package which reexports it.
| Just real_mod_name
<- lookupUniqMap (finder_reexportedModules opts) mod_name
- = findHomeOrRegularPackageModule fc opts ue home_module_name_providers_map
+ = findHomeOrRegularPackageModule policy fc opts ue home_module_name_providers_map
(Just $ DefiniteHomeUnit uid Nothing)
real_mod_name
- | elementOfUniqSet mod_name (finder_hiddenModules opts)
+ | RejectHiddenModules <- policy
+ , elementOfUniqSet mod_name (finder_hiddenModules opts)
= return (mkHomeHidden uid)
| otherwise
= findHomePackageModule fc opts uid mod_name
@@ -363,14 +385,15 @@ findHomeUnitDepModule fc ue home_module_name_providers_map mod_name (uid, opts)
-- reexports along the way (see 'findHomeUnitDepModule'). Yields the first
-- successful result.
findHomeModuleAmongDeps
- :: FinderCache
+ :: HiddenModulePolicy
+ -> FinderCache
-> FinderOpts
-> UnitEnv
-> HomeModuleNameProvidersMap
-> Maybe HomeUnit
-> ModuleName
-> IO FindResult
-findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit mod_name =
+findHomeModuleAmongDeps policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name =
foldr1 orIfNotFound (home_import :| map home_pkg_import other_fopts)
-- Do not try to be smart and change this to `foldr orIfNotFound home_import
-- (map home_pkg_import other_fopts)`, as that would not be the same.
@@ -381,7 +404,7 @@ findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit
Just home_unit -> findHomeModule fc fopts home_unit mod_name
Nothing -> pure $
NoPackage (panic "findHomeModuleAmongDeps: no home-unit")
- home_pkg_import = findHomeUnitDepModule fc ue home_module_name_providers_map mod_name
+ home_pkg_import = findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name
unit_state = case homeUnitId <$> mb_home_unit of
Nothing -> ue_homeUnitState ue
@@ -393,18 +416,19 @@ findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit
-- | Search the home-unit graph and otherwise the regular exposed package
-- database.
findHomeOrRegularPackageModule
- :: FinderCache
+ :: HiddenModulePolicy
+ -> FinderCache
-> FinderOpts
-> UnitEnv
-> HomeModuleNameProvidersMap
-> Maybe HomeUnit
-> ModuleName
-> IO FindResult
-findHomeOrRegularPackageModule fc fopts ue home_module_name_providers_map mb_home_unit mod_name =
- findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map
+findHomeOrRegularPackageModule policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name =
+ findHomeModuleAmongDeps policy fc fopts ue home_module_name_providers_map
mb_home_unit mod_name
`orIfNotFound`
- findExposedPackageModule fc fopts unit_state mod_name NoPkgQual
+ findExposedPackageModule_policy policy fc fopts unit_state mod_name NoPkgQual
where
unit_state = case homeUnitId <$> mb_home_unit of
Nothing -> ue_homeUnitState ue
@@ -482,36 +506,29 @@ homeSearchCache fc home_unit mod_name do_this = do
modLocationCache fc mod do_this
findExposedPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult
-findExposedPackageModule fc fopts units mod_name mb_pkg =
- findLookupResult fc fopts
+findExposedPackageModule = findExposedPackageModule_policy RejectHiddenModules
+
+findExposedPackageModule_policy :: HiddenModulePolicy -> FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult
+findExposedPackageModule_policy policy fc fopts units mod_name mb_pkg =
+ findLookupResult policy fc fopts units
$ lookupModuleWithSuggestions units mod_name mb_pkg
findExposedPluginPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> IO FindResult
findExposedPluginPackageModule fc fopts units mod_name =
- findLookupResult fc fopts
+ findLookupResult RejectHiddenModules fc fopts units
$ lookupPluginModuleWithSuggestions units mod_name NoPkgQual
-findLookupResult :: FinderCache -> FinderOpts -> LookupResult -> IO FindResult
-findLookupResult fc fopts r = case r of
- LookupFound m pkg_conf -> do
- let im = fst (getModuleInstantiation m)
- r' <- findPackageModule_ fc fopts im (fst pkg_conf)
- case r' of
- -- TODO: ghc -M is unlikely to do the right thing
- -- with just the location of the thing that was
- -- instantiated; you probably also need all of the
- -- implicit locations from the instances
- InstalledFound loc -> return (Found loc m)
- InstalledNoPackage _ -> return (NoPackage (moduleUnit m))
- InstalledNotFound fp _ -> return (NotFound{ fr_paths = fmap unsafeDecodeUtf fp, fr_pkg = Just (moduleUnit m)
- , fr_pkgs_hidden = []
- , fr_mods_hidden = []
- , fr_unusables = []
- , fr_suggestions = []})
+findLookupResult :: HiddenModulePolicy -> FinderCache -> FinderOpts -> UnitState -> LookupResult -> IO FindResult
+findLookupResult policy fc fopts units r = case r of
+ LookupFound m pkg_conf -> found_module m (findPackageModule_ fc fopts (instantiated m) (fst pkg_conf))
LookupMultiple rs ->
return (FoundMultiple rs)
- LookupHidden fr_pkgs_hidden mod_hiddens ->
- return (NotFound{ fr_paths = [], fr_pkg = Nothing
+ LookupHidden fr_pkgs_hidden mod_hiddens
+ | AcceptHiddenModules <- policy
+ , [m] <- [ m | (m, ModHidden HiddenModInVisibleUnit) <- mod_hiddens ]
+ -> found_module m (findPackageModule fc units fopts (instantiated m))
+ | otherwise
+ -> return (NotFound{ fr_paths = [], fr_pkg = Nothing
, fr_pkgs_hidden
, fr_mods_hidden = map (moduleUnit.fst) mod_hiddens
, fr_unusables = []
@@ -535,6 +552,29 @@ findLookupResult fc fopts r = case r of
, fr_mods_hidden = []
, fr_unusables = []
, fr_suggestions = suggest' })
+ where
+ instantiated m = fst (getModuleInstantiation m)
+
+ -- TODO: ghc -M is unlikely to do the right thing
+ -- with just the location of the thing that was
+ -- instantiated; you probably also need all of the
+ -- implicit locations from the instances
+ found_module :: Module -> IO InstalledFindResult -> IO FindResult
+ found_module m find = do
+ r' <- find
+ return $
+ case r' of
+ InstalledFound loc -> Found loc m
+ InstalledNoPackage {} -> NoPackage (moduleUnit m)
+ InstalledNotFound fp _ ->
+ NotFound
+ { fr_paths = fmap unsafeDecodeUtf fp
+ , fr_pkg = Just (moduleUnit m)
+ , fr_pkgs_hidden = []
+ , fr_mods_hidden = []
+ , fr_unusables = []
+ , fr_suggestions = []
+ }
modLocationCache :: FinderCache -> InstalledModule -> IO InstalledFindResult -> IO InstalledFindResult
modLocationCache fc mod do_this = do
=====================================
compiler/GHC/Unit/State.hs
=====================================
@@ -38,6 +38,7 @@ module GHC.Unit.State (
LookupResult(..),
ModuleSuggestion(..),
ModuleOrigin(..),
+ HiddenModuleUnit(..),
UnusableUnit(..),
UnusableUnitReason(..),
pprReason,
@@ -168,10 +169,8 @@ import Control.Applicative
-- it could have come into scope. Warning: don't use the record functions,
-- they're partial!
data ModuleOrigin =
- -- | Module is hidden, and thus never will be available for import.
- -- (But maybe the user didn't realize), so we'll still keep track
- -- of these modules.)
- ModHidden
+ -- | The module is hidden (thus not available for a user-written import).
+ ModHidden !HiddenModuleUnit
-- | Module is unavailable because the unit is unusable.
| ModUnusable !UnusableUnit
@@ -193,6 +192,11 @@ data ModuleOrigin =
, fromPackageFlag :: Bool
}
+-- | Is the unit providing a hidden module itself visible in this compilation?
+data HiddenModuleUnit
+ = HiddenModInVisibleUnit
+ | HiddenModInHiddenUnit
+
-- | A unusable unit module origin
data UnusableUnit = UnusableUnit
{ uuUnit :: !Unit -- ^ Unusable unit
@@ -201,7 +205,7 @@ data UnusableUnit = UnusableUnit
}
instance Outputable ModuleOrigin where
- ppr ModHidden = text "hidden module"
+ ppr (ModHidden {}) = text "hidden module"
ppr (ModUnusable _) = text "unusable module"
ppr (ModOrigin e res rhs f) = sep (punctuate comma (
(case e of
@@ -255,7 +259,7 @@ instance Monoid ModuleOrigin where
-- | Is the name from the import actually visible? (i.e. does it cause
-- ambiguity, or is it only relevant when we're making suggestions?)
originVisible :: ModuleOrigin -> Bool
-originVisible ModHidden = False
+originVisible (ModHidden {}) = False
originVisible (ModUnusable _) = False
originVisible (ModOrigin b res _ f) = b == Just True || not (null res) || f
@@ -1819,7 +1823,11 @@ mkModuleNameProvidersMap logger cfg pkg_map vis_map =
esmap = listToUFM (es False) -- parameter here doesn't matter, orig will
-- be overwritten
- hiddens = [(m, mkModMap pk m ModHidden) | m <- hidden_mods]
+ hiddens = [(m, mkModMap pk m (ModHidden hidden_mod_unit)) | m <- hidden_mods]
+
+ hidden_mod_unit
+ | b || not (null rns) = HiddenModInVisibleUnit
+ | otherwise = HiddenModInHiddenUnit
pk = mkUnit pkg
unit_lookup uid = lookupUnit' (unitConfigAllowVirtual cfg) pkg_map uid
@@ -1970,7 +1978,7 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn
let origin = filterOrigin mb_pn (mod_unit m) origin0
x = (m, origin)
in case origin of
- ModHidden
+ ModHidden {}
-> (hidden_pkg, x:hidden_mod, unusable, exposed)
ModUnusable _
-> (hidden_pkg, hidden_mod, x:unusable, exposed)
@@ -2003,8 +2011,8 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn
filterOrigin (OtherPkg u) pkg o =
let match_pkg p = u == unitId p
in case o of
- ModHidden
- | match_pkg pkg -> ModHidden
+ ModHidden {}
+ | match_pkg pkg -> o
| otherwise -> mempty
ModUnusable _
| match_pkg pkg -> o
=====================================
libraries/base/base.cabal.in
=====================================
@@ -219,7 +219,6 @@ Library
, GHC.Integer.Logarithms
, GHC.IsList
, GHC.Ix
- , GHC.Essentials
, GHC.List
, GHC.Maybe
, GHC.MVar
@@ -307,6 +306,7 @@ Library
other-modules:
Data.List.NubOrdSet
+ GHC.Essentials
System.CPUTime.Unsupported
System.CPUTime.Utils
if os(windows)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -5295,10 +5295,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event where
-- Safety: Safe
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -5295,10 +5295,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event where
-- Safety: Safe
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -5340,10 +5340,6 @@ module GHC.Err where
errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a
undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a
-module GHC.Essentials where
-
--- ignored
-
module GHC.Event.TimeOut where
-- Safety: None
=====================================
utils/dump-decls/Main.hs
=====================================
@@ -68,7 +68,6 @@ ignoredModules =
map mkModuleName $ concat
[ unstableModules
, platformDependentModules
- , internalModules
]
where
unstableModules =
@@ -81,8 +80,6 @@ ignoredModules =
, "GHC.Num.Backend"
, "GHC.Num.Backend.Selected"
]
- internalModules =
- [ "GHC.Essentials" ]
ignoredOccNames :: [OccName]
ignoredOccNames =
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e986375ea75e354e0667459050bcdf8…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e986375ea75e354e0667459050bcdf8…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0