[Git][ghc/ghc][wip/fendor/27836] Fix #27836, normalise unit database path in ExternalUnitDatabases
by Hannes Siebenhandl (@fendor) 29 Sep '26
by Hannes Siebenhandl (@fendor) 29 Sep '26
29 Sep '26
Hannes Siebenhandl pushed to branch wip/fendor/27836 at Glasgow Haskell Compiler / GHC
Commits:
7c128db1 by Hannes Siebenhandl at 2026-09-29T16:55:41+02:00
Fix #27836, normalise unit database path in ExternalUnitDatabases
Add a regression test, proofing that all variations:
- local-unit-db/my-test.conf
- ./local-unit-db/my-test.conf
- ./local-unit-db/my-test.conf/
are parsed only once.
- - - - -
11 changed files:
- compiler/GHC/Data/OsPath.hs
- compiler/GHC/Unit/External/Database.hs
- + testsuite/tests/driver/T27836/A.hs
- + testsuite/tests/driver/T27836/B.hs
- + testsuite/tests/driver/T27836/C.hs
- + testsuite/tests/driver/T27836/Makefile
- + testsuite/tests/driver/T27836/T27836.stdout
- + testsuite/tests/driver/T27836/all.T
- + testsuite/tests/driver/T27836/unitA
- + testsuite/tests/driver/T27836/unitB
- + testsuite/tests/driver/T27836/unitC
Changes:
=====================================
compiler/GHC/Data/OsPath.hs
=====================================
@@ -13,6 +13,7 @@ module GHC.Data.OsPath
, (<.>)
, splitSearchPath
, isRelative
+ , normalise
, dropTrailingPathSeparator
, takeDirectory
, isSuffixOf
=====================================
compiler/GHC/Unit/External/Database.hs
=====================================
@@ -53,9 +53,17 @@ import System.FilePath as FilePath
-- ExternalUnitDatabases
-- ----------------------------------------------------------------------------
+-- | A normalised 'OsPath' that we use as the key to cache 'UnitDatabase's.
+--
+-- Removes trailing path separators and unit database paths starting with @./@.
+newtype NormalisedUnitDbLoc = NormalisedUnitDbLoc OsPath
+ deriving (Eq, Ord)
+
-- | Caches unit databases in-memory.
data ExternalUnitDatabases unit = ExternalUnitDatabases
- { eud_cachedDatabases :: !(Map OsPath (UnitDatabase unit))
+ { eud_cachedDatabases :: !(Map NormalisedUnitDbLoc (UnitDatabase unit))
+ -- ^ The 'Map' is keyed by a normalised 'OsPath', ensuring that 'lookupExternalUnitDatabases'
+ -- will never get confused by a stray @./@ or trailing @/@.
}
emptyExternalUnitDatabases :: ExternalUnitDatabases unit
@@ -67,18 +75,20 @@ emptyExternalUnitDatabases =
insertExternalUnitDatabases :: UnitDatabase unit -> ExternalUnitDatabases unit -> ExternalUnitDatabases unit
insertExternalUnitDatabases unit_db eud =
ExternalUnitDatabases
- { eud_cachedDatabases = Map.insert (unitDatabasePath unit_db) unit_db (eud_cachedDatabases eud)
+ { eud_cachedDatabases =
+ Map.insert (normalisedUnitDatabaseKey unit_db) unit_db (eud_cachedDatabases eud)
}
deleteExternalUnitDatabases :: OsPath -> ExternalUnitDatabases unit -> ExternalUnitDatabases unit
deleteExternalUnitDatabases unit_db_path eud =
ExternalUnitDatabases
- { eud_cachedDatabases = Map.delete unit_db_path (eud_cachedDatabases eud)
+ { eud_cachedDatabases =
+ Map.delete (normalisedUnitDatabaseKeyOsPath unit_db_path) (eud_cachedDatabases eud)
}
lookupExternalUnitDatabases :: OsPath -> ExternalUnitDatabases unit -> Maybe (UnitDatabase unit)
lookupExternalUnitDatabases key eud =
- Map.lookup key (eud_cachedDatabases eud)
+ Map.lookup (normalisedUnitDatabaseKeyOsPath key) (eud_cachedDatabases eud)
-- ----------------------------------------------------------------------------
-- UnitDatabase
@@ -87,12 +97,38 @@ lookupExternalUnitDatabases key eud =
-- | Unit database entry.
data UnitDatabase unit = UnitDatabase
{ unitDatabasePath :: OsPath
+ -- ^ On-disk location of the unit database.
+ --
, unitDatabaseUnits :: [GenUnitInfo unit]
+ -- ^ Units read from the database located at 'unitDatabasePath'.
+ --
+ -- These units have the @$pkgroot@ variable already resolved.
}
instance (Outputable u) => Outputable (UnitDatabase u) where
ppr (UnitDatabase fp _u) = text "DB:" <+> ppr fp
+normalisedUnitDatabaseKey :: UnitDatabase unit -> NormalisedUnitDbLoc
+normalisedUnitDatabaseKey unit_db = normalisedUnitDatabaseKeyOsPath $ unitDatabasePath unit_db
+
+-- | Normalise the unit database location and drop trailing path separators.
+--
+-- This ensures that two databases that point to the same location can be cached.
+--
+-- We need to remove trailing slash from the 'OsPath' before calculating @$pkgroot@ (Fix #16360)
+normalisedUnitDatabaseKeyOsPath :: OsPath -> NormalisedUnitDbLoc
+normalisedUnitDatabaseKeyOsPath db_path =
+ NormalisedUnitDbLoc $ OsPath.normalise $ OsPath.dropTrailingPathSeparator db_path
+
+-- | Get the root location of a unit database.
+-- Used to replace @$pkgroot@ variables in the 'GenericUnitInfo'.
+unitDatabaseRoot :: OsPath -> OsPath
+unitDatabaseRoot p =
+ let
+ NormalisedUnitDbLoc np = normalisedUnitDatabaseKeyOsPath p
+ in
+ OsPath.takeDirectory np
+
-- ----------------------------------------------------------------------------
--
-- Merging databases
@@ -258,14 +294,12 @@ readUnitDatabase logger cfg conf_file = do
"can't find a package database at " ++ show conf_file
let
- -- Fix #16360: remove trailing slash from conf_file before calculating pkgroot
- conf_file' = OsPath.dropTrailingPathSeparator conf_file
top_dir = OsPath.unsafeEncodeUtf (unitDbConfigGHCDir cfg)
- pkgroot = OsPath.takeDirectory conf_file'
+ pkgroot = unitDatabaseRoot conf_file
pkg_configs1 = map (mungeUnitInfo top_dir pkgroot . mapUnitInfo (\(UnitKey x) -> UnitId x) . mkUnitKeyInfo)
proto_pkg_configs
--
- return $ UnitDatabase conf_file' pkg_configs1
+ return $ UnitDatabase conf_file pkg_configs1
where
readDirStyleUnitInfo :: OsPath -> IO [DbUnitInfo]
readDirStyleUnitInfo conf_dir = do
=====================================
testsuite/tests/driver/T27836/A.hs
=====================================
@@ -0,0 +1,4 @@
+module A where
+
+a :: Int
+a = 1
=====================================
testsuite/tests/driver/T27836/B.hs
=====================================
@@ -0,0 +1,4 @@
+module B where
+
+b :: Int
+b = 1
=====================================
testsuite/tests/driver/T27836/C.hs
=====================================
@@ -0,0 +1,4 @@
+module C where
+
+b :: Int
+b = 1
=====================================
testsuite/tests/driver/T27836/Makefile
=====================================
@@ -0,0 +1,21 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+T27836:
+ mkdir local-unit-db/
+ cd local-unit-db/ && '$(GHC_PKG)' init my-test.conf
+ # All these unit database paths should resolve to the same location
+ # thus after the first time parsing it, we shouldn't parse it again.
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make \
+ -unit @unitA -unit @unitB -unit @unitC \
+ -v2 -fforce-recomp 2>&1 \
+ | grep 'Using binary package database:'
+
+ echo ""
+ echo ""
+ echo "All -package-db variations:"
+ echo "- local-unit-db/my-test.conf"
+ echo "- ./local-unit-db/my-test.conf"
+ echo "- ./local-unit-db/my-test.conf/"
+ echo "Must be parsed only once."
=====================================
testsuite/tests/driver/T27836/T27836.stdout
=====================================
@@ -0,0 +1,8 @@
+Using binary package database: local-unit-db/my-test.conf/package.cache
+
+
+All -package-db variations:
+- local-unit-db/my-test.conf
+- ./local-unit-db/my-test.conf
+- ./local-unit-db/my-test.conf/
+Must be parsed only once.
=====================================
testsuite/tests/driver/T27836/all.T
=====================================
@@ -0,0 +1,4 @@
+test('T27836',
+ [ extra_files(['A.hs', 'B.hs', 'C.hs', 'unitA', 'unitB', 'unitC']), normalise_slashes
+ ],
+ makefile_test, ['T27836'])
=====================================
testsuite/tests/driver/T27836/unitA
=====================================
@@ -0,0 +1 @@
+-hide-all-packages -no-user-package-db -package-db local-unit-db/my-test.conf -package base -this-unit-id a-0.0.0 A
=====================================
testsuite/tests/driver/T27836/unitB
=====================================
@@ -0,0 +1 @@
+-hide-all-packages -no-user-package-db -package-db ./local-unit-db/my-test.conf -package base -this-unit-id b-0.0.0 B
=====================================
testsuite/tests/driver/T27836/unitC
=====================================
@@ -0,0 +1 @@
+-hide-all-packages -no-user-package-db -package-db ./local-unit-db/my-test.conf/ -package base -this-unit-id c-0.0.0 C
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7c128db1c11966e26c4f2bc6bed0e5e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7c128db1c11966e26c4f2bc6bed0e5e…
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] 2 commits: Add regression test for #7803
by Marge Bot (@marge-bot) 29 Sep '26
by Marge Bot (@marge-bot) 29 Sep '26
29 Sep '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f191714a by Vladislav Zavialov at 2026-09-29T10:42:22-04:00
Add regression test for #7803
Commit 2effe18ab5, first shipped with GHC 8.2.1, fixed #7803 "Superclass
methods are left unspecialized".
This change turns the example from the ticket description into a regression
test, checking that foo1 is fully specialised at Double, with no calls to the
overloaded exp5Tail.
Closes #7803
Assisted-by: Claude Opus 5
- - - - -
5e12c24d by Alan Zimmerman at 2026-09-29T10:42:23-04:00
EPA: Use EpaLocation in EpVirtualBraces
Haddock processing uses EpLayout.EpVirtualBraces to record the current
layout column, for allocating haddock comments correctly.
For exact printing, we need the line as well as the col, so we know
how many lines to skip when the indented code block starts.
This commit updates EpLayout.EpVirtualBraces so that it carries an
EpaLocation instead of just the Int column, to allow it to be used for
both purposes.
It is a simple mechanical change, with no other impact, but it allows
us to use EpLayout instead of AnnListLayout in AnnList, in the next
commit in this series.
- - - - -
28 changed files:
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- 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/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.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/printer/AnnotationNoListTuplePuns.stdout
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- + testsuite/tests/simplCore/should_compile/T7803.hs
- + testsuite/tests/simplCore/should_compile/T7803.stderr
- + testsuite/tests/simplCore/should_compile/T7803a.hs
- testsuite/tests/simplCore/should_compile/all.T
Changes:
=====================================
compiler/GHC/Parser.y
=====================================
@@ -945,13 +945,13 @@ body :: { ([TrailingAnn]
,([LImportDecl GhcPs], [LHsDecl GhcPs])
,EpLayout) }
: '{' top '}' { (fst $2, snd $2, epExplicitBraces $1 $3) }
- | vocurly top close { (fst $2, snd $2, EpVirtualBraces (getVOCURLY $1)) }
+ | vocurly top close { (fst $2, snd $2, EpVirtualBraces (glR $1)) }
body2 :: { ([TrailingAnn]
,([LImportDecl GhcPs], [LHsDecl GhcPs])
,EpLayout) }
: '{' top '}' { (fst $2, snd $2, epExplicitBraces $1 $3) }
- | missing_module_keyword top close { ([], snd $2, EpVirtualBraces leftmostColumn) }
+ | missing_module_keyword top close { ([], snd $2, EpVirtualBraces (EpaDelta noSrcSpan (SameLine 0) [])) }
top :: { ([TrailingAnn]
@@ -1855,7 +1855,7 @@ decllist_cls
: '{' decls_cls '}' { sLL $1 $> ((epTok $1, fst $ unLoc $2, epTok $3)
,snd $ unLoc $2, epExplicitBraces $1 $3) }
| vocurly decls_cls close { let { L l (anns, decls) = $2 }
- in L l ((noEpTok, anns, noEpTok), decls, EpVirtualBraces (getVOCURLY $1)) }
+ in L l ((noEpTok, anns, noEpTok), decls, EpVirtualBraces (glR $1)) }
-- Class body
--
@@ -4305,7 +4305,6 @@ getINLINE (L _ (ITinline_prag _ inl conl)) = (inl,conl)
getSPEC_INLINE (L _ (ITspec_inline_prag src True)) = (Inline,FunLike)
getSPEC_INLINE (L _ (ITspec_inline_prag src False)) = (NoInline,FunLike)
getCOMPLETE_PRAGs (L _ (ITcomplete_prag x)) = x
-getVOCURLY (L (RealSrcSpan l _) ITvocurly) = srcSpanStartCol l
getINTEGERs (L _ (ITinteger (IL src _ _))) = src
getCHARs (L _ (ITchar src _)) = src
=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -5,7 +5,7 @@ module GHC.Parser.Annotation (
getEpTokenBufSpan,
getEpTokenLoc, getEpUniTokenLoc,
TokDcolon, TokDarrow, TokRarrow, TokForall, TokStar,
- EpLayout(..),
+ EpLayout(..), getEpaLocationCol,
EpaComment(..), EpaCommentTok(..),
IsUnicodeSyntax(..),
HasE(..),
@@ -282,7 +282,9 @@ data EpLayout =
-- bar :: a
-- @
EpVirtualBraces
- !Int -- ^ Layout column (indentation level, begins at 1)
+ !EpaLocation -- ^ Layout column (indentation level, begins at 1)
+ -- We keep this as an 'EpaLocation' so exact printing
+ -- can use it too.
|
-- | Empty or compiler-generated blocks do not have layout information
-- associated with them.
@@ -290,6 +292,14 @@ data EpLayout =
deriving instance Data EpLayout
+-- | Used in 'GHC.Parser.Haddock' to get layout column. It assumes
+-- | there is a RealSrcSpan in it, falling back to zero otherwise
+getEpaLocationCol :: EpaLocation -> Int
+getEpaLocationCol loc
+ = case loc of
+ EpaSpan (RealSrcSpan l _) -> srcSpanStartCol l
+ _ -> leftmostColumn -- should never happen in Parser output
+
-- ---------------------------------------------------------------------
data EpaComment =
=====================================
compiler/GHC/Parser/PostProcess/Haddock.hs
=====================================
@@ -392,8 +392,9 @@ addHaddockInterleaveItems layout get_doc_item = go
with_layout = case layout of
EpNoLayout -> id
EpExplicitBraces{} -> id
- EpVirtualBraces n ->
- let loc_range = mempty { loc_range_col = ColumnFrom (n+1) }
+ EpVirtualBraces n' ->
+ let n = getEpaLocationCol n'
+ loc_range = mempty { loc_range_col = ColumnFrom (n+1) }
in hoistHdkA (inLocRange loc_range)
instance HasHaddock (LocatedA (HsDecl GhcPs)) where
@@ -1304,7 +1305,7 @@ mkDocDecl layout (L l_comment hdk_comment)
indent_mismatch = case layout of
EpNoLayout -> False
EpExplicitBraces{} -> False
- EpVirtualBraces n -> n /= srcSpanStartCol (psRealSpan l_comment)
+ EpVirtualBraces n -> getEpaLocationCol n /= srcSpanStartCol (psRealSpan l_comment)
mkDocIE :: PsLocated HdkComment -> Maybe (LIE GhcPs)
mkDocIE (L l_comment hdk_comment) =
=====================================
testsuite/tests/ghc-api/exactprint/T22919.stderr
=====================================
@@ -34,7 +34,7 @@
{ T22919.hs:1:8-13 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T22919.hs:2:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/ghc-api/exactprint/Test20239.stderr
=====================================
@@ -34,7 +34,7 @@
"-- ^ Run any arbitrary IO code")
{ Test20239.hs:7:86 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20239.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
=====================================
@@ -40,7 +40,7 @@
"-- Trailing comment, should be in HsModule extension point")
{ ZeroWidthSemi.hs:6:5 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { ZeroWidthSemi.hs:6:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T17544.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -64,7 +64,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:6:3 })))
[]
(Nothing)
(L
@@ -243,7 +243,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:10:3 })))
[]
(Nothing)
(L
@@ -423,7 +423,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:14:3 })))
[]
(Nothing)
(L
@@ -603,7 +603,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:18:3 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T17544_kw.hs:13:1 }))
(Nothing)
(Nothing))
(Just
@@ -412,7 +412,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (5)))
+ (EpaSpan { T17544_kw.hs:22:5 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T24221.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/module/mod185.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaDelta { <no location info> } (SameLine 0) []))
(Nothing)
(Nothing))
(Nothing)
=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpParsedAst.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
=====================================
@@ -41,7 +41,7 @@
{ DumpParsedAstComments.hs:1:1-28 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpParsedAstComments.hs:9:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -45,7 +45,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpSemis.hs:4:1 }))
(Nothing)
(Nothing))
(Just
@@ -1336,7 +1336,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { DumpSemis.hs:29:3 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { KindSigs.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T15323.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T15323.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20452.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20452.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20718.stderr
=====================================
@@ -68,7 +68,7 @@
"-- end 2")
{ T20718.hs:10:1-8 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20718.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20718b.stderr
=====================================
@@ -55,7 +55,7 @@
{ T20718b.hs:6:1-21 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20718b.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20846.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20846.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T23315/T23315.stderr
=====================================
@@ -24,7 +24,7 @@
(EpaComments
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T23315.hsig:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/AnnotationNoListTuplePuns.stdout
=====================================
@@ -47,7 +47,7 @@
"-- comment post B")
{ AnnotationNoListTuplePuns.hs:17:3 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { AnnotationNoListTuplePuns.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -244,7 +244,7 @@
{ AnnotationNoListTuplePuns.ppr.hs:1:1-32 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/T18791.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T18791.hs:4:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/Test20297.stdout
=====================================
@@ -34,7 +34,7 @@
{ Test20297.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20297.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -476,7 +476,7 @@
{ Test20297.ppr.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20297.ppr.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/Test24533.stdout
=====================================
@@ -34,7 +34,7 @@
{ Test24533.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test24533.hs:4:1 }))
(Nothing)
(Nothing))
(Just
@@ -694,7 +694,7 @@
{ Test24533.ppr.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test24533.ppr.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/simplCore/should_compile/T7803.hs
=====================================
@@ -0,0 +1,23 @@
+{-# OPTIONS_GHC -ddump-simpl #-}
+
+-- #7803: foo1 should be fully specialised at Double. In the bug report
+-- it ended up calling the overloaded exp5Tail (with a dictionary argument),
+-- because the specialiser ran before the overloaded call was floated to
+-- the top level. So the dumped Core for this module must mention no
+-- exp5Tail at all.
+module T7803 (foo1) where
+
+import T7803a
+
+bar :: Floating a => a -> a -> a
+bar z = subtract (evaluate integ z) . evaluate integ
+ where
+ integ = indefinite (Piecewise [Poly4 1])
+{-# SPECIALIZE bar :: Double -> Double -> Double #-}
+
+foo :: Floating a => a -> a -> a
+foo x = bar x
+{-# SPECIALIZE foo :: Double -> Double -> Double #-}
+
+foo1 :: Double -> Double -> Double
+foo1 x = foo x
=====================================
testsuite/tests/simplCore/should_compile/T7803.stderr
=====================================
@@ -0,0 +1 @@
+foo1
=====================================
testsuite/tests/simplCore/should_compile/T7803a.hs
=====================================
@@ -0,0 +1,73 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE UndecidableSuperClasses #-}
+
+module T7803a
+ ( Evaluate (..)
+ , HasIntegral (..)
+ , Poly4 (..)
+ , Domain
+ , IntOfLogPoly4 (..)
+ , Piecewise (..)
+ ) where
+
+import Data.Kind (Constraint, Type)
+
+class Evaluate poly where
+ evaluate :: (Domain' poly a) => poly a -> a -> a
+
+class Evaluate (IntegralOf poly) => HasIntegral poly where
+ type IntegralOf poly :: Type -> Type
+ indefinite :: (Domain' poly a, Domain' (IntegralOf poly) a)
+ => poly a -> IntegralOf poly a
+
+type family Domain (f :: Type -> Type) a :: Constraint
+
+class Domain f a => Domain' f a
+instance Domain f a => Domain' f a
+
+newtype Poly4 a = Poly4 { poly4_a :: a }
+
+type instance Domain Poly4 a = Fractional a
+
+data IntOfLogPoly4 a = IntOfLogPoly4 { ilp4_k :: !a, ilp4_u :: !a }
+
+type instance Domain IntOfLogPoly4 a = Floating a
+
+instance Evaluate IntOfLogPoly4 where
+ evaluate (IntOfLogPoly4 k _) x = k + x * exp5Tail (- log x)
+ {-# INLINE evaluate #-}
+
+{-# RULES "exp5Tail/Double" exp5Tail = exp5TailDouble #-}
+{-# NOINLINE exp5Tail #-}
+
+exp5Tail :: (Floating a) => a -> a
+exp5Tail x = x / 120
+
+exp5TailDouble :: Double -> Double
+exp5TailDouble x = x / 120
+
+instance HasIntegral Poly4 where
+ type IntegralOf Poly4 = IntOfLogPoly4
+ indefinite = \ (Poly4 a) -> IntOfLogPoly4 0 a
+ {-# INLINE indefinite #-}
+
+newtype Piecewise poly a = Piecewise { unPiecewise :: [poly a] }
+
+type instance Domain (Piecewise poly) a = (Domain poly a, Num a)
+
+instance (Evaluate poly) => Evaluate (Piecewise poly) where
+ evaluate = \ (Piecewise pp) x ->
+ case pp of
+ p : _ -> evaluate p x
+ [] -> error "evaluate: empty Piecewise"
+ {-# INLINE evaluate #-}
+
+instance (HasIntegral poly) => HasIntegral (Piecewise poly) where
+ type IntegralOf (Piecewise poly) = Piecewise (IntegralOf poly)
+ indefinite (Piecewise m) = Piecewise $ map indefinite m
+ {-# INLINE indefinite #-}
=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -148,6 +148,13 @@ test('T7785', [ only_ways(['optasm']),
grep_errmsg(r'SPEC') ],
compile, ['-ddump-cse'])
+# T7803: we expect NO calls to the overloaded 'exp5Tail' in T7803.hs
+# In the bug report #7803, the unspecialised call was signalled by 'exp5Tail'
+# in foo1's Core, so we grep for that; also for 'foo1', lest we dump nothing
+# One module, T7803.hs, has OPTIONS_GHC -ddump-simpl
+test('T7803', [ grep_errmsg(r'exp5Tail|foo1') ],
+ multimod_compile, ['T7803', '-O2 -v0 -dsuppress-all -dsuppress-uniques -dno-typeable-binds'])
+
test('T7702',
[extra_files(['T7702plugin']),
pre_cmd('$MAKE -s --no-print-directory -C T7702plugin package.T7702 TOP={top}'),
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b27f65f41a0224783fdd91951f83d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b27f65f41a0224783fdd91951f83d…
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/mangoiv/27672] 68 commits: testsuite: Migrate perf tests off collect_compiler_stats('all')
by Magnus (@MangoIV) 29 Sep '26
by Magnus (@MangoIV) 29 Sep '26
29 Sep '26
Magnus pushed to branch wip/mangoiv/27672 at Glasgow Haskell Compiler / GHC
Commits:
df058f1d by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Migrate perf tests off collect_compiler_stats('all')
The 'all' metric argument applies a single tolerance to bytes
allocated, max_bytes_used and peak_megabytes_allocated, although their
noise profiles are incompatible (#27653): allocations are nearly
deterministic, residency needs 10-20%, and peak is quantized to 1 MB.
Any single tolerance is too tight for one metric or too slack for
another. This migrates the remaining users of 'all' (and of the 'all'
default) to explicit per-metric collection, ahead of removing 'all'
from the driver.
peak_megabytes_allocated is dropped everywhere: its 1 MB granularity
makes tight relative windows meaningless (#27613), and it is sensitive
to GC timing. In #27489 it drifted by -5.3% while max_bytes_used moved
by less than 0.1%. Where a test guards a memory property,
max_bytes_used covers it at byte granularity.
Where the motivating ticket was about compile-time memory
(T11545, T15304, T26425), residency remains gated via max_bytes_used,
now with a residency-appropriate tolerance.
max_bytes_used is dropped where residency was only ever an accident of
'all':
* T15630, T15630a, T20261: the underlying tickets (#15630, #20261)
contain no memory data at all. One is a simplifier-ticks blowup and
the other is stated entirely in allocation numbers, so the 20%
window never had teeth.
* T21839c: #21839's measurements show residency essentially flat
(+0.16%) while allocations moved +7%, so allocations are the
discriminating metric. They are already gated at 1% via
collect_compiler_runtime. The ghc/max gate had previously broken CI
spuriously (9fd11585eb widened it from 1% to 10% for that reason).
Allocation tolerances are tightened to the testsuite's conventional 2%
where 'all' previously left them at 10-20%.
Assisted-by: Claude Fable 5
- - - - -
72dd2432 by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Remove the 'all' metric argument of collect_stats
'all' gated bytes allocated, max_bytes_used and peak_megabytes_allocated
at a single tolerance, although their noise profiles are incompatible,
making such tests either flaky or toothless (#27653).
Closes #27653.
Assisted-by: Claude Fable 5
- - - - -
2228cb30 by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Make the deviation argument of collect_stats mandatory
Almost every caller passes an explicit tolerance matched to the
metric's noise profile, and the silent 20% default is far slacker than
'bytes allocated' merits. Only two tests relied on it. They now state
their tolerance explicitly:
large-project gets 10%, in line with other large compile-time tests.
T9848 gets 2%: its metric is byte-for-byte deterministic across CI
jobs and platforms of a given test_env, has drifted only about 2.5%
since 2015, and the fusion failure it guards against would show up as
a roughly +30000% jump.
Assisted-by: Claude Fable 5
- - - - -
56291fc5 by Cheng Shao at 2026-09-02T07:18:45-04:00
autoconf/ghc-toolchain: bump llvm upper bound to support llvm 23
This commit bumps llvm upper bound to support llvm 23.
- - - - -
20eb3f41 by Cheng Shao at 2026-09-02T07:18:45-04:00
rts: fix compilation issues with clang 23
clang 23 has broadened `-Wall`/`-Wextra` ranges, exposing some minor
issues in the rts when building with validate flavours:
- Unused locals
- `#pragma GCC diagnostic pop` mismatch
This commit fixes those.
- - - - -
9e7739ab by Simon Jakobi at 2026-09-03T13:45:43-04:00
Add -Wimplicit-field-strictness (#16836)
This opt-in warning fires when a data constructor field lacks an
explicit strictness annotation (`!` or `~`). It complements the
LazyFieldAnnotations extension (4762a8bf30f) from GHC proposal 752,
which makes `~` annotations available for this purpose.
Deciding which fields to report requires their levity, so the check
runs after typechecking. To keep the noise down, the diagnostic is
emitted once per data declaration, grouped by constructor.
Closes #16836.
Assisted-by: Claude Fable 5
- - - - -
6a44d591 by mangoiv at 2026-09-03T13:46:22-04:00
simplifier: remove a bogus `assert` in `rebuild_app'` in `GHC.CoreToStg.Prep.cpeApp`.
Prior to this commit
commit 08bc245be70d95801bc1138804ed1de9474fbdc0
Author: sheaf <sam.derbyshire(a)gmail.com>
Date: Sat Feb 28 16:30:43 2026 +0100
Clean up join points, casts & ticks
This commit shores up the logic dealing with casts and ticks occurring
in between a join point binding and a jump
any `PlaceRuntime` ticks we observed were profiling ticks, even though that
isn't necessary.
The more liberal rules in the above commit allow e.g. breakpoint ticks
(which are valid PlaceRuntime ticks) to legitimately appear in an argument
position.
Fixes #27556
- - - - -
eaa95a6f by Andrei Borzenkov at 2026-09-04T08:08:40-04:00
Parentheses in prefix GADT constructors (#27423)
Updated `splitLHsGadtTy` to allow looking
through the parentheses for inner binders. General example
of a code pattern that's allowed now:
data S a where
MkS :: (forall a. S a)
That should work now with any combination of nested
foralls and parentheses.
We don't perform parenthesis unwrapping for record
GADT constructors in accordance with GHC Proposal #402.
To this end `con_inner_bndrs` no longer stores plain forall
telescopes: `[HsForAllTelescope pass]` is replaced with
`[LHsGadtTelescope pass]`, a new `HsArg`-style type whose
`HsGadtForAll` holds an inner telescope and whose `HsGadtPar`
holds a pair of parentheses. The parentheses carry no meaning
for renaming or type checking; the only reason to record them
is exact-printing.
Updated `pprConDecl` to improve the `parse == parse . ppr . parse`
property of GADT pretty-printing.
The pretty printer can now output code that's similar to this:
data T a where
MkT1 :: (forall a. T a)
MkT2 :: forall . forall a. T a
These are special cases of inner forall binders
for prefix GADT constructors, when we have either
implicit or zero explicit outer binders.
- - - - -
639456a8 by Evgeny Malyshev at 2026-09-04T08:09:25-04:00
HsPat: Add spacing to unary tuple patterns
Use hsep when printing unary boxed TuplePat applications so that the
MkSolo constructor is separated from its argument. The old hcat rendered
wildcard and parenthesized arguments as MkSolo_ and MkSolo().
Add T27034 to exercise the HsPat splice-dump path with wildcard and
variable arguments, and update existing affected golden output.
Fixes #27034
Assisted-By: OpenAI Codex
- - - - -
2908ab36 by Simon Jakobi at 2026-09-05T07:22:17-04:00
X86 NCG: use btr/bts/btc for single-bit operations
Previously the Cmm patterns
x & ~(1 << i)
x | (1 << i)
x ^ (1 << i)
compiled to mov/shl/not/and-style sequences of 3-4 instructions. Now
they compile to a single btr, bts or btc, matching what C compilers
produce.
When the bit index is a literal, constant folding has already collapsed
these patterns into ones with a literal mask, such as
x & 0xfffffeffffffffff for x & ~(1 << 40). Such masks are now also
compiled to a bit-test instruction when they don't fit in an imm32 and
would otherwise have to be loaded into a register first.
For a variable bit index, this applies only when the shift is unchecked
(uncheckedShiftL#, Data.Bits.unsafeShiftL): the bounds-checked shiftL
used by e.g. the default clearBit/setBit/complementBit implementations
wraps the shift in a bounds mask that this optimisation does not see
through. With a literal index, the bounds mask is constant-folded away,
so the checked operations benefit too.
See Note [Bit-test instructions] in GHC.CmmToAsm.X86.CodeGen.
Fixes #25233.
Assisted-by: Claude Fable 5
- - - - -
c673ecf0 by Simon Peyton Jones at 2026-09-05T07:22:59-04:00
Move HsStatic free-var test to typechecker
A `static` form should have no free *term* variables, but it
can have free *type* variables. Alas, the renamer does not really know what
is a term variable and what is a type variable, because of required type
arguments. This patch moves the test to the typechecker, which does know.
Addresses #27664
- - - - -
5939ceaf by sheaf at 2026-09-05T22:06:18-04:00
Windows: enforce path convention in ./configure
As detailed in Note [MSYS paths] in Hadrian.Utilities, the standing
convention (using Windows-style paths with forward slashes) is now
enforced in ./configure instead of within Hadrian, removing the need for
'cygpath' calls within Hadrian.
Fixes #26683
- - - - -
a6061455 by sheaf at 2026-09-05T22:06:18-04:00
Hadrian: introduce ExeSpawnPath
Specific details about the filepath used to specify the executable to
spawn with CreateProcess matters on Windows: whether we use forward or
backward slashes, a leading ./, or an absolute path changes how the
executable is found.
This commit introduces 'ExeSpawnPath' which is a path that is guaranteed
to be found when spawning a process. All command invocations now go
through this type to ensure the path has been properly sanitised.
See Note [NeedCurrentDirectoryForExePath] in Hadrian.Utilities.
The same treatment is applied to hsc2hs. Updates hsc2hs submodule.
- - - - -
e28313e3 by sheaf at 2026-09-05T22:07:06-04:00
Preserve tick ordering in 'tickTickedExpr'
'GHC.Core.Utils.tickTickedExpr' tries to combine a tick 't1' into an
existing stack of ticks 't2s'. There are two situations:
1. 't1' is subsumed by a tick in 't2s': drop it.
2. A tick in 't2s' is subsumed by 't1', say 't2'.
This commit ensures that in case (2) we keep 't1' on the outside instead
of replacing 't2' at its position in the stack. This avoids re-ordering
source notes (which was the cause of #27749).
This fixes a regression introduced in 2dadf3b0d05.
Fixes #27749
- - - - -
3172f557 by sheaf at 2026-09-05T22:07:06-04:00
Consistently prefer local source note ticks
GHC.Cmm.DebugBlock.cmmDebugGen (DWARF annotations) and
GHC.Stg.Debug.quickSourcePos (-finfo-table-map) both contained logic to
prioritise source note ticks from the current module.
This commit commons up this logic and propagates it to a third consumer:
IPE stack frames, in GHC.Driver.GenerateCgIPEStub.
See the new function GHC.Types.Tickish.bestSourceNote.
- - - - -
192be0b6 by Luite Stegeman at 2026-09-07T19:43:36-04:00
rts: fix ctoi_tuple_spill_words getting out of sync
Fix a few places that were not updating ctoi_tuple_spill_words
correctly, leading to corruption/crashes when dealing with large
unboxed tuples in bytecode:
- captureContinuationAndAbort
- findRetryFrameHelper/findAtomicallyFrameHelper
- interpretBCO bci_BRK_FUN
fixes #27633
- - - - -
604eb43c by Simon Jakobi at 2026-09-07T19:44:15-04:00
Hadrian: don't capture the testsuite driver's output (#27780)
a6061455d54 switched the Testsuite RunTest case from Shake's cmd to the
cmd' wrapper. cmd' always captures stdout and stderr, and since the
caller asks for Exit, it returns without dumping what it captured. As a
result the testsuite output no longer appears in CI job logs: failures,
performance metrics and the summary were lost with the job.
Use cmdExe, the uncaptured cmd, as the other plain-cmd sites in that
commit do.
Fixes #27780.
Assisted-by: Claude Fable 5.1
- - - - -
06eee015 by Luite Stegeman at 2026-09-08T06:03:06+02:00
rts: Fix missing memory barrier in eval_thunk_selector (#27477)
unchain_thunk_selectors() was missing an ACQUIRE_LOAD for the
indirectee, leading to segfaults and corruption during GC on
weakly-ordered architectures.
Fixes #27477
- - - - -
f8b2bd8f by Alan Zimmerman at 2026-09-08T09:39:12-04:00
EPA Fix HsCmdDo exact print with comments
Exact printing of HsCmdDo was ignoring the location for the do
statements, and this is an annotation that can have comments in it.
Update it so we print the statements as a unit, including any
comments.
Also add the result of auditing that we capture comments in all needed
places, noting that the remaining Anno SrcSpan instances are benign.
- - - - -
430967ab by Duncan Coutts at 2026-09-09T11:07:01+01:00
Reorder cmm decls in HeapStackCheck for a better logical grouping
And put more section headers in to deliniate the groups.
We're about to add more here, so better to organise it first.
- - - - -
344080fd by Duncan Coutts at 2026-09-09T11:07:01+01:00
Add raisePrimIOException and add it to RTS<->ghc-internal API
The raisePrimIOException is a new helper function that I/O primops will
use to help them report I/O errors. This is implemented in Haskell
(since that's a lot easier), but has a calling convention that is
easy(ish) to use from Cmm in the I/O primops.
So we add it to the RTS API struct, and since we'll use it from Cmm we
also need a field accessor macro for cmm (in deriveConstants).
See the Note about how we cannot have nice things due to async
exceptions and thunks preventing us from using catch.
- - - - -
cfdb3399 by Duncan Coutts at 2026-09-09T11:07:01+01:00
Add new blocking functions for I/O primops
See the Note [Thread blocking for new I/O primops],
and the Note [Calling convention for raisePrimIOException].
The point is, it will allow us to report synchronous exceptions from I/O
primops, and do so much more flexibly.
Previously the I/O managers could only report async exceptions and only
nullary exceptions. This was OK historically, but no good as we add
more I/O managers and expand the range of I/O operations we support.
- - - - -
f09c09d8 by Duncan Coutts at 2026-09-09T11:07:01+01:00
Change the encoding of results from the I/O manager to I/O primops
Previously we just had async continue or heap overflow.
We now extend what we can report with synchronous success, and
synchronous failure with an errno.
See Note [Encoding of result of I/O manager operations]
We don't use these two new cases yet, but we will. In particular an
epoll I/O manager needs to be able to report synchronous success or
failure for waitRead#/waitWrite#.
- - - - -
30f074d9 by Duncan Coutts at 2026-09-09T11:07:01+01:00
Switch waitRead/Write# to use new blocking return frames
and update the I/O managers to set the result before resuming the
blocked threads.
This makes it possible for I/O managers to report synchronous exceptions
from the I/O primops, but that will be done in a subsequent commit.
- - - - -
a8786ced by Duncan Coutts at 2026-09-09T11:07:01+01:00
Switch Poll and Select I/O managers to report sync exceptions
rather than using raiseAsync with blockedOnBadFD_closure.
This uses the new mechanism in the blocking frame return code to report
synchronous exceptions.
- - - - -
7a9df79a by Duncan Coutts at 2026-09-09T11:07:01+01:00
Remove now-unused blockedOnBadFD
It was previously thrown by the select and poll I/O managers, but now
they use raisePrimIOException (with an EBADF errno).
- - - - -
6b0424e3 by Duncan Coutts at 2026-09-09T11:07:01+01:00
Improve the docs for delay# waitRead# and waitWrite#
Document that the waitRead/Write# can throw exceptions (this was true
before too), and that all of them are async exception cancellation
points.
- - - - -
afeb2c30 by Duncan Coutts at 2026-09-09T20:08:58-04:00
Enable printf warnings for trace functions and fix resulting warnings
Most of the existing printf-style functions are annotated with
attributes to enable gcc/clang warnings for the printf format string,
but several trace functions in Trace.h were missing this annotation.
Enable them, and fix the resulting warnings.
- - - - -
9a442c93 by Alan Zimmerman at 2026-09-09T20:09:36-04:00
EPA: Exact print ConDeclGADT without custom enterAnn
!16321 brought in explicit capture of parens in a ConDeclGADT.
The ExactPrint update introduced a modification of the fundamental
function in exact printing, `enterAnn`, by splitting it into a version
allowing injection of functionality normally handled by the
ExactPrint class methods.
This commit refactors that code, to restore the prior `enterAnn`
version, by following the convention in ExactPrint of introducing a
helper data structure with its own `ExactPrint` instance to achieve
the same effect.
- - - - -
4e9297ea by Simon Jakobi at 2026-09-11T08:32:45-04:00
ci: Actually pass --ignore-perf-failures to the testsuite driver
684c0018d9 changed the IGNORE_PERF_FAILURES handling to append to
RUNTEST_ARGS with bash array syntax, but the three use sites still
expand RUNTEST_ARGS as a scalar, which yields only the first array
element. The appended flag was therefore dropped in every job, so
perf improvements kept failing Marge Bot batches and master pipelines,
contrary to #19562.
Append as a string instead, matching the existing --force-colors
append in test_hadrian.
Fixes #27563.
Assisted-by: Claude Fable 5.1
- - - - -
4f78dfdf by Simon Jakobi at 2026-09-11T08:33:24-04:00
testsuite: Give T26537 a 1.5x compile timeout
Its -fregs-graph compile step tends to time out in unoptimized builds
(#27188, #27776).
Assisted-by: Claude Fable 5.1
- - - - -
130286e3 by Alan Zimmerman at 2026-09-11T08:34:08-04:00
EPA: Remove ListBanana / ListParens from AnnListBrackets
This is a step towards making AnnList only represent
lists of items which can have either braces or layout.
- - - - -
a9827d13 by Simon Jakobi at 2026-09-11T18:53:32-04:00
Reject ~, UNPACK and multiplicity annotations on type data fields
Only `!` was rejected so far. `~`, UNPACK and multiplicity annotations
were silently accepted. None of them make sense at the type level, so
restriction (R3) of Note [Type data declarations] now covers all of
them.
Fixes #27732.
Assisted-by: Claude Fable 5.1
- - - - -
c71d5e23 by Alan Zimmerman at 2026-09-11T18:54:11-04:00
EPA: Add a Note for the exact print main loop
- - - - -
7a108e43 by Simon Jakobi at 2026-09-12T18:35:59-04:00
FastString: Drop mkFastStringWith's constructor callback
All three callers passed the same callback, a partial application of
mkNewFastStringShortByteString to the string being interned. That
partial application is allocated as a closure before the table lookup,
on the common hit path too, although the callback is needed only after
a miss.
Drop the parameter and call mkNewFastStringShortByteString directly
after a miss. Since nothing is passed "with" anymore, rename the
function to internSB.
Suggested by Simon PJ in #27528:
https://gitlab.haskell.org/ghc/ghc/-/work_items/27528#note_687031
Assisted-by: Claude Fable 5
- - - - -
82c73b22 by Alan Zimmerman at 2026-09-12T18:36:38-04:00
EPA: More targeted HsDo exact print annotation
HsDo is multi-purpose, as encoded in its HsDoFlavour field. Some of
these are in a layout context (DoExpr, MDoExpr), others are not
(ListComp, MonadComp).
We are moving towards using AnnList only in layout contexts, so we
switch the HsDo TTG annotation from holding an AnnList for this, to
holding
Either (EpToken "[", EpToken "]") AnnList
This also allows us to trim down AnnListBrackets to only have braces
or None, thereby opening the door for unification with the existing
layout context data type EpLayout.
- - - - -
749d2448 by Luite Stegeman at 2026-09-15T14:07:01-04:00
rts: handle large CONSTR 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 1
Closure type 1 is CONSTR. This patch adds cases for CONSTR and
CONSTR_NOCAF.
This is the same problem as #27434 (large AP closures, fixed by
cca0d58963), which missed this case.
Fixes #27649
- - - - -
177d6155 by Luite Stegeman at 2026-09-15T14:07:02-04:00
testsuite: fix T27434 test with compacting GC
Ensure that the interpreter is actually run with the compacting GC
- - - - -
5796aa63 by Luite Stegeman at 2026-09-15T14:07:49-04:00
rts: initialise the stack frame header for mask_frame and apply_mask_frame
We must leave the stack in consistent state before jumping to
mask_frame or apply_mask_frame because they may result. Failing
to do so could lead to a crash if there were waiting exceptions.
Fixes #27651
- - - - -
2486cc92 by Simon Peyton Jones at 2026-09-15T14:08:36-04:00
Re-introduce the "weird SpecDict" case
In this commit
commit f80375dd4945350a1d784e436975b48b9c736eaf
Author: Simon Peyton Jones <simon.peytonjones(a)gmail.com>
Date: Sun Jun 29 15:26:58 2025 +0100
Refactor of Specialise.hs
I removed a test for a dictionary with unbound type variables. This
turned out to be wrong; see #27629.
So this MR re-introduces it.
- - - - -
8e09a46f by Duncan Coutts at 2026-09-15T20:11:35-04:00
Refactor (and rename) removeFromQueues, to simplify I/O managers
Rename it to unblockAndAppendToRunQueue which better reflects what it is
intended to do.
The post-condition for unblockAndAppendToRunQueue is that the TSO is on
the run queue or it is in the process of migrating to another cap.
Previously it achieved that by always directly adding the TSO to the run
queue itself.
But this actually made things more complicated for the I/O managers,
because it meant they needed a separate code path for notifying for
cancellation compared to notifying for completion. The general
notification code would always add the TSO to the run queue itself.
So the improvement is to allow different cases in
unblockAndAppendToRunQueue to achieve the same outcome in different
ways: either directly adding to the run queue or calling helper
functions that do so themselves.
This then allows the new I/O managers to share code between the sync and
async cancellation, and to reuse their notifyIOCompletion helpers for
cancellation. This avoids a source of bugs where the completion path may
be updated but the cancellation path may be forgotten, or similarly in
future for sync/async operations.
Update all the existing in-RTS I/O managers, and the posix timeout code.
- - - - -
d668782c by Duncan Coutts at 2026-09-15T20:11:35-04:00
Document that awaitCompletedTimeoutsOrIO expects an empty run queue
This was true before but implicit and not relied on much. It's better to
be explicit, and allow things to depend on it.
- - - - -
11d938bb by Duncan Coutts at 2026-09-15T20:11:35-04:00
Store the I/O opcode and fd in the StgAsyncIOOp
This will be useful in several I/O managers and it is handy for logging
and debugging.
It also doesn't increase the size of the StgAsyncIOOp structure. There
was enough spare padding space already.
Update the poll I/O manager to set the new fields.
Add a helper function to convert the enum IOReadOrWrite into the enum
IOOpCode. Also change IOReadOrWrite to be an enum without a typedef, for
consistency with other enumerations in IOManager.h
- - - - -
bfa87882 by Duncan Coutts at 2026-09-15T20:11:36-04:00
Add a new I/O manager based on select()
Yes, this is the second such I/O manager, but it is a modern
re-implementation based on the new in-RTS I/O manager infrastructure. So
it is cleaner and faster than the old select I/O manager.
Why do we need another I/O manager based on select? Why isn't the poll()
one good enough as a baseline portable unix I/O manager? Because macOS.
Apple Inc. is why we cannot have nice things.
The man page for poll on macOS documents the fact that it does not work.
At least, it does not work for all files. Specifically, it does not work
for device files. Whereas macOS select() does work for device files.
Aaaaarg!
We _do_ want to deprecate and remove the old select I/O manager, but due to
macOS we cannot do that until we have a replacement. This is that
replacement. Until of course a nice new k-queue I/O manager arrives,
which could become the new default for macOS and FreeBSD.
Interestingly, this select I/O manager is actually faster than the poll
one, on Linix, in some circumstances: specifically when many Haskell
threads are waiting on the same fd. The poll I/O manager does O(n) work
for n threads waiting on I/O, whereas the select one does O(fds) work
for the number of fds that threads are waiting on. Usually this is 1:1,
so it's not noticable, but one can concoct extreme benchmarks to show
the difference.
- - - - -
8e9de15a by Duncan Coutts at 2026-09-15T20:11:36-04:00
Minor updates in the poll I/O manager to keep in sync with select
This keeps it in sync with select one. The changes are based on code review
while implementing the new select I/O manager. The two I/O managers are so
similar in structure that it makes sense to try to minimise the diff between
them. This should aid understanding, and fixes to both in future.
- - - - -
222668bb by Duncan Coutts at 2026-09-15T20:11:36-04:00
Document the new select I/O manager in the user guide
in the RTS section about I/O managers.
And add a changelog entry.
- - - - -
0f48735b by Cheng Shao at 2026-09-15T20:12:23-04:00
Revert "wasm: workaround WebKit bug in dyld"
This reverts commit c9b8465c2c338176fcab9d197e9d31f4aee11f68. The
underlying webkit bug has been fixed in
https://commits.webkit.org/314219@main. Closes #27564.
- - - - -
809294f1 by Luite Stegeman at 2026-09-15T20:13:08-04:00
rts: make stg_threadLabelzh return a valid pointer for unlabeled threads.
This fixes a segfault in the GC caused by stg_threadLabelzh returning
a 0 pointer in a GC pointer field.
stg_threadLabelzh returns a tuple of type (# Int#, ByteArray# #). If a
thread has no label, the second field is unused. We must still return
a valid heap object pointer.
Instead of returning 0, we now return stg_DEAD_SLOT_closure.
fixes #27618
- - - - -
e2d57026 by Luite Stegeman at 2026-09-15T20:13:54-04:00
JS: fix selector thunk handling
fix a bug where entering a selector thunk could lead to a crash
if the selected field was still a thunk.
fixes #27788
- - - - -
1b4a622f by sheaf at 2026-09-17T02:39:13-04:00
Improvements to type/data family handling
This commit makes several improvements to the treatment of type and data
families in GHC:
- We consistently use "type family" instead of "type synonym family"
to avoid a confusion with type synonyms. For example:
- OpenSynFamilyTyCon ==> OpenTypeFamilyTyCon
- ClosedSynFamilyTyCon => ClosedTypeFamilyTyCon
- Various functions that were specific to data families have been
renamed to make this clear. For example:
- tyConFamInst_maybe ==> tyConDataFamInst_maybe
- isFamInstTyCon ==> isDataFamInstTyCon
- 'FamTyConFlav' has been refactored so that all closed type families
share a single 'ClosedTypeFamilyTyCon' constructor.
The corresponding 'IfaceFamTyConFlav' type was updated similarly.
This is then used to tidy up the implementation of
GHC.Core.FamInstEnv.reduceTyFamApp_maybe.
- - - - -
c5aa9098 by sheaf at 2026-09-17T02:39:13-04:00
Small refactor of lookupFamInstEnv
This commit reworks the code for looking up family instances in
GHC.Core.FamInstEnv, reducing duplication a little bit.
No change in behaviour.
- - - - -
a3ad4588 by sheaf at 2026-09-17T02:39:14-04:00
Use a type family for boxing unboxed types
This commit overhauls the way in which unboxed types are boxed, as per
the updated Note [Boxing constructors] in GHC.Builtin.WiredIn.Types.Box.
The main change is to allow boxing to be parametrised by representation,
e.g. making 'Box ty' a valid type. We achieve this by implementing 'Box'
using a closed type family:
newtype Box (a :: TYPE r) = Box (BoxTF r)
type BoxTF :: RuntimeRep -> Type
type family BoxTF r where
BoxTF IntRep = BoxInt
BoxTF Int8Rep = BoxInt8
BoxTF WordRep = BoxWord
BoxTF LiftedRep = Any @Type
BoxTF (TupleRep [r1, r2]) = (BoxTF r1, BoxTF r2)
...
BoxTF (SumRep rs) = BoxSum rs
This new design solves the following problems:
- It allows boxing a type whose 'RuntimeRep' has not yet been
determined (e.g. because we only learn the 'RuntimeRep' after
constraint solving). That is, 'Box @r a' is a perfectly valid type
even if 'r' is an unfilled metavariable. This is a requirement
to fix #25065 (in which we need to box a type whose 'RuntimeRep'
is only filled in during constraint solving).
- It handles boxing of unboxed tuples and unboxed sums, via recursive
boxing. See Note [Boxing TupleRep and SumRep] in
GHC.Builtin.WiredIn.Types.Box.
'Box', 'BoxTF' and all of the boxing data constructors are defined in
a new 'ghc-internal' module, 'GHC.Internal.Box'. This module contains
nothing but wired-in declarations, and GHC never loads its interface on
account of a wired-in thing (GHC.Builtin.Modules.isWiredInOnlyModule);
see Note [Loading instances for wired-in things] in GHC.Iface.Load.
The individual boxing data constructors are deliberately left as an
internal implementation detail, and not exported. The intended API is
via the two new magic 'Id's:
box :: forall {r} (a :: TYPE r). a -> Box a
unbox :: forall {r} (a :: TYPE r). Box a -> a
exported from 'GHC.PrimOps' (in 'ghc-experimental'). The old boxing
data types (IntBox, WordBox, FloatBox, DoubleBox, DictBox) are no longer
exported from base (CLC proposal #421).
We use this new design to consistently desugar:
- parallel comprehensions (GHC.HsToCore.ListComp.{deListComp,dsMcStmt})
- then/group/using statements (GHC.HsToCore.ListComp.{dsTransStmt,dsMcStmt})
- recursive do blocks (mdo/rec) (GHC.HsToCore.Expr.dsDo)
- arrows (GHC.HsToCore.Arrows)
by consistently using 'box'/'unbox' to deal with unboxed types being put
into big tuples. We also adapt 'GHC.Tc.Gen.Match.{tcMcStmt,tcDoStmt}'
to create fresh /representation-polymorphic/ type variables for the
binders that we are going to put into a big tuple (previously, GHC only
allowed lifted types in that position).
These desugaring of box and unbox is explained in
Note [Desugaring box & unbox] in GHC.Core.Make.Box. Roughly speaking,
the desugaring looks like:
box @r @ty e ==> K e
unbox @r @ty e ==> case e of K x -> x
where 'K' is the boxing data constructor at RuntimeRep 'r'. It's
slightly more complicated than that in practice: we first need to
insert a cast (see Note [The canonical type of a RuntimeRep]) using the
new 'CanonicalProv' 'UnivCoProvenance', and unboxed tuples/sums need
recursive logic explained in Note [box/unbox for unboxed tuples and sums],
including a specific 'BoxSum' datatypes for unboxed sum (which also
needed a wired-in type-level list indexing type family (!!)).
The desugaring happens in two ways:
- Occurrences of 'box'/'unbox' emitted by the typechecker are
eliminated in the 'ds_app_var' case of GHC.HsToCore.Expr.
- Other code that needs to box/unbox emits the appropriate code inline.
This includes the big tuple machinery of GHC.Core.Make used by the
desugarer (GHC.HsToCore.{Utils,Binds,Arrows,ListComp}) as well as
the float-out pass (GHC.Core.Opt.SetLevels).
Core Lint checks that no occurrence of 'box'/'unbox' survives desugaring.
On the way, we overhaul the litany of big tuple functions by introducing
data BigTupleLayout = BoxedElements | BareElements
to distinguish the two kinds of "big tuples" that GHC routinely deals
with; for example 'mkBigCoreVarTupSolo' becomes 'mkBigCoreVarTup BareElements'.
All of this code is moved to the new module GHC.Core.Make.BigTuple.
Fixes #20864 #22336 #22473 #25065 #27331
-------------------------
Metric Decrease:
T9872a
-------------------------
- - - - -
4cf7628a by Evgeny Malyshev at 2026-09-17T02:39:56-04:00
Fix the CompactionFailed documentation link to compact
The old Haddock reference links into base instead of ghc-compact.
Use an explicit URL because ghc-compact depends on base, not vice versa.
Fixes #27558
Assisted-By: OpenAI Codex
- - - - -
098bba70 by Facundo Domínguez at 2026-09-17T14:57:41-04:00
Remove the call to hoistFlag from processCmdLineP
This call was undesirable because it was causing a reconstruction
of the list of flag processors.
Even relying on list fusion would not be sufficient because we want
to replace the list with a data structure with faster lookups to
address #25763.
The removal is done in two moves:
* We move CmdLineP to CmdLine.hs
* Then we move the effect of hoisting to processArgs via a new function
hoistEwM
- - - - -
e01799c7 by Facundo Domínguez at 2026-09-17T14:57:42-04:00
Do not create duplicate flag processors for the -W flag
This makes simpler implementing the command line parser with a trie map
holding flag processors. If we were to allow duplicate flag processors
for any flag, the trie map would need to be a multimap.
- - - - -
3875b257 by Facundo Domínguez at 2026-09-17T14:57:42-04:00
Replace the list of flag processors with a trie map in `processArgs`
Previously `GHC.Driver.CmdLine.findArg` was called for each
command-line argument, doing a linear search on the list of flag
processors each time. This was somewhat costly as the list of flag
processor has near 2000 elements.
A lookup with a trie map is faster in general, but the speed up is
only noticeable when calling `GHC.Driver.CmdLine.processArgs` sufficient
times, so the amount of lookups piles up. This could happen in large
projects with many units each having many dependencies. If only a
module needs to be recompiled, the user still needs to wait for all of
the flag parsing to complete.
The benchmark at testsuite/tests/perf/compiler/cmdline-parser shows a
10x speed up when using the trie.
The trie map is implemented in `GHC.Data.StringTrie`.
The design is explained in Note [Processing command line argument fast]
in GHC.Driver.Session.
The commit also:
* adds two property-based tests for trie map operations,
* adds a benchmark of the command line parser, and
* renames the predicate `arg_ok` to `valid_flag_suffix` to decide what
flag processor should be used when there are multiple matching
prefixes on a flag.
Fixes #25763.
- - - - -
5236634a by Andreas Klebinger at 2026-09-17T14:58:24-04:00
Compile Word64{Map,Set} with -O2 always.
This is the hottest code and even if we build GHC with -O0 otherwise -O2
pays off for these modules.
Fixes #27814.
- - - - -
545fd4fb by ARATA Mizuki at 2026-09-22T15:03:24-04:00
Change the C types of hs_{bitrev,bswap}{16,32} to match the Haskell types
bitReverse{16,32}# and byteSwap{16,32}# have the type
Word# -> Word#, but their C correspondents took and
returned StgWord{16,32}.
The mismatch on bitReverse16# led to the problem reported
in #27299. Although no similar issue is reported for
bitReverse32# and byteSwap{16,32}#, it seemed wise to
change them proactively.
This commit fixes the mismatch by changing the C type.
Fixes #27299
- - - - -
bf17f289 by fendor at 2026-09-22T15:04:05-04:00
Don't lose instances from shadowed imported modules with the same name
When we look for instances below the current module, we need to check
the unit id as well when we check for whether the module is the current
module, otherwise we ignore modules we import that have the same name as
the import module.
Adds regression test.
- - - - -
53eead15 by Wolfgang Jeltsch at 2026-09-24T20:12:03-04:00
Correct the documentation of `explicitUnits`
Resolves #27787.
- - - - -
35bf6f4b by Simon Jakobi at 2026-09-24T20:12:49-04:00
Remove stale specHeader bullet from Note [Don't make fillers for constraint types]
The Note said that Specialise.specHeader also calls mkAbsentFiller.
abfc224a27c removed that call: the specialiser no longer drops dead
arguments at all, see Note [Do not drop dead args from specialisations]
in GHC.Core.Opt.Specialise.
Assisted-by: Claude Fable 5.1
- - - - -
1abef1ef by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00
Improve the `mhu-closure` makefile
- - - - -
a79a68ea by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00
Make `ghci-multi` hide all unneeded packages
- - - - -
d6e72450 by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00
Improve the definition of the home unit closure property
- - - - -
c9a2766d by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00
Re-implement the home unit closure check
Compared to the previous implementation, the new one has the following
advantages:
* It is correct.
- It distinguishes between units that have the same unit ID but
different ABI hashes.
- When `-hide-all-packages` is not used, it considers as home unit
dependencies also units that are made implicitly available
because they are in the package database.
* It seems to be faster in usual settings.
- In particular, it does not have a preparation phase in which it
merges the dependency information from all home units, so that
its running time does not grow linearly with the size of the
package database in normal Cabal scenarios.
* It is (hopefully) clearer.
* It is better documented.
- - - - -
fa96acf8 by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00
Remove erroneous GHC flag in `hadrian-multi`
The flag was `-Werror=-Wno-error=incomplete-record-selectors`. Its
purpose was to permit incomplete record selectors, but because of the
illegal combination of `-Werror=` and `-Wno-error` it was ignored,
without any negative consequences.
- - - - -
9f48a5b9 by Alan Zimmerman at 2026-09-25T17:02:50-04:00
EPA: Add specific layout field to AnnList
Up to now AnnList has effectively served to represent lists of things
having layout, regardless of whether they do or not.
In Haskell, layout is optional in many places, as there is also an
alternative syntax using braces and semi-colons, which is free-form.
This commit introduces AnnListLayout, a data structure capturing this
distinction.
It is deliberately set up similarly to EpLayout, so that these two can
be merged in time.
The transition is done mechanically, where AnnListBraces is not used
yet, the original Nothing case maps to AnnListNoLayout, and the Just
case to AnnListLayout.
Later commits will fine tune these against the actual parser layout.
- - - - -
ae260fb6 by mangoiv at 2026-09-29T15:01:26+02:00
configure: fix sed script and subst tooldir script
Fixes #27672
Metric Decrease:
LinkableUsage01
MultiLayerModulesTH_OneShot
T10547
T12234
T12425
T13035
T13820
T18140
T18730
T18923
T9198
TcPlugin_RewritePerf
mhu-perf
- - - - -
394 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- + changelog.d/25763-cmdline-opt
- + changelog.d/26610
- + changelog.d/27556
- + changelog.d/27732
- + changelog.d/T27629
- + changelog.d/T27749
- + changelog.d/T27764
- + changelog.d/T27788-js-selector
- + changelog.d/allow-gadt-prefix-con-parens
- + changelog.d/boxing-family
- + changelog.d/clc-421
- + changelog.d/fix-compacting-gc-constr-27649
- + changelog.d/fix-control0-mask-trampoline
- + changelog.d/fix-parallel-gc-selector-race-27477
- + changelog.d/fix-threadlabel-segfault-27618
- + changelog.d/implicit-field-strictness-warning
- changelog.d/lazy-field-annotations
- + changelog.d/llvm-23
- + changelog.d/ncg-x86-bit-test-instructions
- + changelog.d/select-io-manager
- compiler/GHC/Builtin.hs
- compiler/GHC/Builtin/KnownKeys.hs
- compiler/GHC/Builtin/Modules.hs
- compiler/GHC/Builtin/Uniques.hs
- compiler/GHC/Builtin/WiredIn/Ids.hs
- compiler/GHC/Builtin/WiredIn/Prim.hs
- compiler/GHC/Builtin/WiredIn/TypeLits.hs
- compiler/GHC/Builtin/WiredIn/Types.hs
- + compiler/GHC/Builtin/WiredIn/Types/Box.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- + compiler/GHC/Core/Make/BigTuple.hs
- + compiler/GHC/Core/Make/Box.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/AddImplicitBinds.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/FastString.hs
- + compiler/GHC/Data/StringTrie.hs
- compiler/GHC/Data/Word64Map/Internal.hs
- compiler/GHC/Data/Word64Map/Strict/Internal.hs
- compiler/GHC/Data/Word64Set/Internal.hs
- compiler/GHC/Driver/CmdLine.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Errors/Types.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/GenerateCgIPEStub.hs
- compiler/GHC/Driver/Main/Compile.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension/Pass.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Decl.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Rename.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Stg/Debug.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/StgToJS/Apply.hs
- compiler/GHC/StgToJS/CodeGen.hs
- compiler/GHC/StgToJS/Symbols.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/FunDeps.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Utils/Backpack.hs
- compiler/GHC/Types/CompleteMatch.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/Tickish.hs
- compiler/GHC/Types/TyThing.hs
- compiler/GHC/Types/TyThing/Ppr.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/State.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Type.hs
- compiler/ghc.cabal.in
- configure.ac
- distrib/configure.ac.in
- docs/users_guide/exts/gadt_syntax.rst
- docs/users_guide/exts/strict.rst
- docs/users_guide/exts/type_data.rst
- docs/users_guide/runtime_control.rst
- docs/users_guide/using-warnings.rst
- ghc/GHC/Driver/Session/Mode.hs
- hadrian/ghci-multi-cabal.in
- hadrian/src/Base.hs
- hadrian/src/Builder.hs
- hadrian/src/Hadrian/Builder.hs
- hadrian/src/Hadrian/Builder/Ar.hs
- hadrian/src/Hadrian/Oracles/Path.hs
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/Changelog.hs
- hadrian/src/Rules/Codes.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Rules/Nofib.hs
- hadrian/src/Rules/Test.hs
- libraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs
- libraries/base/src/GHC/RTS/Flags.hs
- libraries/base/tests/all.T
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/include/RtsIfaceSymbols.h
- + libraries/ghc-internal/src/GHC/Internal/Box.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Thread.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
- libraries/ghc-internal/src/GHC/Internal/TypeNats.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- linters/lint-codes/LintCodes/Static.hs
- m4/find_python.m4
- + m4/fp_canonicalise_win_path.m4
- m4/fp_find_nm.m4
- m4/fp_find_root.m4
- m4/fp_prog_ar.m4
- m4/fp_prog_ar_args.m4
- m4/fp_prog_sh.m4
- m4/fptools_alex.m4
- m4/fptools_happy.m4
- m4/subst_tooldir.m4
- rts/Capability.c
- rts/Continuation.c
- rts/ContinuationOps.cmm
- rts/HeapStackCheck.cmm
- rts/IOManager.c
- rts/IOManager.h
- rts/IOManagerInternals.h
- rts/Interpreter.c
- rts/Messages.c
- rts/Prelude.h
- rts/PrimOps.cmm
- rts/Printer.c
- rts/ProfHeap.c
- rts/RaiseAsync.c
- rts/STM.c
- rts/Schedule.c
- rts/Sparks.c
- rts/StableName.c
- rts/StgMiscClosures.cmm
- rts/ThreadPaused.c
- rts/Threads.c
- rts/Trace.h
- rts/configure.ac
- rts/eventlog/EventLog.c
- rts/include/rts/Flags.h
- rts/include/rts/RtsToHsIface.h
- rts/include/rts/storage/Closures.h
- rts/include/stg/MiscClosures.h
- rts/include/stg/Prim.h
- rts/posix/Poll.c
- rts/posix/Poll.h
- rts/posix/Select.c
- + rts/posix/SelectBis.c
- + rts/posix/SelectBis.h
- rts/posix/Timeout.c
- rts/posix/Timeout.h
- rts/prim/atomic.c
- rts/prim/bitrev.c
- rts/prim/bswap.c
- rts/rts.cabal
- rts/sm/Compact.c
- rts/sm/Evac.c
- rts/sm/GC.c
- rts/sm/GCUtils.c
- rts/sm/MBlock.c
- rts/sm/NonMoving.c
- rts/sm/NonMovingMark.c
- rts/sm/Storage.c
- rts/sm/Sweep.c
- testsuite/driver/README.md
- testsuite/driver/testlib.py
- testsuite/tests/MiniQuickCheck.hs
- testsuite/tests/arrows/should_run/all.T
- + testsuite/tests/arrows/should_run/arrowrun005.hs
- + testsuite/tests/arrows/should_run/arrowrun005.stdout
- + testsuite/tests/bytecode/T27633/Obj.hs
- + testsuite/tests/bytecode/T27633/T27633a.hs
- + testsuite/tests/bytecode/T27633/T27633a.stdout
- + testsuite/tests/bytecode/T27633/T27633b.hs
- + testsuite/tests/bytecode/T27633/T27633b.stdout
- + testsuite/tests/bytecode/T27633/all.T
- + testsuite/tests/codeGen/should_gen_asm/T25233.asm
- + testsuite/tests/codeGen/should_gen_asm/T25233.hs
- + testsuite/tests/codeGen/should_gen_asm/T25233b.asm
- + testsuite/tests/codeGen/should_gen_asm/T25233b.cmm
- testsuite/tests/codeGen/should_gen_asm/all.T
- testsuite/tests/codeGen/should_run/all.T
- testsuite/tests/count-deps/CountDepsParser.stdout
- + testsuite/tests/deSugar/should_compile/T25065a.hs
- testsuite/tests/deSugar/should_compile/all.T
- + testsuite/tests/deSugar/should_run/T20864.hs
- + testsuite/tests/deSugar/should_run/T20864.stdout
- + testsuite/tests/deSugar/should_run/T25065b.hs
- + testsuite/tests/deSugar/should_run/T25065b.stdout
- testsuite/tests/deSugar/should_run/all.T
- testsuite/tests/driver/all.T
- testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile
- testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr
- testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout
- + testsuite/tests/driver/stringtrie.hs
- + testsuite/tests/driver/stringtrie.stdout
- − testsuite/tests/gadt/T14320.stderr
- testsuite/tests/gadt/T18191.hs
- testsuite/tests/gadt/T18191.stderr
- + testsuite/tests/gadt/T27423a.hs
- + testsuite/tests/gadt/T27423b.hs
- + testsuite/tests/gadt/T27423b.stderr
- testsuite/tests/gadt/all.T
- testsuite/tests/ghc-api/T25121_status.stdout
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- + testsuite/tests/ghci.debugger/scripts/T27633c.hs
- + testsuite/tests/ghci.debugger/scripts/T27633c.script
- + testsuite/tests/ghci.debugger/scripts/T27633c.stdout
- + testsuite/tests/ghci.debugger/scripts/T27633c_obj.hs
- testsuite/tests/ghci.debugger/scripts/all.T
- + testsuite/tests/ghci/prog-mhu008/Makefile
- + testsuite/tests/ghci/prog-mhu008/a/M.hs
- + testsuite/tests/ghci/prog-mhu008/all.T
- + testsuite/tests/ghci/prog-mhu008/b/M.hs
- + testsuite/tests/ghci/prog-mhu008/prog-mhu008.script
- + testsuite/tests/ghci/prog-mhu008/prog-mhu008.stdout
- + testsuite/tests/ghci/prog-mhu008/unitA
- + testsuite/tests/ghci/prog-mhu008/unitB
- + testsuite/tests/indexed-types/should_run/T27331.hs
- + testsuite/tests/indexed-types/should_run/T27331.stdout
- + testsuite/tests/indexed-types/should_run/T27331b.hs
- + testsuite/tests/indexed-types/should_run/T27331b.stdout
- + testsuite/tests/indexed-types/should_run/T27331b_Plugin.hs
- testsuite/tests/indexed-types/should_run/all.T
- 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/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- + testsuite/tests/javascript/T27788.hs
- + testsuite/tests/javascript/T27788.stdout
- testsuite/tests/javascript/all.T
- testsuite/tests/linters/notes.stdout
- 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/KindSigs.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- + testsuite/tests/perf/compiler/T25763.stderr
- testsuite/tests/perf/compiler/all.T
- testsuite/tests/perf/compiler/large-project/all.T
- testsuite/tests/perf/space_leaks/all.T
- + testsuite/tests/primops/should_run/T27299.hs
- + testsuite/tests/primops/should_run/T27299.stdout
- testsuite/tests/primops/should_run/all.T
- testsuite/tests/printer/Makefile
- + testsuite/tests/printer/T27423c.hs
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- testsuite/tests/printer/all.T
- testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr
- testsuite/tests/rename/should_fail/T26545.stderr
- + testsuite/tests/rts/T27477.hs
- + testsuite/tests/rts/T27477.stdout
- + testsuite/tests/rts/T27618.hs
- + testsuite/tests/rts/T27618.stdout
- + testsuite/tests/rts/T27649.hs
- + testsuite/tests/rts/T27649.stdout
- testsuite/tests/rts/all.T
- + testsuite/tests/rts/continuations/T27651.hs
- + testsuite/tests/rts/continuations/T27651.stdout
- testsuite/tests/rts/continuations/all.T
- testsuite/tests/simplCore/should_compile/Makefile
- + testsuite/tests/simplCore/should_compile/T27556.hs
- + testsuite/tests/simplCore/should_compile/T27556.script
- + testsuite/tests/simplCore/should_compile/T27629.hs
- + testsuite/tests/simplCore/should_compile/T27629.stderr
- + testsuite/tests/simplCore/should_compile/T27629Plugin.hs
- + testsuite/tests/simplCore/should_compile/T27749.hs
- + testsuite/tests/simplCore/should_compile/T27749.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/th/T17380.stderr
- testsuite/tests/th/T18612.stderr
- + testsuite/tests/th/T27034.hs
- + testsuite/tests/th/T27034.stderr
- testsuite/tests/th/T8761.stderr
- testsuite/tests/th/all.T
- + testsuite/tests/type-data/should_fail/T27732a.hs
- + testsuite/tests/type-data/should_fail/T27732a.stderr
- + testsuite/tests/type-data/should_fail/T27732b.hs
- + testsuite/tests/type-data/should_fail/T27732b.stderr
- + testsuite/tests/type-data/should_fail/T27732c.hs
- + testsuite/tests/type-data/should_fail/T27732c.stderr
- + testsuite/tests/type-data/should_fail/T27732d.hs
- + testsuite/tests/type-data/should_fail/T27732d.stderr
- + testsuite/tests/type-data/should_fail/T27732e.hs
- + testsuite/tests/type-data/should_fail/T27732e.stderr
- + testsuite/tests/type-data/should_fail/T27732f.hs
- + testsuite/tests/type-data/should_fail/T27732f.stderr
- testsuite/tests/type-data/should_fail/TDStrictnessGADT.stderr
- testsuite/tests/type-data/should_fail/TDStrictnessH98.stderr
- testsuite/tests/type-data/should_fail/all.T
- + testsuite/tests/typecheck/should_compile/T27664.hs
- testsuite/tests/typecheck/should_compile/all.T
- + testsuite/tests/warnings/should_compile/T16836a.hs
- + testsuite/tests/warnings/should_compile/T16836a.stderr
- + testsuite/tests/warnings/should_compile/T16836b.hs
- + testsuite/tests/warnings/should_compile/T16836c.hs
- + testsuite/tests/warnings/should_compile/T16836c.stderr
- + testsuite/tests/warnings/should_compile/T16836d.hs
- + testsuite/tests/warnings/should_compile/T16836d.stderr
- testsuite/tests/warnings/should_compile/all.T
- + testsuite/tests/warnings/should_fail/WExpectedNoArgError.stderr
- testsuite/tests/warnings/should_fail/all.T
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/deriveConstants/Main.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Program.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/hsc2hs
- utils/jsffi/dyld.mjs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a5f53cea90e14a4e66974f307134e5…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a5f53cea90e14a4e66974f307134e5…
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] Pushed new branch wip/jeltsch/eps-without-mod-iface
by Wolfgang Jeltsch (@jeltsch) 29 Sep '26
by Wolfgang Jeltsch (@jeltsch) 29 Sep '26
29 Sep '26
Wolfgang Jeltsch pushed new branch wip/jeltsch/eps-without-mod-iface at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/jeltsch/eps-without-mod-iface
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/fendor/mingw-bindist] 2 commits: Fix path references in mingw default.target file
by Hannes Siebenhandl (@fendor) 29 Sep '26
by Hannes Siebenhandl (@fendor) 29 Sep '26
29 Sep '26
Hannes Siebenhandl pushed to branch wip/fendor/mingw-bindist at Glasgow Haskell Compiler / GHC
Commits:
720d5c52 by Hannes Siebenhandl at 2026-09-29T14:14:11+02:00
Fix path references in mingw default.target file
The escaping `$` is no longer necessary since 7d378476c33 copies
the `default.target` instead of generating it via config.mk.
- - - - -
5416da68 by Hannes Siebenhandl at 2026-09-29T14:17:52+02:00
Add sanity checking for SUBST_TOOLDIR
- - - - -
2 changed files:
- distrib/configure.ac.in
- m4/subst_tooldir.m4
Changes:
=====================================
distrib/configure.ac.in
=====================================
@@ -103,7 +103,7 @@ AC_ARG_ENABLE(distro-toolchain,
AC_SUBST([EnableDistroToolchain])
if test "$HostOS" = "mingw32" -a "$EnableDistroToolchain" = "NO"; then
- FP_SETUP_WINDOWS_TOOLCHAIN([$hardtop/mingw/], [\$\$topdir/../mingw/])
+ FP_SETUP_WINDOWS_TOOLCHAIN([$hardtop/mingw/], [\$topdir/../mingw/])
fi
=====================================
m4/subst_tooldir.m4
=====================================
@@ -41,5 +41,13 @@ dnl ghc-toolchain.
# See Note [How we configure the bundled windows toolchain]
AC_DEFUN([SUBST_TOOLDIR],
[
- sed -i.bkp $1 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g'
+ if ! grep -qF "$mingw_prefix" $1; then
+ AC_MSG_ERROR([SUBST_TOOLDIR: $1 does not refer to the bundled mingw toolchain at $mingw_prefix])
+ fi
+ if ! sed -i.bkp 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g' $1; then
+ AC_MSG_ERROR([SUBST_TOOLDIR: failed to substitute $mingw_prefix in $1])
+ fi
+ if grep -qF "$mingw_prefix" $1; then
+ AC_MSG_ERROR([SUBST_TOOLDIR: $1 still refers to $mingw_prefix after substitution])
+ fi
])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/06c6464956df5306648b95b62c3ca7…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/06c6464956df5306648b95b62c3ca7…
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] Pushed new branch wip/fendor/mingw-bindist
by Hannes Siebenhandl (@fendor) 29 Sep '26
by Hannes Siebenhandl (@fendor) 29 Sep '26
29 Sep '26
Hannes Siebenhandl pushed new branch wip/fendor/mingw-bindist at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/fendor/mingw-bindist
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] 2 commits: Add regression test for #7803
by Marge Bot (@marge-bot) 29 Sep '26
by Marge Bot (@marge-bot) 29 Sep '26
29 Sep '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f998dc1f by Vladislav Zavialov at 2026-09-29T07:14:21-04:00
Add regression test for #7803
Commit 2effe18ab5, first shipped with GHC 8.2.1, fixed #7803 "Superclass
methods are left unspecialized".
This change turns the example from the ticket description into a regression
test, checking that foo1 is fully specialised at Double, with no calls to the
overloaded exp5Tail.
Closes #7803
Assisted-by: Claude Opus 5
- - - - -
5b27f65f by Alan Zimmerman at 2026-09-29T07:14:22-04:00
EPA: Use EpaLocation in EpVirtualBraces
Haddock processing uses EpLayout.EpVirtualBraces to record the current
layout column, for allocating haddock comments correctly.
For exact printing, we need the line as well as the col, so we know
how many lines to skip when the indented code block starts.
This commit updates EpLayout.EpVirtualBraces so that it carries an
EpaLocation instead of just the Int column, to allow it to be used for
both purposes.
It is a simple mechanical change, with no other impact, but it allows
us to use EpLayout instead of AnnListLayout in AnnList, in the next
commit in this series.
- - - - -
28 changed files:
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- 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/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.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/printer/AnnotationNoListTuplePuns.stdout
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- + testsuite/tests/simplCore/should_compile/T7803.hs
- + testsuite/tests/simplCore/should_compile/T7803.stderr
- + testsuite/tests/simplCore/should_compile/T7803a.hs
- testsuite/tests/simplCore/should_compile/all.T
Changes:
=====================================
compiler/GHC/Parser.y
=====================================
@@ -945,13 +945,13 @@ body :: { ([TrailingAnn]
,([LImportDecl GhcPs], [LHsDecl GhcPs])
,EpLayout) }
: '{' top '}' { (fst $2, snd $2, epExplicitBraces $1 $3) }
- | vocurly top close { (fst $2, snd $2, EpVirtualBraces (getVOCURLY $1)) }
+ | vocurly top close { (fst $2, snd $2, EpVirtualBraces (glR $1)) }
body2 :: { ([TrailingAnn]
,([LImportDecl GhcPs], [LHsDecl GhcPs])
,EpLayout) }
: '{' top '}' { (fst $2, snd $2, epExplicitBraces $1 $3) }
- | missing_module_keyword top close { ([], snd $2, EpVirtualBraces leftmostColumn) }
+ | missing_module_keyword top close { ([], snd $2, EpVirtualBraces (EpaDelta noSrcSpan (SameLine 0) [])) }
top :: { ([TrailingAnn]
@@ -1855,7 +1855,7 @@ decllist_cls
: '{' decls_cls '}' { sLL $1 $> ((epTok $1, fst $ unLoc $2, epTok $3)
,snd $ unLoc $2, epExplicitBraces $1 $3) }
| vocurly decls_cls close { let { L l (anns, decls) = $2 }
- in L l ((noEpTok, anns, noEpTok), decls, EpVirtualBraces (getVOCURLY $1)) }
+ in L l ((noEpTok, anns, noEpTok), decls, EpVirtualBraces (glR $1)) }
-- Class body
--
@@ -4305,7 +4305,6 @@ getINLINE (L _ (ITinline_prag _ inl conl)) = (inl,conl)
getSPEC_INLINE (L _ (ITspec_inline_prag src True)) = (Inline,FunLike)
getSPEC_INLINE (L _ (ITspec_inline_prag src False)) = (NoInline,FunLike)
getCOMPLETE_PRAGs (L _ (ITcomplete_prag x)) = x
-getVOCURLY (L (RealSrcSpan l _) ITvocurly) = srcSpanStartCol l
getINTEGERs (L _ (ITinteger (IL src _ _))) = src
getCHARs (L _ (ITchar src _)) = src
=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -5,7 +5,7 @@ module GHC.Parser.Annotation (
getEpTokenBufSpan,
getEpTokenLoc, getEpUniTokenLoc,
TokDcolon, TokDarrow, TokRarrow, TokForall, TokStar,
- EpLayout(..),
+ EpLayout(..), getEpaLocationCol,
EpaComment(..), EpaCommentTok(..),
IsUnicodeSyntax(..),
HasE(..),
@@ -282,7 +282,9 @@ data EpLayout =
-- bar :: a
-- @
EpVirtualBraces
- !Int -- ^ Layout column (indentation level, begins at 1)
+ !EpaLocation -- ^ Layout column (indentation level, begins at 1)
+ -- We keep this as an 'EpaLocation' so exact printing
+ -- can use it too.
|
-- | Empty or compiler-generated blocks do not have layout information
-- associated with them.
@@ -290,6 +292,14 @@ data EpLayout =
deriving instance Data EpLayout
+-- | Used in 'GHC.Parser.Haddock' to get layout column. It assumes
+-- | there is a RealSrcSpan in it, falling back to zero otherwise
+getEpaLocationCol :: EpaLocation -> Int
+getEpaLocationCol loc
+ = case loc of
+ EpaSpan (RealSrcSpan l _) -> srcSpanStartCol l
+ _ -> leftmostColumn -- should never happen in Parser output
+
-- ---------------------------------------------------------------------
data EpaComment =
=====================================
compiler/GHC/Parser/PostProcess/Haddock.hs
=====================================
@@ -392,8 +392,9 @@ addHaddockInterleaveItems layout get_doc_item = go
with_layout = case layout of
EpNoLayout -> id
EpExplicitBraces{} -> id
- EpVirtualBraces n ->
- let loc_range = mempty { loc_range_col = ColumnFrom (n+1) }
+ EpVirtualBraces n' ->
+ let n = getEpaLocationCol n'
+ loc_range = mempty { loc_range_col = ColumnFrom (n+1) }
in hoistHdkA (inLocRange loc_range)
instance HasHaddock (LocatedA (HsDecl GhcPs)) where
@@ -1304,7 +1305,7 @@ mkDocDecl layout (L l_comment hdk_comment)
indent_mismatch = case layout of
EpNoLayout -> False
EpExplicitBraces{} -> False
- EpVirtualBraces n -> n /= srcSpanStartCol (psRealSpan l_comment)
+ EpVirtualBraces n -> getEpaLocationCol n /= srcSpanStartCol (psRealSpan l_comment)
mkDocIE :: PsLocated HdkComment -> Maybe (LIE GhcPs)
mkDocIE (L l_comment hdk_comment) =
=====================================
testsuite/tests/ghc-api/exactprint/T22919.stderr
=====================================
@@ -34,7 +34,7 @@
{ T22919.hs:1:8-13 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T22919.hs:2:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/ghc-api/exactprint/Test20239.stderr
=====================================
@@ -34,7 +34,7 @@
"-- ^ Run any arbitrary IO code")
{ Test20239.hs:7:86 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20239.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
=====================================
@@ -40,7 +40,7 @@
"-- Trailing comment, should be in HsModule extension point")
{ ZeroWidthSemi.hs:6:5 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { ZeroWidthSemi.hs:6:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T17544.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -64,7 +64,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:6:3 })))
[]
(Nothing)
(L
@@ -243,7 +243,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:10:3 })))
[]
(Nothing)
(L
@@ -423,7 +423,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:14:3 })))
[]
(Nothing)
(L
@@ -603,7 +603,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { T17544.hs:18:3 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T17544_kw.hs:13:1 }))
(Nothing)
(Nothing))
(Just
@@ -412,7 +412,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (5)))
+ (EpaSpan { T17544_kw.hs:22:5 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T24221.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/module/mod185.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaDelta { <no location info> } (SameLine 0) []))
(Nothing)
(Nothing))
(Nothing)
=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpParsedAst.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
=====================================
@@ -41,7 +41,7 @@
{ DumpParsedAstComments.hs:1:1-28 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpParsedAstComments.hs:9:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -45,7 +45,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { DumpSemis.hs:4:1 }))
(Nothing)
(Nothing))
(Just
@@ -1336,7 +1336,7 @@
(EpTok (EpaSpan { <no location info> }))
[])
(EpVirtualBraces
- (3)))
+ (EpaSpan { DumpSemis.hs:29:3 })))
[]
(Nothing)
(L
=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { KindSigs.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T15323.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T15323.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20452.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20452.hs:5:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20718.stderr
=====================================
@@ -68,7 +68,7 @@
"-- end 2")
{ T20718.hs:10:1-8 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20718.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20718b.stderr
=====================================
@@ -55,7 +55,7 @@
{ T20718b.hs:6:1-21 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20718b.hs:8:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T20846.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T20846.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/parser/should_compile/T23315/T23315.stderr
=====================================
@@ -24,7 +24,7 @@
(EpaComments
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T23315.hsig:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/AnnotationNoListTuplePuns.stdout
=====================================
@@ -47,7 +47,7 @@
"-- comment post B")
{ AnnotationNoListTuplePuns.hs:17:3 }))]))
(EpVirtualBraces
- (1))
+ (EpaSpan { AnnotationNoListTuplePuns.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -244,7 +244,7 @@
{ AnnotationNoListTuplePuns.ppr.hs:1:1-32 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { AnnotationNoListTuplePuns.ppr.hs:4:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/T18791.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T18791.hs:4:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/Test20297.stdout
=====================================
@@ -34,7 +34,7 @@
{ Test20297.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20297.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -476,7 +476,7 @@
{ Test20297.ppr.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test20297.ppr.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/printer/Test24533.stdout
=====================================
@@ -34,7 +34,7 @@
{ Test24533.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test24533.hs:4:1 }))
(Nothing)
(Nothing))
(Just
@@ -694,7 +694,7 @@
{ Test24533.ppr.hs:1:1 }))]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { Test24533.ppr.hs:3:1 }))
(Nothing)
(Nothing))
(Just
=====================================
testsuite/tests/simplCore/should_compile/T7803.hs
=====================================
@@ -0,0 +1,23 @@
+{-# OPTIONS_GHC -ddump-simpl #-}
+
+-- #7803: foo1 should be fully specialised at Double. In the bug report
+-- it ended up calling the overloaded exp5Tail (with a dictionary argument),
+-- because the specialiser ran before the overloaded call was floated to
+-- the top level. So the dumped Core for this module must mention no
+-- exp5Tail at all.
+module T7803 (foo1) where
+
+import T7803a
+
+bar :: Floating a => a -> a -> a
+bar z = subtract (evaluate integ z) . evaluate integ
+ where
+ integ = indefinite (Piecewise [Poly4 1])
+{-# SPECIALIZE bar :: Double -> Double -> Double #-}
+
+foo :: Floating a => a -> a -> a
+foo x = bar x
+{-# SPECIALIZE foo :: Double -> Double -> Double #-}
+
+foo1 :: Double -> Double -> Double
+foo1 x = foo x
=====================================
testsuite/tests/simplCore/should_compile/T7803.stderr
=====================================
@@ -0,0 +1 @@
+foo1
=====================================
testsuite/tests/simplCore/should_compile/T7803a.hs
=====================================
@@ -0,0 +1,73 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE UndecidableSuperClasses #-}
+
+module T7803a
+ ( Evaluate (..)
+ , HasIntegral (..)
+ , Poly4 (..)
+ , Domain
+ , IntOfLogPoly4 (..)
+ , Piecewise (..)
+ ) where
+
+import Data.Kind (Constraint, Type)
+
+class Evaluate poly where
+ evaluate :: (Domain' poly a) => poly a -> a -> a
+
+class Evaluate (IntegralOf poly) => HasIntegral poly where
+ type IntegralOf poly :: Type -> Type
+ indefinite :: (Domain' poly a, Domain' (IntegralOf poly) a)
+ => poly a -> IntegralOf poly a
+
+type family Domain (f :: Type -> Type) a :: Constraint
+
+class Domain f a => Domain' f a
+instance Domain f a => Domain' f a
+
+newtype Poly4 a = Poly4 { poly4_a :: a }
+
+type instance Domain Poly4 a = Fractional a
+
+data IntOfLogPoly4 a = IntOfLogPoly4 { ilp4_k :: !a, ilp4_u :: !a }
+
+type instance Domain IntOfLogPoly4 a = Floating a
+
+instance Evaluate IntOfLogPoly4 where
+ evaluate (IntOfLogPoly4 k _) x = k + x * exp5Tail (- log x)
+ {-# INLINE evaluate #-}
+
+{-# RULES "exp5Tail/Double" exp5Tail = exp5TailDouble #-}
+{-# NOINLINE exp5Tail #-}
+
+exp5Tail :: (Floating a) => a -> a
+exp5Tail x = x / 120
+
+exp5TailDouble :: Double -> Double
+exp5TailDouble x = x / 120
+
+instance HasIntegral Poly4 where
+ type IntegralOf Poly4 = IntOfLogPoly4
+ indefinite = \ (Poly4 a) -> IntOfLogPoly4 0 a
+ {-# INLINE indefinite #-}
+
+newtype Piecewise poly a = Piecewise { unPiecewise :: [poly a] }
+
+type instance Domain (Piecewise poly) a = (Domain poly a, Num a)
+
+instance (Evaluate poly) => Evaluate (Piecewise poly) where
+ evaluate = \ (Piecewise pp) x ->
+ case pp of
+ p : _ -> evaluate p x
+ [] -> error "evaluate: empty Piecewise"
+ {-# INLINE evaluate #-}
+
+instance (HasIntegral poly) => HasIntegral (Piecewise poly) where
+ type IntegralOf (Piecewise poly) = Piecewise (IntegralOf poly)
+ indefinite (Piecewise m) = Piecewise $ map indefinite m
+ {-# INLINE indefinite #-}
=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -148,6 +148,13 @@ test('T7785', [ only_ways(['optasm']),
grep_errmsg(r'SPEC') ],
compile, ['-ddump-cse'])
+# T7803: we expect NO calls to the overloaded 'exp5Tail' in T7803.hs
+# In the bug report #7803, the unspecialised call was signalled by 'exp5Tail'
+# in foo1's Core, so we grep for that; also for 'foo1', lest we dump nothing
+# One module, T7803.hs, has OPTIONS_GHC -ddump-simpl
+test('T7803', [ grep_errmsg(r'exp5Tail|foo1') ],
+ multimod_compile, ['T7803', '-O2 -v0 -dsuppress-all -dsuppress-uniques -dno-typeable-binds'])
+
test('T7702',
[extra_files(['T7702plugin']),
pre_cmd('$MAKE -s --no-print-directory -C T7702plugin package.T7702 TOP={top}'),
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a90c0c7281c26f357cf896dc92504d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a90c0c7281c26f357cf896dc92504d…
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/dcoutts/foreign-label-source-refactoring] Documentation: foreign imports of Cmm code may now specify source package
by David Eichmann (@DavidEichmann) 29 Sep '26
by David Eichmann (@DavidEichmann) 29 Sep '26
29 Sep '26
David Eichmann pushed to branch wip/dcoutts/foreign-label-source-refactoring at Glasgow Haskell Compiler / GHC
Commits:
f7ccabc1 by David Eichmann at 2026-09-29T12:12:05+01:00
Documentation: foreign imports of Cmm code may now specify source package
- - - - -
2 changed files:
- + changelog.d/foreign-import-prim-with-package.md
- docs/users_guide/exts/ffi.rst
Changes:
=====================================
changelog.d/foreign-import-prim-with-package.md
=====================================
@@ -0,0 +1,19 @@
+section: cmm
+synopsis: Foreign imports of Cmm code may now specify source package
+issues: #27162
+mrs: !15905
+description: {
+ With the `GHCForeignImportPrim` extension, Cmm symbols can be imported via the
+ `prim` calling convention, but there was previously no way to specify the
+ source package where the Cmm symbol is defined. With this change, the source
+ package may be specified before the symbol name, separated by a space. For
+ example, a Cmm symbol `addOne` from package `somePackage` can be imported as
+ follows:
+
+ foreign import prim "somePackage addOne" addOne :: Int# -> Int#
+
+ Once dynamic linking on windows is implemented, it will require specifying the
+ source package for Cmm imports unless the source package is the current
+ package. Failure to do so will result in linker errors. Non windows targets
+ and static linking on windows are unaffected.
+}
=====================================
docs/users_guide/exts/ffi.rst
=====================================
@@ -294,6 +294,10 @@ Primitive imports
:status: InternalUseOnly
+This feature is not intended for use outside of the core libraries that
+come with GHC. For more details see the
+:ghc-wiki:`GHC developer wiki <commentary/prim-ops>`.
+
With :extension:`GHCForeignImportPrim`, GHC extends the FFI with an additional
calling convention ``prim``, e.g.: ::
@@ -306,9 +310,15 @@ or ``Any :: UnliftedType`` (which can be arranged by way of
``unsafeCoerce#``) and the result type is allowed to be an unboxed tuple
or the types ``Any :: Type`` or ``Any :: UnliftedType``.
-This feature is not intended for use outside of the core libraries that
-come with GHC. For more details see the
-:ghc-wiki:`GHC developer wiki <commentary/prim-ops>`.
+The source package may be specified before the symbol name, separated by a
+space. For example, to import ``addOne`` from ``somePackage``: ::
+
+ foreign import prim "somePackage addOne" addOne :: Int# -> Int#
+
+When dynamic linking on windows, source package must be correctly specified.
+If the source package is omitted then it is assumed to be the current package.
+An incorrect source package will result in linker errors when dynamic linking
+on windows. Static linking and non-windows targets are unaffected.
.. _ffi-interruptible:
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f7ccabc15aac7d817d6789fe00c13d6…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f7ccabc15aac7d817d6789fe00c13d6…
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/fendor/homeunit-is-just] Deleted 1 commit: Use `panic` instead of dummy value for initial HomeUnit
by Hannes Siebenhandl (@fendor) 29 Sep '26
by Hannes Siebenhandl (@fendor) 29 Sep '26
29 Sep '26
Hannes Siebenhandl pushed to branch wip/fendor/homeunit-is-just at Glasgow Haskell Compiler / GHC
WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.
Deleted commits:
6251dc45 by fendor at 2026-09-29T11:40:20+02:00
Use `panic` instead of dummy value for initial HomeUnit
- - - - -
1 changed file:
- compiler/GHC/Driver/Main/Hsc.hs
Changes:
=====================================
compiler/GHC/Driver/Main/Hsc.hs
=====================================
@@ -112,7 +112,7 @@ newHscEnv top_dir dflags = do
where
home_unit_graph hpt = HUG.unitEnv_singleton
(homeUnitId_ dflags)
- (HUG.mkHomeUnitEnv emptyUnitState dflags hpt (DefiniteHomeUnit (homeUnitId_ dflags) Nothing))
+ (HUG.mkHomeUnitEnv emptyUnitState dflags hpt (panic "newHscEnv.mkHomeUnitEnv: HomeUnit is not initialised, call 'initUnits' before using the HomeUnit field"))
newHscEnvWithHUG :: FilePath -> DynFlags -> UnitId -> HomeUnitGraph -> IO HscEnv
newHscEnvWithHUG top_dir top_dynflags cur_unit home_unit_graph = do
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6251dc4583d271a16c9332c2945957d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6251dc4583d271a16c9332c2945957d…
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/dcoutts/foreign-label-source-refactoring] 15 commits: Change dsCCall to take a CCallSpec
by David Eichmann (@DavidEichmann) 29 Sep '26
by David Eichmann (@DavidEichmann) 29 Sep '26
29 Sep '26
David Eichmann pushed to branch wip/dcoutts/foreign-label-source-refactoring at Glasgow Haskell Compiler / GHC
Commits:
078d8ad0 by Duncan Coutts at 2026-09-25T13:34:03+01:00
Change dsCCall to take a CCallSpec
and change callers as appropriate. There should be no semantic change.
It's just moving the CCallSpec construction into the two callers.
It is currently only used by the C & JS functions that generate code for
the foreign import wrapper constructs (in the call to createAdjustor).
- - - - -
8024d575 by Duncan Coutts at 2026-09-25T13:34:04+01:00
Change calls to createAdjustor to specify that it comes from the rts
Previously it said TargetIsInThisUnit, meaning that createAdjustor lives
in the local library. This is false since createAdjustor is defined in
the RTS.
In practice, this false source information did not matter because the
source information is not used (yet). However in future it will be, for
better Windows DLL support (which does care about such distinctions).
It doesn't really matter that we say it's the RTS (though that is
actually true), what's important is that it will always be external to
the current shared library.
- - - - -
083ba611 by Duncan Coutts at 2026-09-25T13:34:04+01:00
Remove unused TargetIsInThisUnit case from CCallStaticTargetUnit
The CCallStaticTargetUnit infortmation in the XStaticTarget (TTG
exstension point) is actually pretty dubious.
Historically it was a (Maybe Unit) and the comments say that it is only
used by out-of-line primop calls on Windows. Indeed it is only used on
Windows for the dynamic way, when each unit is built as a separate DLL
(which we currently do not support). And even in that hypothetical
situation, the information that actually gets filled in is completely
bogus.
It _could_ be used in the windows dll case to correctly distinguish
making an out-of-line call to a cmm primop that is defined in the
current dll or in an external dll. But the information gets filled in in
the renaming phase with the _current_ unit. This is blatently wrong.
Many out-of-line primops are defined in the rts, which is obviously not
the current unit. It _could_ be a reasonable default, that cmm primops
are expected to be in the current dll, but we would have to have support
to specify a different location, i.e. the rts.
Furthermore, in addition to TargetIsInThisUnit being unused (after the
previous patch) it should never be used because it uses an implicit
"this" which will be wrong as soon as the information is inlined across
units. Instead of an implicit unit, it should use an explicit unit which
can be initialised to the defining unit and then be compared later to
the current unit. This will work correctly when looking at unfoldings
across unit boundaries.
- - - - -
3de1a8ae by Duncan Coutts at 2026-09-25T13:34:04+01:00
Rename CCallStaticTargetUnit to CLabelTargetLibrary
And the constructor TargetIsInThat to CLabelTargetInUnit.
We will end up using this type both for calls and for labels/addresses
(used in core literals), so adjust the name to be about C names/labels
rather than about calls specifically.
Also improve related code docs. And introduce a conversion function from
CLabelTargetLibrary to ForeignLabelSource. We will extend this
conversion when we add more constructors to CLabelTargetLibrary.
- - - - -
a00f28d1 by Duncan Coutts at 2026-09-25T13:34:04+01:00
Change data PrimOp to use a UnitId rather than Unit
This simplifies the conversions slightly, but more importantly in a
later change we are going to want to specify a unit where we will only
have a UnitId to hand, not a Unit.
- - - - -
07bf7fa3 by Duncan Coutts at 2026-09-29T11:38:16+01:00
Extend 'foreign import prim' syntax to allow specifying the source package
that is: the package where the cmm entity comes from.
The package name is stashed in the "header" field for the FFI call, and
then the renamer resolves the package name to a unit id (with a new
ghc error for the failure of the package name resolution).
Fixes issue #27206
Adds test case T27206
- - - - -
3d5e5e56 by Duncan Coutts at 2026-09-29T11:38:16+01:00
Use new package name syntax for primops from the RTS
foreign import prim "rts stg_thething"
Most uses of foreign import prim in the libraries are for primops
defined in .cmm files local to that library, but some import primops
defined in the rts. These cases should use the new syntax to specify the
package name in the ffi entity string.
- - - - -
26a5ed6d by Duncan Coutts at 2026-09-29T11:38:17+01:00
Extend ForeignLabelSource with ForeignLabelInUnknownPackage case
Initially this is treated the same way as ForeignLabelInExternalPackage.
Later we will extend this for Windows/PE to support building each
Haskell unit as a separate DLL, to support this unknown case
specifically.
- - - - -
f5261593 by Duncan Coutts at 2026-09-29T11:38:17+01:00
Extend CLabelTargetLibrary with CLabelTargetUnknown case
Initially unused, but this will become the typical case, because in fact
when Haskell code uses ffi imports, we do not know where the name comes
from: we do not know if the named entity is defined in the current
shared lib or in another one. Knowing where C entities come from is the
exception rather than the rule.
- - - - -
e216bc53 by Duncan Coutts at 2026-09-29T11:38:17+01:00
Extend LitLabel with CLabelTargetLibrary
Bundle the three fields of LitLabel into a new data CLabelSpec, defined
in GHC.Types.ForeignCall
Apart from the binary format, this should not change behaviour.
Behaviour changes are in the next patch
- - - - -
1c2891e2 by Duncan Coutts at 2026-09-29T11:38:17+01:00
Change FFI imports to use CLabelTargetUnknown
We never know the target for normal foreign imports.
Historically, this information was only actually used for
"foreign import prim", and only on Windows when building with one DLL
per unit (which bitrotted). The previous default of using the current
package as the source was wrong, even for the limited case of Windows
DLLs, because many of the imports are for primops defined in the RTS,
which is certainly not the current package.
- - - - -
1d64f750 by Duncan Coutts at 2026-09-29T11:38:17+01:00
Pass through the label source in stg->cmm conversion
Previously we had to hard code the (often incorrect) source
ForeignLabelInThisPackage. Now the Core label literal representation
carries the source, so we just convert that and pass it down.
As a consequence, if the source will now be either
ForeignLabelInUnknownPackage or ForeignLabelInPackage. The typical
value will be ForeignLabelInUnknownPackage, since that's what we get
for FFI imports of addresses.
In practice is not an immediate change of behaviour, because the only
user of this information is on Windows when building each Haskell unit
as a separate DLl, which isn't (yet) supported.
- - - - -
2ba26f14 by Duncan Coutts at 2026-09-29T11:38:17+01:00
Fix source for generated C name for 'foreign import "wrapper"'
For a 'foreign import "wrapper"' construct we generate a local wrapper
C function. We need to refer to the name of this local C function. We
_know_ that this function lives in the local shared lib, because it is
compiled into the same library. Thus we set the label source to be
CLabelTargetInUnit.
- - - - -
f117b62c by Duncan Coutts at 2026-09-29T11:38:17+01:00
Fix source for generated C name for 'foreign import capi'
For a 'foreign import capi' we generate a local wrapper function and
then call that. We need to refer to the name of this local C function.
We _know_ that this function lives in the local shared lib, because it
is compiled into the same library. Thus we set the label source to be
CLabelTargetInUnit.
- - - - -
c2958f0e by David Eichmann at 2026-09-29T11:38:17+01:00
Documentation: foreign imports of Cmm code may now specify source package
- - - - -
31 changed files:
- + changelog.d/foreign-import-prim-with-package.md
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/CmmToAsm/PIC.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Lit.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/StgToJS/Literal.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/Literal.hs
- docs/users_guide/exts/ffi.rst
- libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/Ext.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/Panic.hs
- + testsuite/tests/rename/should_fail/T27206.hs
- + testsuite/tests/rename/should_fail/T27206.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/simplCore/should_compile/T16122.stderr
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/55b7385bcaea94ef3ea68f5ce93400…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/55b7385bcaea94ef3ea68f5ce93400…
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