[Git][ghc/ghc] Pushed new branch wip/jeltsch/known-key-removals/lists
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
20 Dec '25
Wolfgang Jeltsch pushed new branch wip/jeltsch/known-key-removals/lists at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/jeltsch/known-key-removals/li…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
20 Dec '25
Cheng Shao pushed new branch wip/ghc-fix-bootstrap-9.14 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/ghc-fix-bootstrap-9.14
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/romes/25636] Almost there. Finally, we get a runtime loop
by Rodrigo Mesquita (@alt-romes) 20 Dec '25
by Rodrigo Mesquita (@alt-romes) 20 Dec '25
20 Dec '25
Rodrigo Mesquita pushed to branch wip/romes/25636 at Glasgow Haskell Compiler / GHC
Commits:
c20b043b by Rodrigo Mesquita at 2025-12-19T20:30:44+00:00
Almost there. Finally, we get a runtime loop
That's something better to investigate. No longer messing up the names and addr#
- - - - -
3 changed files:
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/StgToByteCode.hs
Changes:
=====================================
compiler/GHC/ByteCode/Asm.hs
=====================================
@@ -25,6 +25,7 @@ module GHC.ByteCode.Asm (
import GHC.Prelude hiding ( any, words )
+import Data.Maybe
import GHC.ByteCode.Instr
import GHC.ByteCode.InfoTable
import GHC.ByteCode.Types
@@ -41,6 +42,8 @@ import GHC.Unit.Types
import GHC.Utils.Outputable ( Outputable(..), text, (<+>), vcat )
import GHC.Utils.Panic
+import GHC.Builtin.Types.Prim ( addrPrimTy )
+import GHC.Core.TyCo.Compare ( eqType )
import GHC.Core.TyCon
import GHC.Data.SizedSeq
import GHC.Data.SmallArray
@@ -67,7 +70,6 @@ import Data.Array.Base ( unsafeWrite )
import Foreign hiding (shiftL, shiftR)
import Data.ByteString (ByteString)
import Data.Char (ord)
-import Data.Maybe (fromMaybe)
import GHC.Float (castFloatToWord32, castDoubleToWord64)
import qualified Data.List as List ( any )
@@ -211,12 +213,10 @@ assembleBCO :: Platform -> ProtoBCO -> IO UnlinkedBCO
assembleBCO platform
(ProtoStaticCon { protoStaticConName
, protoStaticCon = dc
- , protoStaticConLits = lits
- , protoStaticConIds = ids
+ , protoStaticConData = args
}) = do
- pprTraceM "assembleBCO: static con" (ppr dc <+> ppr lits <+> ppr ids)
- let ptrs = foldr mappendFlatBag emptyFlatBag (map idBCOArg ids)
- let nonptrs = foldr mappendFlatBag emptyFlatBag (map litBCOArg lits)
+ let ptrs = foldr mappendFlatBag emptyFlatBag (mapMaybe idBCOArg args)
+ let nonptrs = foldr mappendFlatBag emptyFlatBag (mapMaybe litBCOArg args)
pure UnlinkedStaticCon
{ unlinkedStaticConName = protoStaticConName
, unlinkedStaticConDataConName = dataConName dc
@@ -224,14 +224,24 @@ assembleBCO platform
, unlinkedStaticConPtrs = ptrs
}
where
- litBCOArg l = case literal platform l of
+ litBCOArg (Left l) = Just $ case literal platform l of
OnlyOne np -> unitFlatBag np
OnlyTwo np1 np2 -> TupleFlatBag np1 np2
- idBCOArg i
- | Just prim <- isPrimOpId_maybe i
- = unitFlatBag (BCOPtrPrimOp prim)
+ litBCOArg (Right var)
+ -- Addr# literals are non-pointers
+ | idType var `eqType` addrPrimTy
+ = Just $ unitFlatBag (BCONPtrAddr (getName var))
| otherwise
- = unitFlatBag (BCOPtrName (getName i))
+ = Nothing
+
+ idBCOArg (Left _) = Nothing
+ idBCOArg (Right var)
+ | idType var `eqType` addrPrimTy
+ = Nothing
+ | Just prim <- isPrimOpId_maybe var
+ = Just $ unitFlatBag (BCOPtrPrimOp prim)
+ | otherwise
+ = Just $ unitFlatBag (BCOPtrName (getName var))
assembleBCO platform
(ProtoBCO { protoBCOName = nm
=====================================
compiler/GHC/ByteCode/Instr.hs
=====================================
@@ -56,10 +56,14 @@ data ProtoBCO
-- ^ The name to which this static constructor is bound,
-- not to be confused with the DataCon itself.
protoStaticCon :: DataCon,
- protoStaticConLits :: [Literal],
- protoStaticConIds :: [Id],
- -- | What the static con came from, for debugging only
+ -- ^ The DataCon being constructed.
+ -- We use this to construct the right info table.
+ protoStaticConData :: [Either Literal Id],
+ -- ^ The static constructor pointer and non-pointer arguments, sorted
+ -- in the order they should appear at runtime (see 'mkVirtConstrOffsets').
+ -- The pointers always come first, followed by the non-pointers.
protoStaticConExpr :: CgStgRhs
+ -- ^ What the static con came from, for debugging only
}
-- | A local block label (e.g. identifying a case alternative).
@@ -293,11 +297,10 @@ data BCInstr
-- Printing bytecode instructions
instance Outputable ProtoBCO where
- ppr (ProtoStaticCon nm con lits ids origin)
+ ppr (ProtoStaticCon nm con args origin)
= text "ProtoStaticCon" <+> ppr nm <+> text "for constructor" <+> ppr con <> colon
$$ nest 3 (pprStgRhsShort shortStgPprOpts origin)
- $$ nest 3 (text "lits: " <+> ppr lits)
- $$ nest 3 (text "ids: " <+> ppr ids)
+ $$ nest 3 (text "sorted args: " <+> ppr args)
ppr (ProtoBCO { protoBCOName = name
, protoBCOInstrs = instrs
, protoBCOBitmap = bitmap
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -316,8 +316,9 @@ schemeTopBind (id, rhs@(StgRhsCon _ dc _ _ args _))
return ProtoStaticCon
{ protoStaticConName = getName id
, protoStaticCon = dc
- , protoStaticConLits = [ lit | (NonVoid (StgLitArg lit), _) <- args_offsets ]
- , protoStaticConIds = [ i | (NonVoid (StgVarArg i), _) <- args_offsets {-, assert is never a local var -} ]
+ , protoStaticConData = [ case a of StgLitArg l -> Left l
+ StgVarArg i -> Right i
+ | (NonVoid a, _) <- args_offsets ]
, protoStaticConExpr = rhs
}
schemeTopBind (id, rhs)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c20b043b6a006361c1744c6886ad0c9…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c20b043b6a006361c1744c6886ad0c9…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
20 Dec '25
Rodrigo Mesquita pushed to branch wip/romes/25636 at Glasgow Haskell Compiler / GHC
Commits:
9fa2c2c2 by Rodrigo Mesquita at 2025-12-19T20:14:41+00:00
Where we're at:
We're almost there, but just bumped into a sort of wall.
For bytecode objects, we allocate string literals which are never freed,
and when compiling the ByteCode which references theses string literals,
we PUSH_ADDR a NON-POINTER reference to the Addr# in the string literals
environment kept by the ghci linker.
I believe that these Addr are put in the non-pointers list of data of a
BCO (Rather than on the ptrs list of data) because we don't want them to
be GC-d. They are allocated by the linker and should not be touched by
the RTS.
The problem is that when constructing a static data con application, we
will find addresses and put them as part of the POINTERS fields of the
data application. Now, I expect that the info table NPTRS/PTRS
directives will expect the Addr# to be in the PTRS because it may be
collected by the GC as far as the data con is concerned.
this didn't come up before because we only ever constructed BCOs in
bytecode, never the constructors the directly. Soooooooo
I don't think I should be changing the order of Ids vs Lits after they
come in the proto static con ids. But perhaps it's fine? Perhaps I'm
writing them as Ids but really they should be moved to the literals once
I find them?
Yes, that could make sense.... So, check the actual info table to figure
out where things go
And try an example with lits and ptrs and see what comes first.
Yup. Turns out it's all fine. The Addr#s are non-pointers everywhere.
.data
.balign 8
.globl _X.x_closure
_X.x_closure:
.quad _X.K_con_info
.quad _stg_INTLIKE_closure+289
.quad _stg_CHARLIKE_closure+1953
.quad _stg_INTLIKE_closure+321
.quad 1
.quad _Lx2_ryD_bytes
.quad 3
That makes sense. They're top-level DATA. The collecting is only an
issue when we allocate them dynamically (GHCi). But we're already doing
that anyway.
- - - - -
7 changed files:
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Serialize.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/StgToByteCode.hs
Changes:
=====================================
compiler/GHC/ByteCode/Asm.hs
=====================================
@@ -95,13 +95,15 @@ bcoFreeNames bco
mkUniqDSet [ n | BCONPtrItbl n <- elemsFlatBag unlinkedBCOLits ] :
map bco_refs [ bco | BCOPtrBCO bco <- elemsFlatBag unlinkedBCOPtrs ]
) `uniqDSetMinusUniqSet` mkNameSet [unlinkedBCOName]
- bco_refs UnlinkedStaticCon{unlinkedStaticConName, unlinkedStaticConLits, unlinkedStaticConPtrs}
+ bco_refs UnlinkedStaticCon{ unlinkedStaticConName, unlinkedStaticConDataConName
+ , unlinkedStaticConLits, unlinkedStaticConPtrs }
= unionManyUniqDSets (
+ mkUniqDSet [ unlinkedStaticConDataConName ] :
mkUniqDSet [ n | BCOPtrName n <- elemsFlatBag unlinkedStaticConPtrs ] :
mkUniqDSet [ n | BCONPtrItbl n <- elemsFlatBag unlinkedStaticConLits ] :
map bco_refs [ bco | BCOPtrBCO bco <- elemsFlatBag unlinkedStaticConPtrs ]
)
- `uniqDSetMinusUniqSet` mkNameSet [unlinkedStaticConName]
+ `uniqDSetMinusUniqSet` mkNameSet [ unlinkedStaticConName ]
-- -----------------------------------------------------------------------------
-- The bytecode assembler
@@ -207,14 +209,17 @@ assembleInspectAsm p i = assembleI @InspectAsm p i
assembleBCO :: Platform -> ProtoBCO -> IO UnlinkedBCO
assembleBCO platform
- (ProtoStaticCon { protoStaticCon = dc
+ (ProtoStaticCon { protoStaticConName
+ , protoStaticCon = dc
, protoStaticConLits = lits
, protoStaticConIds = ids
}) = do
+ pprTraceM "assembleBCO: static con" (ppr dc <+> ppr lits <+> ppr ids)
let ptrs = foldr mappendFlatBag emptyFlatBag (map idBCOArg ids)
let nonptrs = foldr mappendFlatBag emptyFlatBag (map litBCOArg lits)
pure UnlinkedStaticCon
- { unlinkedStaticConName = dataConName dc
+ { unlinkedStaticConName = protoStaticConName
+ , unlinkedStaticConDataConName = dataConName dc
, unlinkedStaticConLits = nonptrs
, unlinkedStaticConPtrs = ptrs
}
=====================================
compiler/GHC/ByteCode/Instr.hs
=====================================
@@ -52,6 +52,9 @@ data ProtoBCO
-- | A top-level static constructor application object
-- See Note [Static constructors in Bytecode]
| ProtoStaticCon {
+ protoStaticConName :: Name,
+ -- ^ The name to which this static constructor is bound,
+ -- not to be confused with the DataCon itself.
protoStaticCon :: DataCon,
protoStaticConLits :: [Literal],
protoStaticConIds :: [Id],
@@ -290,8 +293,8 @@ data BCInstr
-- Printing bytecode instructions
instance Outputable ProtoBCO where
- ppr (ProtoStaticCon con lits ids origin)
- = text "ProtoStaticCon" <+> ppr con <> colon
+ ppr (ProtoStaticCon nm con lits ids origin)
+ = text "ProtoStaticCon" <+> ppr nm <+> text "for constructor" <+> ppr con <> colon
$$ nest 3 (pprStgRhsShort shortStgPprOpts origin)
$$ nest 3 (text "lits: " <+> ppr lits)
$$ nest 3 (text "ids: " <+> ppr ids)
@@ -486,7 +489,8 @@ instance Outputable BCInstr where
-- stack high water mark, but it doesn't seem worth the hassle.
protoBCOStackUse :: ProtoBCO -> Word
-protoBCOStackUse bco = sum (map bciStackUse (protoBCOInstrs bco))
+protoBCOStackUse ProtoBCO{protoBCOInstrs} = sum (map bciStackUse protoBCOInstrs)
+protoBCOStackUse ProtoStaticCon{} = 0
bciStackUse :: BCInstr -> Word
bciStackUse STKCHECK{} = 0
=====================================
compiler/GHC/ByteCode/Linker.hs
=====================================
@@ -80,9 +80,13 @@ linkBCO interp pkgs_loaded bytecode_state bco_ix unl_bco = do
{ unlinkedStaticConLits = lits0
, unlinkedStaticConPtrs = ptrs0
} -> do
- Ptr itbl_ptr# <- lookupIE interp pkgs_loaded bytecode_state (unlinkedStaticConName unl_bco)
+ pprTraceM "linkBCO: linking static constructor" (ppr unl_bco)
+ Ptr itbl_ptr# <- lookupIE interp pkgs_loaded bytecode_state (unlinkedStaticConDataConName unl_bco)
+ pprTraceM "linkBCO: itbl_ptr#" (ppr (unlinkedStaticConDataConName unl_bco) <+> text (show (Ptr itbl_ptr#)))
lits <- doLits lits0
+ pprTraceM "linkBCO: lits done" (empty)
ptrs <- doPtrs ptrs0
+ pprTraceM "linkBCO: ptrs done" (empty)
return ResolvedStaticCon
{ resolvedBCOIsLE = isLittleEndian
, resolvedStaticConInfoPtr = W# (int2Word# (addr2Int# itbl_ptr#))
@@ -99,7 +103,7 @@ linkBCO interp pkgs_loaded bytecode_state bco_ix unl_bco = do
mapM (resolvePtr interp pkgs_loaded bytecode_state bco_ix) (elemsFlatBag ptrs0)
lookupLiteral :: Interp -> PkgsLoaded -> BytecodeLoaderState -> BCONPtr -> IO Word
-lookupLiteral interp pkgs_loaded bytecode_state ptr = case ptr of
+lookupLiteral interp pkgs_loaded bytecode_state ptr = pprTrace "lookupLiteral" (ppr ptr) $ case ptr of
BCONPtrWord lit -> return lit
BCONPtrLbl sym -> do
Ptr a# <- lookupStaticPtr interp sym
@@ -183,20 +187,24 @@ resolvePtr
-> NameEnv (Int, Bool)
-> BCOPtr
-> IO ResolvedBCOPtr
-resolvePtr interp pkgs_loaded bco_loader_state bco_ix ptr = case ptr of
+resolvePtr interp pkgs_loaded bco_loader_state bco_ix ptr = pprTrace "resolvePtr" (ppr ptr) $ case ptr of
BCOPtrName nm
| Just (ix, b) <- lookupNameEnv bco_ix nm
- -> if b then
+ -> if b then do
+ pprTraceM "resolvePtr: ResolvedBCORef" (ppr nm <+> ppr ix)
return (ResolvedBCORef ix) -- ref to another BCO in this group
- else
+ else do
+ pprTraceM "resolvePtr: StaticConRef" (ppr nm <+> ppr ix)
return (ResolvedStaticConRef ix) -- ref to another StaticCon in this group
| Just (_, rhv) <- lookupNameBytecodeState bco_loader_state nm
- -> return (ResolvedBCOPtr (unsafeForeignRefToRemoteRef rhv))
+ -> do
+ pprTraceM "resolvePtr: BCOPtr" (ppr nm)
+ return (ResolvedBCOPtr (unsafeForeignRefToRemoteRef rhv))
| otherwise
-> assertPpr (isExternalName nm) (ppr nm) $
- do
+ pprTrace "resolvePtr: OTHERWISE? ASSERTION FIALURE?" (ppr nm) $ do
let sym_to_find = IClosureSymbol nm
m <- lookupHsSymbol interp pkgs_loaded sym_to_find
case m of
=====================================
compiler/GHC/ByteCode/Serialize.hs
=====================================
@@ -327,6 +327,7 @@ instance Binary UnlinkedBCO where
<*> get bh
1 -> UnlinkedStaticCon
<$> getViaBinName bh
+ <*> getViaBinName bh
<*> get bh
<*> get bh
_ -> panic "Binary UnlinkedBCO: invalid byte"
@@ -342,6 +343,7 @@ instance Binary UnlinkedBCO where
put_ bh UnlinkedStaticCon {..} = do
putByte bh 1
putViaBinName bh unlinkedStaticConName
+ putViaBinName bh unlinkedStaticConDataConName
put_ bh unlinkedStaticConLits
put_ bh unlinkedStaticConPtrs
=====================================
compiler/GHC/ByteCode/Types.hs
=====================================
@@ -31,6 +31,7 @@ module GHC.ByteCode.Types
) where
import GHC.Prelude
+import qualified Data.ByteString.Char8 as BS8
import GHC.Data.FastString
import GHC.Data.FlatBag
@@ -259,6 +260,10 @@ data UnlinkedBCO
-- See Note [Static constructors in Bytecode]
| UnlinkedStaticCon {
unlinkedStaticConName :: !Name,
+ -- ^ The name to which this static constructor is bound, not to be
+ -- confused with the name of the static constructor itself
+ -- ('unlinkedStaticConDataConName')
+ unlinkedStaticConDataConName :: !Name,
unlinkedStaticConLits :: !(FlatBag BCONPtr), -- non-ptrs
unlinkedStaticConPtrs :: !(FlatBag BCOPtr) -- ptrs
}
@@ -282,6 +287,12 @@ instance NFData BCOPtr where
rnf (BCOPtrBCO bco) = rnf bco
rnf x = x `seq` ()
+instance Outputable BCOPtr where
+ ppr (BCOPtrName nm) = text "BCOPtrName" <+> ppr nm
+ ppr (BCOPtrPrimOp op) = text "BCOPtrPrimOp" <+> ppr op
+ ppr (BCOPtrBCO bco) = text "BCOPtrBCO" <+> ppr bco
+ ppr (BCOPtrBreakArray mod) = text "<break array for" <+> ppr mod <> char '>'
+
data BCONPtr
= BCONPtrWord {-# UNPACK #-} !Word
| BCONPtrLbl !FastString
@@ -299,6 +310,16 @@ data BCONPtr
-- | A 'CostCentre' remote pointer array's respective 'BreakpointId'
| BCONPtrCostCentre !InternalBreakpointId
+instance Outputable BCONPtr where
+ ppr (BCONPtrWord w) = integer (fromIntegral w)
+ ppr (BCONPtrLbl lbl) = text "<label:" <> ftext lbl <> char '>'
+ ppr (BCONPtrItbl nm) = text "<itbl:" <+> ppr nm <> char '>'
+ ppr (BCONPtrAddr nm) = text "<addr:" <+> ppr nm <> char '>'
+ ppr (BCONPtrStr bs) = text "<string literal: " <+> text (BS8.unpack bs) <> char '>'
+ ppr (BCONPtrFS fs) = text "<fast string literal:" <+> ftext fs <> char '>'
+ ppr (BCONPtrFFIInfo ffi) = text "<FFIInfo>"
+ ppr (BCONPtrCostCentre bid) = text "<CostCentre for BreakpointId:" <+> ppr bid <> char '>'
+
instance NFData BCONPtr where
rnf x = x `seq` ()
@@ -307,8 +328,9 @@ instance Outputable UnlinkedBCO where
= sep [text "BCO", ppr nm, text "with",
ppr (sizeFlatBag lits), text "lits",
ppr (sizeFlatBag ptrs), text "ptrs" ]
- ppr (UnlinkedStaticCon nm lits ptrs)
- = sep [text "StaticCon", ppr nm, text "with",
+ ppr (UnlinkedStaticCon nm dc_nm lits ptrs)
+ = sep [text "StaticCon", ppr nm, text "for",
+ ppr dc_nm, text "with",
ppr (sizeFlatBag lits), text "lits",
ppr (sizeFlatBag ptrs), text "ptrs" ]
=====================================
compiler/GHC/Linker/Loader.hs
=====================================
@@ -1048,6 +1048,13 @@ linkSomeBCOs interp pkgs_loaded bytecode_state mods = foldr fun do_link mods []
UnlinkedStaticCon{unlinkedStaticConName} -> (unlinkedStaticConName, False)
) flat
bco_ix = mkNameEnv (zipWith (\(n,isBCO) ix -> (n,(ix, isBCO))) names [0..])
+ pprTraceM "linkSomeBCOs what" $ (ppr mods <+> ppr flat)
+ pprTraceM "linkSomeBCOs" $
+ vcat [ text "Linking BCOs:"
+ , nest 2 (vcat (map (ppr . fst) names))
+ , text "BCO index:"
+ , nest 2 (ppr bco_ix)
+ ]
resolved <- sequence [ linkBCO interp pkgs_loaded bytecode_state bco_ix bco | bco <- flat ]
hvrefs <- createBCOs interp resolved
return (zipWith (\(n,_) hvr -> (n, hvr)) names hvrefs)
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -305,15 +305,17 @@ argBits platform (rep : args)
-- Compile code for the right-hand side of a top-level binding
schemeTopBind :: (Id, CgStgRhs) -> BcM ProtoBCO
-schemeTopBind (_, rhs@(StgRhsCon _ dc _ _ args _))
+schemeTopBind (id, rhs@(StgRhsCon _ dc _ _ args _))
= do
+ pprTraceM "schemeTopBind: static con" (ppr id <+> ppr dc <+> ppr args)
profile <- getProfile
let non_voids = addArgReps (assertNonVoidStgArgs args)
(_, _, args_offsets)
-- Compute the expected runtime ordering for the datacon fields
= mkVirtConstrOffsets profile non_voids
return ProtoStaticCon
- { protoStaticCon = dc
+ { protoStaticConName = getName id
+ , protoStaticCon = dc
, protoStaticConLits = [ lit | (NonVoid (StgLitArg lit), _) <- args_offsets ]
, protoStaticConIds = [ i | (NonVoid (StgVarArg i), _) <- args_offsets {-, assert is never a local var -} ]
, protoStaticConExpr = rhs
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9fa2c2c2a4ea3a0102dd6edcc4d9041…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9fa2c2c2a4ea3a0102dd6edcc4d9041…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
20 Dec '25
Rodrigo Mesquita pushed to branch wip/romes/25636 at Glasgow Haskell Compiler / GHC
Commits:
696e1f80 by Rodrigo Mesquita at 2025-12-19T20:05:07+00:00
Where we're at:
We're almost there, but just bumped into a sort of wall.
For bytecode objects, we allocate string literals which are never freed,
and when compiling the ByteCode which references theses string literals,
we PUSH_ADDR a NON-POINTER reference to the Addr# in the string literals
environment kept by the ghci linker.
I believe that these Addr are put in the non-pointers list of data of a
BCO (Rather than on the ptrs list of data) because we don't want them to
be GC-d. They are allocated by the linker and should not be touched by
the RTS.
The problem is that when constructing a static data con application, we
will find addresses and put them as part of the POINTERS fields of the
data application. Now, I expect that the info table NPTRS/PTRS
directives will expect the Addr# to be in the PTRS because it may be
collected by the GC as far as the data con is concerned.
this didn't come up before because we only ever constructed BCOs in
bytecode, never the constructors the directly. Soooooooo
I don't think I should be changing the order of Ids vs Lits after they
come in the proto static con ids. But perhaps it's fine? Perhaps I'm
writing them as Ids but really they should be moved to the literals once
I find them?
Yes, that could make sense.... So, check the actual info table to figure
out where things go
And try an example with lits and ptrs and see what comes first.
- - - - -
7 changed files:
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Serialize.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/StgToByteCode.hs
Changes:
=====================================
compiler/GHC/ByteCode/Asm.hs
=====================================
@@ -95,13 +95,15 @@ bcoFreeNames bco
mkUniqDSet [ n | BCONPtrItbl n <- elemsFlatBag unlinkedBCOLits ] :
map bco_refs [ bco | BCOPtrBCO bco <- elemsFlatBag unlinkedBCOPtrs ]
) `uniqDSetMinusUniqSet` mkNameSet [unlinkedBCOName]
- bco_refs UnlinkedStaticCon{unlinkedStaticConName, unlinkedStaticConLits, unlinkedStaticConPtrs}
+ bco_refs UnlinkedStaticCon{ unlinkedStaticConName, unlinkedStaticConDataConName
+ , unlinkedStaticConLits, unlinkedStaticConPtrs }
= unionManyUniqDSets (
+ mkUniqDSet [ unlinkedStaticConDataConName ] :
mkUniqDSet [ n | BCOPtrName n <- elemsFlatBag unlinkedStaticConPtrs ] :
mkUniqDSet [ n | BCONPtrItbl n <- elemsFlatBag unlinkedStaticConLits ] :
map bco_refs [ bco | BCOPtrBCO bco <- elemsFlatBag unlinkedStaticConPtrs ]
)
- `uniqDSetMinusUniqSet` mkNameSet [unlinkedStaticConName]
+ `uniqDSetMinusUniqSet` mkNameSet [ unlinkedStaticConName ]
-- -----------------------------------------------------------------------------
-- The bytecode assembler
@@ -207,14 +209,17 @@ assembleInspectAsm p i = assembleI @InspectAsm p i
assembleBCO :: Platform -> ProtoBCO -> IO UnlinkedBCO
assembleBCO platform
- (ProtoStaticCon { protoStaticCon = dc
+ (ProtoStaticCon { protoStaticConName
+ , protoStaticCon = dc
, protoStaticConLits = lits
, protoStaticConIds = ids
}) = do
+ pprTraceM "assembleBCO: static con" (ppr dc <+> ppr lits <+> ppr ids)
let ptrs = foldr mappendFlatBag emptyFlatBag (map idBCOArg ids)
let nonptrs = foldr mappendFlatBag emptyFlatBag (map litBCOArg lits)
pure UnlinkedStaticCon
- { unlinkedStaticConName = dataConName dc
+ { unlinkedStaticConName = protoStaticConName
+ , unlinkedStaticConDataConName = dataConName dc
, unlinkedStaticConLits = nonptrs
, unlinkedStaticConPtrs = ptrs
}
=====================================
compiler/GHC/ByteCode/Instr.hs
=====================================
@@ -52,6 +52,9 @@ data ProtoBCO
-- | A top-level static constructor application object
-- See Note [Static constructors in Bytecode]
| ProtoStaticCon {
+ protoStaticConName :: Name,
+ -- ^ The name to which this static constructor is bound,
+ -- not to be confused with the DataCon itself.
protoStaticCon :: DataCon,
protoStaticConLits :: [Literal],
protoStaticConIds :: [Id],
@@ -290,8 +293,8 @@ data BCInstr
-- Printing bytecode instructions
instance Outputable ProtoBCO where
- ppr (ProtoStaticCon con lits ids origin)
- = text "ProtoStaticCon" <+> ppr con <> colon
+ ppr (ProtoStaticCon nm con lits ids origin)
+ = text "ProtoStaticCon" <+> ppr nm <+> text "for constructor" <+> ppr con <> colon
$$ nest 3 (pprStgRhsShort shortStgPprOpts origin)
$$ nest 3 (text "lits: " <+> ppr lits)
$$ nest 3 (text "ids: " <+> ppr ids)
@@ -486,7 +489,8 @@ instance Outputable BCInstr where
-- stack high water mark, but it doesn't seem worth the hassle.
protoBCOStackUse :: ProtoBCO -> Word
-protoBCOStackUse bco = sum (map bciStackUse (protoBCOInstrs bco))
+protoBCOStackUse ProtoBCO{protoBCOInstrs} = sum (map bciStackUse protoBCOInstrs)
+protoBCOStackUse ProtoStaticCon{} = 0
bciStackUse :: BCInstr -> Word
bciStackUse STKCHECK{} = 0
=====================================
compiler/GHC/ByteCode/Linker.hs
=====================================
@@ -80,9 +80,13 @@ linkBCO interp pkgs_loaded bytecode_state bco_ix unl_bco = do
{ unlinkedStaticConLits = lits0
, unlinkedStaticConPtrs = ptrs0
} -> do
- Ptr itbl_ptr# <- lookupIE interp pkgs_loaded bytecode_state (unlinkedStaticConName unl_bco)
+ pprTraceM "linkBCO: linking static constructor" (ppr unl_bco)
+ Ptr itbl_ptr# <- lookupIE interp pkgs_loaded bytecode_state (unlinkedStaticConDataConName unl_bco)
+ pprTraceM "linkBCO: itbl_ptr#" (ppr (unlinkedStaticConDataConName unl_bco) <+> text (show (Ptr itbl_ptr#)))
lits <- doLits lits0
+ pprTraceM "linkBCO: lits done" (empty)
ptrs <- doPtrs ptrs0
+ pprTraceM "linkBCO: ptrs done" (empty)
return ResolvedStaticCon
{ resolvedBCOIsLE = isLittleEndian
, resolvedStaticConInfoPtr = W# (int2Word# (addr2Int# itbl_ptr#))
@@ -99,7 +103,7 @@ linkBCO interp pkgs_loaded bytecode_state bco_ix unl_bco = do
mapM (resolvePtr interp pkgs_loaded bytecode_state bco_ix) (elemsFlatBag ptrs0)
lookupLiteral :: Interp -> PkgsLoaded -> BytecodeLoaderState -> BCONPtr -> IO Word
-lookupLiteral interp pkgs_loaded bytecode_state ptr = case ptr of
+lookupLiteral interp pkgs_loaded bytecode_state ptr = pprTrace "lookupLiteral" (ppr ptr) $ case ptr of
BCONPtrWord lit -> return lit
BCONPtrLbl sym -> do
Ptr a# <- lookupStaticPtr interp sym
@@ -183,20 +187,24 @@ resolvePtr
-> NameEnv (Int, Bool)
-> BCOPtr
-> IO ResolvedBCOPtr
-resolvePtr interp pkgs_loaded bco_loader_state bco_ix ptr = case ptr of
+resolvePtr interp pkgs_loaded bco_loader_state bco_ix ptr = pprTrace "resolvePtr" (ppr ptr) $ case ptr of
BCOPtrName nm
| Just (ix, b) <- lookupNameEnv bco_ix nm
- -> if b then
+ -> if b then do
+ pprTraceM "resolvePtr: ResolvedBCORef" (ppr nm <+> ppr ix)
return (ResolvedBCORef ix) -- ref to another BCO in this group
- else
+ else do
+ pprTraceM "resolvePtr: StaticConRef" (ppr nm <+> ppr ix)
return (ResolvedStaticConRef ix) -- ref to another StaticCon in this group
| Just (_, rhv) <- lookupNameBytecodeState bco_loader_state nm
- -> return (ResolvedBCOPtr (unsafeForeignRefToRemoteRef rhv))
+ -> do
+ pprTraceM "resolvePtr: BCOPtr" (ppr nm)
+ return (ResolvedBCOPtr (unsafeForeignRefToRemoteRef rhv))
| otherwise
-> assertPpr (isExternalName nm) (ppr nm) $
- do
+ pprTrace "resolvePtr: OTHERWISE? ASSERTION FIALURE?" (ppr nm) $ do
let sym_to_find = IClosureSymbol nm
m <- lookupHsSymbol interp pkgs_loaded sym_to_find
case m of
=====================================
compiler/GHC/ByteCode/Serialize.hs
=====================================
@@ -327,6 +327,7 @@ instance Binary UnlinkedBCO where
<*> get bh
1 -> UnlinkedStaticCon
<$> getViaBinName bh
+ <*> getViaBinName bh
<*> get bh
<*> get bh
_ -> panic "Binary UnlinkedBCO: invalid byte"
@@ -342,6 +343,7 @@ instance Binary UnlinkedBCO where
put_ bh UnlinkedStaticCon {..} = do
putByte bh 1
putViaBinName bh unlinkedStaticConName
+ putViaBinName bh unlinkedStaticConDataConName
put_ bh unlinkedStaticConLits
put_ bh unlinkedStaticConPtrs
=====================================
compiler/GHC/ByteCode/Types.hs
=====================================
@@ -31,6 +31,7 @@ module GHC.ByteCode.Types
) where
import GHC.Prelude
+import qualified Data.ByteString.Char8 as BS8
import GHC.Data.FastString
import GHC.Data.FlatBag
@@ -259,6 +260,10 @@ data UnlinkedBCO
-- See Note [Static constructors in Bytecode]
| UnlinkedStaticCon {
unlinkedStaticConName :: !Name,
+ -- ^ The name to which this static constructor is bound, not to be
+ -- confused with the name of the static constructor itself
+ -- ('unlinkedStaticConDataConName')
+ unlinkedStaticConDataConName :: !Name,
unlinkedStaticConLits :: !(FlatBag BCONPtr), -- non-ptrs
unlinkedStaticConPtrs :: !(FlatBag BCOPtr) -- ptrs
}
@@ -282,6 +287,12 @@ instance NFData BCOPtr where
rnf (BCOPtrBCO bco) = rnf bco
rnf x = x `seq` ()
+instance Outputable BCOPtr where
+ ppr (BCOPtrName nm) = text "BCOPtrName" <+> ppr nm
+ ppr (BCOPtrPrimOp op) = text "BCOPtrPrimOp" <+> ppr op
+ ppr (BCOPtrBCO bco) = text "BCOPtrBCO" <+> ppr bco
+ ppr (BCOPtrBreakArray mod) = text "<break array for" <+> ppr mod <> char '>'
+
data BCONPtr
= BCONPtrWord {-# UNPACK #-} !Word
| BCONPtrLbl !FastString
@@ -299,6 +310,16 @@ data BCONPtr
-- | A 'CostCentre' remote pointer array's respective 'BreakpointId'
| BCONPtrCostCentre !InternalBreakpointId
+instance Outputable BCONPtr where
+ ppr (BCONPtrWord w) = integer (fromIntegral w)
+ ppr (BCONPtrLbl lbl) = text "<label:" <> ftext lbl <> char '>'
+ ppr (BCONPtrItbl nm) = text "<itbl:" <+> ppr nm <> char '>'
+ ppr (BCONPtrAddr nm) = text "<addr:" <+> ppr nm <> char '>'
+ ppr (BCONPtrStr bs) = text "<string literal: " <+> text (BS8.unpack bs) <> char '>'
+ ppr (BCONPtrFS fs) = text "<fast string literal:" <+> ftext fs <> char '>'
+ ppr (BCONPtrFFIInfo ffi) = text "<FFIInfo>"
+ ppr (BCONPtrCostCentre bid) = text "<CostCentre for BreakpointId:" <+> ppr bid <> char '>'
+
instance NFData BCONPtr where
rnf x = x `seq` ()
@@ -307,8 +328,9 @@ instance Outputable UnlinkedBCO where
= sep [text "BCO", ppr nm, text "with",
ppr (sizeFlatBag lits), text "lits",
ppr (sizeFlatBag ptrs), text "ptrs" ]
- ppr (UnlinkedStaticCon nm lits ptrs)
- = sep [text "StaticCon", ppr nm, text "with",
+ ppr (UnlinkedStaticCon nm dc_nm lits ptrs)
+ = sep [text "StaticCon", ppr nm, text "for",
+ ppr dc_nm, text "with",
ppr (sizeFlatBag lits), text "lits",
ppr (sizeFlatBag ptrs), text "ptrs" ]
=====================================
compiler/GHC/Linker/Loader.hs
=====================================
@@ -1048,6 +1048,13 @@ linkSomeBCOs interp pkgs_loaded bytecode_state mods = foldr fun do_link mods []
UnlinkedStaticCon{unlinkedStaticConName} -> (unlinkedStaticConName, False)
) flat
bco_ix = mkNameEnv (zipWith (\(n,isBCO) ix -> (n,(ix, isBCO))) names [0..])
+ pprTraceM "linkSomeBCOs what" $ (ppr mods <+> ppr flat)
+ pprTraceM "linkSomeBCOs" $
+ vcat [ text "Linking BCOs:"
+ , nest 2 (vcat (map (ppr . fst) names))
+ , text "BCO index:"
+ , nest 2 (ppr bco_ix)
+ ]
resolved <- sequence [ linkBCO interp pkgs_loaded bytecode_state bco_ix bco | bco <- flat ]
hvrefs <- createBCOs interp resolved
return (zipWith (\(n,_) hvr -> (n, hvr)) names hvrefs)
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -305,15 +305,17 @@ argBits platform (rep : args)
-- Compile code for the right-hand side of a top-level binding
schemeTopBind :: (Id, CgStgRhs) -> BcM ProtoBCO
-schemeTopBind (_, rhs@(StgRhsCon _ dc _ _ args _))
+schemeTopBind (id, rhs@(StgRhsCon _ dc _ _ args _))
= do
+ pprTraceM "schemeTopBind: static con" (ppr id <+> ppr dc <+> ppr args)
profile <- getProfile
let non_voids = addArgReps (assertNonVoidStgArgs args)
(_, _, args_offsets)
-- Compute the expected runtime ordering for the datacon fields
= mkVirtConstrOffsets profile non_voids
return ProtoStaticCon
- { protoStaticCon = dc
+ { protoStaticConName = getName id
+ , protoStaticCon = dc
, protoStaticConLits = [ lit | (NonVoid (StgLitArg lit), _) <- args_offsets ]
, protoStaticConIds = [ i | (NonVoid (StgVarArg i), _) <- args_offsets {-, assert is never a local var -} ]
, protoStaticConExpr = rhs
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/696e1f80937517e3076899c25b2b945…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/696e1f80937517e3076899c25b2b945…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/jeltsch/known-key-removals/type-representations] Remove unused known keys and names for type representations
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
20 Dec '25
Wolfgang Jeltsch pushed to branch wip/jeltsch/known-key-removals/type-representations at Glasgow Haskell Compiler / GHC
Commits:
20fa04e2 by Wolfgang Jeltsch at 2025-12-19T21:19:06+02:00
Remove unused known keys and names for type representations
This removes the known-key and corresponding name variables for
`TrName`, `TrNameD`, `TypeRep`, `KindRepTypeLitD`, `TypeLitSort`, and
`mkTrType`, as they are apparently nowhere used in GHC’s source code.
- - - - -
1 changed file:
- compiler/GHC/Builtin/Names.hs
Changes:
=====================================
compiler/GHC/Builtin/Names.hs
=====================================
@@ -222,12 +222,11 @@ basicKnownKeyNames
-- Type representation types
trModuleTyConName, trModuleDataConName,
- trNameTyConName, trNameSDataConName, trNameDDataConName,
+ trNameSDataConName,
trTyConTyConName, trTyConDataConName,
-- Typeable
typeableClassName,
- typeRepTyConName,
someTypeRepTyConName,
someTypeRepDataConName,
kindRepTyConName,
@@ -237,13 +236,10 @@ basicKnownKeyNames
kindRepFunDataConName,
kindRepTYPEDataConName,
kindRepTypeLitSDataConName,
- kindRepTypeLitDDataConName,
- typeLitSortTyConName,
typeLitSymbolDataConName,
typeLitNatDataConName,
typeLitCharDataConName,
typeRepIdName,
- mkTrTypeName,
mkTrConName,
mkTrAppCheckedName,
mkTrFunName,
@@ -1307,17 +1303,13 @@ ixClassName = clsQual gHC_INTERNAL_IX (fsLit "Ix") ixClassKey
-- Typeable representation types
trModuleTyConName
, trModuleDataConName
- , trNameTyConName
, trNameSDataConName
- , trNameDDataConName
, trTyConTyConName
, trTyConDataConName
:: Name
trModuleTyConName = tcQual gHC_TYPES (fsLit "Module") trModuleTyConKey
trModuleDataConName = dcQual gHC_TYPES (fsLit "Module") trModuleDataConKey
-trNameTyConName = tcQual gHC_TYPES (fsLit "TrName") trNameTyConKey
trNameSDataConName = dcQual gHC_TYPES (fsLit "TrNameS") trNameSDataConKey
-trNameDDataConName = dcQual gHC_TYPES (fsLit "TrNameD") trNameDDataConKey
trTyConTyConName = tcQual gHC_TYPES (fsLit "TyCon") trTyConTyConKey
trTyConDataConName = dcQual gHC_TYPES (fsLit "TyCon") trTyConDataConKey
@@ -1328,7 +1320,6 @@ kindRepTyConName
, kindRepFunDataConName
, kindRepTYPEDataConName
, kindRepTypeLitSDataConName
- , kindRepTypeLitDDataConName
:: Name
kindRepTyConName = tcQual gHC_TYPES (fsLit "KindRep") kindRepTyConKey
kindRepTyConAppDataConName = dcQual gHC_TYPES (fsLit "KindRepTyConApp") kindRepTyConAppDataConKey
@@ -1337,24 +1328,19 @@ kindRepAppDataConName = dcQual gHC_TYPES (fsLit "KindRepApp") kindR
kindRepFunDataConName = dcQual gHC_TYPES (fsLit "KindRepFun") kindRepFunDataConKey
kindRepTYPEDataConName = dcQual gHC_TYPES (fsLit "KindRepTYPE") kindRepTYPEDataConKey
kindRepTypeLitSDataConName = dcQual gHC_TYPES (fsLit "KindRepTypeLitS") kindRepTypeLitSDataConKey
-kindRepTypeLitDDataConName = dcQual gHC_TYPES (fsLit "KindRepTypeLitD") kindRepTypeLitDDataConKey
-typeLitSortTyConName
- , typeLitSymbolDataConName
+typeLitSymbolDataConName
, typeLitNatDataConName
, typeLitCharDataConName
:: Name
-typeLitSortTyConName = tcQual gHC_TYPES (fsLit "TypeLitSort") typeLitSortTyConKey
typeLitSymbolDataConName = dcQual gHC_TYPES (fsLit "TypeLitSymbol") typeLitSymbolDataConKey
typeLitNatDataConName = dcQual gHC_TYPES (fsLit "TypeLitNat") typeLitNatDataConKey
typeLitCharDataConName = dcQual gHC_TYPES (fsLit "TypeLitChar") typeLitCharDataConKey
-- Class Typeable, and functions for constructing `Typeable` dictionaries
typeableClassName
- , typeRepTyConName
, someTypeRepTyConName
, someTypeRepDataConName
- , mkTrTypeName
, mkTrConName
, mkTrAppCheckedName
, mkTrFunName
@@ -1365,11 +1351,9 @@ typeableClassName
, trGhcPrimModuleName
:: Name
typeableClassName = clsQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "Typeable") typeableClassKey
-typeRepTyConName = tcQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "TypeRep") typeRepTyConKey
someTypeRepTyConName = tcQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "SomeTypeRep") someTypeRepTyConKey
someTypeRepDataConName = dcQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "SomeTypeRep") someTypeRepDataConKey
typeRepIdName = varQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "typeRep#") typeRepIdKey
-mkTrTypeName = varQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "mkTrType") mkTrTypeKey
mkTrConName = varQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "mkTrCon") mkTrConKey
mkTrAppCheckedName = varQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "mkTrAppChecked") mkTrAppCheckedKey
mkTrFunName = varQual gHC_INTERNAL_TYPEABLE_INTERNAL (fsLit "mkTrFun") mkTrFunKey
@@ -1940,13 +1924,11 @@ pluginTyConKey, frontendPluginTyConKey :: Unique
pluginTyConKey = mkPreludeTyConUnique 102
frontendPluginTyConKey = mkPreludeTyConUnique 103
-trTyConTyConKey, trModuleTyConKey, trNameTyConKey,
- kindRepTyConKey, typeLitSortTyConKey :: Unique
+trTyConTyConKey, trModuleTyConKey,
+ kindRepTyConKey :: Unique
trTyConTyConKey = mkPreludeTyConUnique 104
trModuleTyConKey = mkPreludeTyConUnique 105
-trNameTyConKey = mkPreludeTyConUnique 106
kindRepTyConKey = mkPreludeTyConUnique 107
-typeLitSortTyConKey = mkPreludeTyConUnique 108
-- Generics (Unique keys)
v1TyConKey, u1TyConKey, par1TyConKey, rec1TyConKey,
@@ -2026,8 +2008,7 @@ callStackTyConKey :: Unique
callStackTyConKey = mkPreludeTyConUnique 191
-- Typeables
-typeRepTyConKey, someTypeRepTyConKey, someTypeRepDataConKey :: Unique
-typeRepTyConKey = mkPreludeTyConUnique 192
+someTypeRepTyConKey, someTypeRepDataConKey :: Unique
someTypeRepTyConKey = mkPreludeTyConUnique 193
someTypeRepDataConKey = mkPreludeTyConUnique 194
@@ -2166,12 +2147,11 @@ srcLocDataConKey :: Unique
srcLocDataConKey = mkPreludeDataConUnique 37
trTyConDataConKey, trModuleDataConKey,
- trNameSDataConKey, trNameDDataConKey,
+ trNameSDataConKey,
trGhcPrimModuleKey :: Unique
trTyConDataConKey = mkPreludeDataConUnique 41
trModuleDataConKey = mkPreludeDataConUnique 43
trNameSDataConKey = mkPreludeDataConUnique 45
-trNameDDataConKey = mkPreludeDataConUnique 46
trGhcPrimModuleKey = mkPreludeDataConUnique 47
typeErrorTextDataConKey,
@@ -2246,7 +2226,7 @@ vecElemDataConKeys = map mkPreludeDataConUnique [96..105]
-- Typeable things
kindRepTyConAppDataConKey, kindRepVarDataConKey, kindRepAppDataConKey,
kindRepFunDataConKey, kindRepTYPEDataConKey,
- kindRepTypeLitSDataConKey, kindRepTypeLitDDataConKey
+ kindRepTypeLitSDataConKey
:: Unique
kindRepTyConAppDataConKey = mkPreludeDataConUnique 106
kindRepVarDataConKey = mkPreludeDataConUnique 107
@@ -2254,7 +2234,6 @@ kindRepAppDataConKey = mkPreludeDataConUnique 108
kindRepFunDataConKey = mkPreludeDataConUnique 109
kindRepTYPEDataConKey = mkPreludeDataConUnique 110
kindRepTypeLitSDataConKey = mkPreludeDataConUnique 111
-kindRepTypeLitDDataConKey = mkPreludeDataConUnique 112
typeLitSymbolDataConKey, typeLitNatDataConKey, typeLitCharDataConKey :: Unique
typeLitSymbolDataConKey = mkPreludeDataConUnique 113
@@ -2497,7 +2476,6 @@ proxyHashKey = mkPreludeMiscIdUnique 502
-- Used to make `Typeable` dictionaries
mkTyConKey
- , mkTrTypeKey
, mkTrConKey
, mkTrAppCheckedKey
, mkTrFunKey
@@ -2507,7 +2485,6 @@ mkTyConKey
, typeRepIdKey
:: Unique
mkTyConKey = mkPreludeMiscIdUnique 503
-mkTrTypeKey = mkPreludeMiscIdUnique 504
mkTrConKey = mkPreludeMiscIdUnique 505
mkTrAppCheckedKey = mkPreludeMiscIdUnique 506
typeNatTypeRepKey = mkPreludeMiscIdUnique 507
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/20fa04e27c8f1e468341e0866d9d925…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/20fa04e27c8f1e468341e0866d9d925…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/deepseq-primop] 27 commits: Bump exceptions submodule to 0.10.11
by Cheng Shao (@TerrorJack) 20 Dec '25
by Cheng Shao (@TerrorJack) 20 Dec '25
20 Dec '25
Cheng Shao pushed to branch wip/deepseq-primop at Glasgow Haskell Compiler / GHC
Commits:
3b5aecb5 by Ben Gamari at 2025-12-13T23:43:10+01:00
Bump exceptions submodule to 0.10.11
- - - - -
c32de3b0 by Johan Förberg at 2025-12-15T02:36:03-05:00
base: Define Semigroup and Monoid instances for lazy ST
CLC proposal:
https://github.com/haskell/core-libraries-committee/issues/374
Fixes #26581
- - - - -
4f8b660c by mangoiv at 2025-12-15T02:37:05-05:00
ci: do not require nightly cabal-reinstall job to succeed
- - - - -
2c2a3ef3 by Cheng Shao at 2025-12-15T11:51:53-05:00
docs: drop obsolete warning about -fexternal-interpreter on windows
This patch drops an obsolete warning about -fexternal-interpreter not
supported on windows; it is supported since a long time ago, including
the profiled way.
- - - - -
68573aa5 by Marc Scholten at 2025-12-15T11:53:00-05:00
haddock: Drop Haddock.Backends.HaddockDB as it's unused
- - - - -
b230d549 by mangoiv at 2025-12-16T15:17:45-05:00
base: generalize delete{Firsts,}By
When we delete{Firsts,}By we should not require the
lists to be the same type. This is an especially useful
generalisation in the case of deleteFirstsBy because we
can skip an invocation of the map function.
This change was discussed on the core-libraries-committee's bug
tracker at https://github.com/haskell/core-libraries-committee/issues/372.
- - - - -
6a2b43e3 by Cheng Shao at 2025-12-16T15:18:30-05:00
compiler: clean up redundant LANGUAGE pragmas
This patch bumps `default-language` of `ghc`/`ghc-bin` from `GHC2021`
to `GHC2024` (which is supported in ghc 9.10, current boot ghc lower
version bound), and also cleans up redundant `LANGUAGE` pragmas (as
well as `default-extensions`/`other-extensions`) that are already
implied by `GHC2024`.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
fca9cd7c by sheaf at 2025-12-18T13:18:18-05:00
X86 CodeGen: fix assign_eax_sse_regs
We must set %al to the number of SSE2 registers that contain arguments
(in case we are dealing with a varargs function). The logic for counting
how many arguments reside in SSE2 registers was incorrect, as it used
'isFloatFormat', which incorrectly ignores vector registers.
We now instead do case analysis on the register class:
is_sse_reg r =
case targetClassOfReg platform r of
RcFloatOrVector -> True
RcInteger -> False
This change is necessary to prevent segfaults in T20030_test1j, because
subsequent commits change the format calculations, resulting in vector
formats more often.
- - - - -
53150617 by sheaf at 2025-12-18T13:18:19-05:00
X86 regUsageOfInstr: fix format for IMUL
When used with 8-bit operands, the IMUL instruction returns the result
in the lower 16 bits of %rax (also known as %ax). This is different
than for the other sizes, where an input at 16, 32 or 64 bits will
result in 16, 32 or 64 bits of output in both %rax and %rdx.
This doesn't affect the behaviour of the compiler, because we don't
allow partial writes at sub-word sizes. The rationale is explained
in Wrinkle [Don't allow scalar partial writes] in Note [Register formats in liveness analysis],
in GHC.CmmToAsm.Reg.Liveness.
- - - - -
c7a56dd1 by sheaf at 2025-12-18T13:18:19-05:00
Liveness analysis: consider register formats
This commit updates the register allocator to be a bit more careful in
situations in which a single register is used at multiple different
formats, e.g. when xmm1 is used both to store a Double# and a DoubleX2#.
This is done by introducing the 'Regs' newtype around 'UniqSet RegWithFormat',
for which the combining operations take the larger of the two formats
instead of overriding the format.
Operations on 'Regs' are defined in 'GHC.CmmToAsm.Reg.Regs'. There is
a modest compile-time cost for the additional overhead for tracking
register formats, which causes the metric increases of this commit.
The subtle aspects of the implementation are outlined in
Note [Register formats in liveness analysis] in GHC.CmmToAsm.Reg.Liveness.
Fixes #26411 #26611
-------------------------
Metric Increase:
T12707
T26425
T3294
-------------------------
- - - - -
c2e83339 by sheaf at 2025-12-18T13:18:19-05:00
Register allocator: reload at same format as spill
This commit ensures that if we spill a register onto the stack at a
given format, we then always reload the register at this same format.
This ensures we don't end up in a situation where we spill F64x2 but end
up only reloading the lower F64. This first reload would make us believe
the whole data is in a register, thus silently losing the upper 64 bits
of the spilled register's contents.
Fixes #26526
- - - - -
55ab583b by sheaf at 2025-12-18T13:18:19-05:00
Register allocation: writes redefine format
As explained in Note [Allocated register formats] in GHC.CmmToAsm.Reg.Linear,
we consider all writes to redefine the format of the register.
This ensures that in a situation such as
movsd .Ln6m(%rip),%v1
shufpd $0,%v1,%v1
we properly consider the broadcast operation to change the format of %v1
from F64 to F64x2.
This completes the fix to #26411 (test in T26411b).
- - - - -
951402ed by Vladislav Zavialov at 2025-12-18T13:19:05-05:00
Parser: improve mkModuleImpExp, remove checkImportSpec
1. The `mkModuleImpExp` helper now knows whether it is processing an import or
export list item, and uses this information to produce a more accurate error
message for `import M (T(..,x))` with PatternSynonyms disabled.
The old message incorrectly referred to this case as an export form.
2. The `checkImportSpec` helper is removed in favor of more comprehensive error
checking in `mkModuleImpExp`.
3. Additionaly, the invariants of `ImpExpList` and `ImpExpAllWith` have been
made more explicit in the comments and assertions (calls to 'panic').
Test case: import-syntax-no-ext
- - - - -
47d83d96 by Vladislav Zavialov at 2025-12-18T13:19:06-05:00
Subordinate namespace-specified wildcards (#25901)
Add support for subordinate namespace-specified wildcards
`X(type ..)` and `X(data ..)` to import and export lists.
Examples:
import M (Cls(type ..)) -- imports Cls and all its associated types
import M (Cls(data ..)) -- imports Cls and all its methods
module M (R(data ..), C(type ..)) where
-- exports R and all its data constructors and record fields;
-- exports C and all its associated types, but not its methods
The scope of this change is limited to the case where the wildcard is the only
subordinate import/export item, whereas the more complex forms `X(type .., f)`
or `X(type .., data ..)` are unsupported and raise the newly introduced
PsErrUnsupportedExplicitNamespace error. This restriction may be lifted later.
Summary of the changes:
1. Refactor IEThingAll to store its extension field XIEThingAll as a record
IEThingAllExt instead of a tuple.
2. Extend the AST by adding a NamespaceSpecifier field to IEThingAllExt,
representing an optional namespace specifier `type` or `data` in front
of a subordinate wildcard `X(..)`.
3. Extend the grammar in Parser.y with productions for `type ..` and `data ..`
in subordinate import/export items.
4. Introduce `filterByNamespaceGREs` to filter [GlobalRdrElt] by a
NamespaceSpecifier; use it in `filterImports` and `exports_from_avail`
to account for the namespace specifier in IEThingAll.
5. Improve diagnostics by storing more information in DodgyImportsEmptyParent
and DodgyExportsEmptyParent.
Test cases:
T25901_sub_e T25901_sub_f T25901_sub_g T25901_sub_a
T25901_sub_b T25901_sub_c T25901_sub_d T25901_sub_w
DodgyImports02 DodgyImports03 DodgyImports04
- - - - -
eac418bb by Recursion Ninja at 2025-12-18T13:19:48-05:00
Removing the 'Data' instance for 'InstEnv'.
The 'Data' instance is blocking work on Trees that Grow, and the
'Data' instance seem to have been added without a clear purpose.
- - - - -
e920e038 by Recursion Ninja at 2025-12-18T13:19:48-05:00
'Decouple Language.Haskell.Syntax.Decls' from 'GHC.Unit.Module.Warnings'
- - - - -
bd38b76c by Cheng Shao at 2025-12-18T13:20:31-05:00
testsuite: improve coverage of foundation test
This patch refactors the `foundation` test a bit to improve coverage:
- Instead of using a hard-coded seed, a random seed is now taken from
the command line, and printed upon test failure. This improves test
coverage over many future CI runs, and shall a failure occur, the
seed is available in the CI log for local reproduction.
- The iterations count is bumped to 1000 instead of 100, similar to
the bump in `test-primops`. Runtime timeout is bumped 2x just to be
safe.
- Improve `newLCGGen` by using non-atomic loads/stores on a
`MutableByteArray#` for storing mutable `Word64`, this test doesn't
use parallelism in the first place
- Fixed a few compiler warnings and removed redundant pragmas and
imports
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
3995187c by Sylvain Henry at 2025-12-18T13:21:45-05:00
Doc: document -pgmi "" (#26634)
- - - - -
5729418c by Cheng Shao at 2025-12-18T13:22:29-05:00
rts: use __builtin_mul_overflow for hs_mulIntMayOflo
This patch uses `__builtin_mul_overflow` to implement
`hs_mulIntMayOflo`. This is a GNU C checked arithmetic builtin
function supported by gcc/clang, is type-generic so works for both
32-bit/64-bit, and makes the code both more efficient and easier to
read/maintain than the previous hand rolled logic.
- - - - -
1ca4b49a by Cheng Shao at 2025-12-18T13:23:11-05:00
compiler/rts: fix ABI mismatch in barf() invocations
This patch fixes a long-standing issue of ABI mismatch in `barf()`
invocations, both in compiler-emitted code and in hand written Cmm
code:
- In RTS, we have `barf()` which reports a fatal internal error
message and exits the program.
- `barf()` is a variadic C function! When used as a callee of a
foreign call with `ccall` calling convention instead of `capi`,
there is an ABI mismatch between the caller and the callee!
- Unfortunately, both the compiler and the Cmm sources contain many
places where we call `barf()` via `ccall` convention!! Like, when
you write `foreign "C" barf("foo object (%p) entered!", R1)`, it
totally doesn't do what you think it'll do at all!! The second
argument `R1` is not properly passed in `va_list`, and the behavior
is completely undefined!!
- Even more unfortunately, this issue has been sitting around long
enough because the ABI mismatch is subtle enough on normie platforms
like x64 and arm64.
- But there are platforms like wasm32 that are stricter about ABI, and
the broken `barf()` invocations already causes trouble for wasm
backend: we had to use ugly hacks like `barf(errmsg, NULL)` to make
`wasm-ld` happy, and even with this band-aid, compiler-generated
`barf()` invocations are still broken, resulting in regressions in
certain debug-related functionality, e.g. `-dtag-inference-checks`
is broken on wasm32 (#22882).
This patch properly fixes the issue:
- We add non-variadic `barf` wrappers in the RTS that can be used as
`ccall` callees
- Both the compiler `emitBarf` logic and the hand-written Cmm are
changed to call these wrappers
- `emitBarf` now also properly annotates the foreign call as
`CmmNeverReturns` to indicate it's a noreturn call to enable more
efficient code generation
`-dtag-inference-checks` now works on wasm. Closes #22882.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
b3dd23b9 by Vilim Lendvaj at 2025-12-18T13:23:57-05:00
Remove outdated comment
The Traversable instance for ZipList is no longer in
GHC.Internal.Data.Traversable. In fact, it is right below this very comment.
- - - - -
9a9c2f03 by Cheng Shao at 2025-12-18T13:24:39-05:00
compiler: remove unused OtherSection logic
This patch removes the OtherSection logic in Cmm, given it's never
actually used by any of our backends.
- - - - -
91edd292 by Wolfgang Jeltsch at 2025-12-19T03:18:19-05:00
Remove unused known-key and name variables for generics
This removes the known-key and corresponding name variables for `K1`,
`M1`, `R`, `D`, `C`, `S`, and `URec` from `GHC.Generics`, as they are
apparently nowhere used in GHC’s source code.
- - - - -
73ee7e38 by Wolfgang Jeltsch at 2025-12-19T03:19:02-05:00
Remove unused known keys and names for generics classes
This removes the known-key and corresponding name variables for
`Datatype`, `Constructor`, and `Selector` from `GHC.Generics`, as they
are apparently nowhere used in GHC’s source code.
- - - - -
f69c5f14 by Cheng Shao at 2025-12-19T03:19:45-05:00
wasm: fix handling of ByteArray#/MutableByteArray# arguments in JSFFI imports
This patch fixes the handling of ByteArray#/MutableByteArray#
arguments in JSFFI imports, see the amended note and manual for
explanation. Also adds a test to witness the fix.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
c98032d8 by Cheng Shao at 2025-12-19T18:11:12+01:00
WIP
- - - - -
8dc16ccb by Cheng Shao at 2025-12-19T20:16:10+01:00
WIP
- - - - -
545 changed files:
- .gitlab-ci.yml
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/PrimOps/Ids.hs
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Breakpoints.hs
- compiler/GHC/ByteCode/InfoTable.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/BlockId.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/Cmm/Config.hs
- compiler/GHC/Cmm/ContFlowOpt.hs
- compiler/GHC/Cmm/Dataflow.hs
- compiler/GHC/Cmm/Dataflow/Block.hs
- compiler/GHC/Cmm/Dataflow/Graph.hs
- compiler/GHC/Cmm/Dataflow/Label.hs
- compiler/GHC/Cmm/DebugBlock.hs
- compiler/GHC/Cmm/Dominators.hs
- compiler/GHC/Cmm/Expr.hs
- compiler/GHC/Cmm/Graph.hs
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/LRegSet.hs
- compiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/Liveness.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Node.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/ProcPoint.hs
- compiler/GHC/Cmm/Reducibility.hs
- compiler/GHC/Cmm/Reg.hs
- compiler/GHC/Cmm/Sink.hs
- compiler/GHC/Cmm/Switch.hs
- compiler/GHC/Cmm/Switch/Implement.hs
- compiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/Cmm/UniqueRenamer.hs
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/CPrim.hs
- compiler/GHC/CmmToAsm/Dwarf/Types.hs
- compiler/GHC/CmmToAsm/Format.hs
- compiler/GHC/CmmToAsm/LA64/CodeGen.hs
- compiler/GHC/CmmToAsm/LA64/Ppr.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/CmmToAsm/RV64/CodeGen.hs
- compiler/GHC/CmmToAsm/RV64/Ppr.hs
- compiler/GHC/CmmToAsm/Reg/Graph.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Coalesce.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/Base.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/Reg/Linear/State.hs
- compiler/GHC/CmmToAsm/Reg/Linear/X86.hs
- compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- + compiler/GHC/CmmToAsm/Reg/Regs.hs
- compiler/GHC/CmmToAsm/Reg/Target.hs
- compiler/GHC/CmmToAsm/Wasm.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/CmmToLlvm/Data.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/LateCC/OverloadedCalls.hs
- compiler/GHC/Core/LateCC/TopLevelBinds.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Lint/Interactive.hs
- compiler/GHC/Core/Map/Expr.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/CallerCC.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/TyCon/Env.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Type.hs-boot
- compiler/GHC/Core/Unify.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/Data/Bag.hs
- compiler/GHC/Data/FastString.hs
- compiler/GHC/Data/Graph/Collapse.hs
- compiler/GHC/Data/Graph/Color.hs
- compiler/GHC/Data/Graph/Directed.hs
- compiler/GHC/Data/List/Infinite.hs
- compiler/GHC/Data/List/NonEmpty.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Data/Pair.hs
- compiler/GHC/Data/Stream.hs
- compiler/GHC/Data/Strict.hs
- compiler/GHC/Data/StringBuffer.hs
- compiler/GHC/Data/TrieMap.hs
- compiler/GHC/Data/Word64Map.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CmdLine.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/Config/Tidy.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Env/KnotVars.hs
- compiler/GHC/Driver/Errors.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/Hooks.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/MakeSem.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Pipeline/LogQueue.hs
- compiler/GHC/Driver/Pipeline/Monad.hs
- compiler/GHC/Driver/Pipeline/Phases.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Driver/Session/Inspect.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Basic.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/Hs/Doc.hs-boot
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Expr.hs-boot
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Pat.hs-boot
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Errors/Ppr.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Check.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Pmc/Types.hs
- compiler/GHC/HsToCore/Pmc/Utils.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Binary.hs
- compiler/GHC/Iface/Decl.hs
- compiler/GHC/Iface/Env.hs
- compiler/GHC/Iface/Errors.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Types.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Ext/Debug.hs
- compiler/GHC/Iface/Ext/Types.hs
- compiler/GHC/Iface/Ext/Utils.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Iface/Rename.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Iface/Warnings.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/JS/Ident.hs
- compiler/GHC/JS/JStg/Monad.hs
- compiler/GHC/JS/JStg/Syntax.hs
- compiler/GHC/JS/Make.hs
- compiler/GHC/JS/Optimizer.hs
- compiler/GHC/JS/Ppr.hs
- compiler/GHC/JS/Syntax.hs
- compiler/GHC/JS/Transform.hs
- compiler/GHC/Linker/Deps.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Types.hs
- compiler/GHC/Llvm/MetaData.hs
- compiler/GHC/Llvm/Ppr.hs
- compiler/GHC/Llvm/Types.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/Errors/Basic.hs
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Errors/Types.hs
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Parser/String.hs
- compiler/GHC/Parser/Types.hs
- compiler/GHC/Platform.hs
- compiler/GHC/Platform/Reg/Class.hs
- compiler/GHC/Platform/Reg/Class/NoVectors.hs
- compiler/GHC/Platform/Reg/Class/Separate.hs
- compiler/GHC/Platform/Reg/Class/Unified.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Expr.hs-boot
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Heap/Layout.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Interpreter/JS.hs
- compiler/GHC/Runtime/Interpreter/Process.hs
- compiler/GHC/Runtime/Interpreter/Types.hs
- compiler/GHC/Runtime/Interpreter/Types/SymbolCache.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/Stg/Debug.hs
- compiler/GHC/Stg/EnforceEpt.hs
- compiler/GHC/Stg/EnforceEpt/Rewrite.hs
- compiler/GHC/Stg/EnforceEpt/TagSig.hs
- compiler/GHC/Stg/EnforceEpt/Types.hs
- compiler/GHC/Stg/FVs.hs
- compiler/GHC/Stg/Lift/Analysis.hs
- compiler/GHC/Stg/Lift/Monad.hs
- compiler/GHC/Stg/Lift/Types.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Stg/Pipeline.hs
- compiler/GHC/Stg/Syntax.hs
- compiler/GHC/Stg/Unarise.hs
- compiler/GHC/Stg/Utils.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm.hs
- compiler/GHC/StgToCmm/ArgRep.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/CgUtils.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/ExtCode.hs
- compiler/GHC/StgToCmm/Lit.hs
- compiler/GHC/StgToCmm/Monad.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToCmm/Utils.hs
- compiler/GHC/StgToJS/Apply.hs
- compiler/GHC/StgToJS/Arg.hs
- compiler/GHC/StgToJS/CodeGen.hs
- compiler/GHC/StgToJS/DataCon.hs
- compiler/GHC/StgToJS/Deps.hs
- compiler/GHC/StgToJS/Expr.hs
- compiler/GHC/StgToJS/ExprCtx.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/StgToJS/Heap.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/StgToJS/Linker/Opt.hs
- compiler/GHC/StgToJS/Linker/Types.hs
- compiler/GHC/StgToJS/Literal.hs
- compiler/GHC/StgToJS/Monad.hs
- compiler/GHC/StgToJS/Object.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/StgToJS/Rts/Rts.hs
- compiler/GHC/StgToJS/Rts/Types.hs
- compiler/GHC/StgToJS/Sinker/Collect.hs
- compiler/GHC/StgToJS/Sinker/Sinker.hs
- compiler/GHC/StgToJS/Sinker/StringsUnfloat.hs
- compiler/GHC/StgToJS/Types.hs
- compiler/GHC/StgToJS/Utils.hs
- compiler/GHC/SysTools.hs
- compiler/GHC/SysTools/Ar.hs
- compiler/GHC/SysTools/BaseDir.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/SysTools/Tasks.hs
- compiler/GHC/SysTools/Terminal.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Functor.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Hole/FitTypes.hs
- compiler/GHC/Tc/Errors/Hole/Plugin.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Errors/Types/PromotionErr.hs
- compiler/GHC/Tc/Gen/Annotation.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Instance/FunDeps.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Irred.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Types.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/ErrCtxt.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Backpack.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Tc/Zonk/Monad.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Annotations.hs
- compiler/GHC/Types/Avail.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/CompleteMatch.hs
- compiler/GHC/Types/CostCentre.hs
- compiler/GHC/Types/CostCentre/State.hs
- compiler/GHC/Types/DefaultEnv.hs
- compiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/FieldLabel.hs
- compiler/GHC/Types/Fixity.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/ForeignStubs.hs
- compiler/GHC/Types/GREInfo.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Cache.hs
- compiler/GHC/Types/Name/Occurrence.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Types/Name/Set.hs
- compiler/GHC/Types/PkgQual.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/SaneDouble.hs
- compiler/GHC/Types/SourceText.hs
- compiler/GHC/Types/SrcLoc.hs
- compiler/GHC/Types/Tickish.hs
- compiler/GHC/Types/TyThing.hs
- compiler/GHC/Types/Unique/DFM.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Types/Unique/FM.hs
- compiler/GHC/Types/Unique/Map.hs
- compiler/GHC/Types/Unique/SDFM.hs
- compiler/GHC/Types/Unique/Set.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/Home/PackageTable.hs
- compiler/GHC/Unit/Info.hs
- compiler/GHC/Unit/Module.hs
- compiler/GHC/Unit/Module/Deps.hs
- compiler/GHC/Unit/Module/Graph.hs
- compiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Unit/Module/ModSummary.hs
- compiler/GHC/Unit/Module/Status.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/GHC/Unit/Module/WholeCoreBindings.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Unit/Types.hs
- compiler/GHC/Unit/Types.hs-boot
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Binary/Typeable.hs
- compiler/GHC/Utils/Exception.hs
- compiler/GHC/Utils/Json.hs
- compiler/GHC/Utils/Logger.hs
- compiler/GHC/Utils/Misc.hs
- compiler/GHC/Utils/Monad/Codensity.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/GHC/Utils/Panic.hs
- compiler/GHC/Utils/Panic/Plain.hs
- compiler/GHC/Wasm/ControlFlow.hs
- compiler/GHC/Wasm/ControlFlow/FromCmm.hs
- compiler/Language/Haskell/Syntax.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Binds.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- compiler/Language/Haskell/Syntax/Expr.hs-boot
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/Language/Haskell/Syntax/ImpExp.hs
- compiler/Language/Haskell/Syntax/Lit.hs
- compiler/Language/Haskell/Syntax/Pat.hs
- compiler/Language/Haskell/Syntax/Pat.hs-boot
- compiler/Language/Haskell/Syntax/Type.hs
- compiler/ghc.cabal.in
- docs/users_guide/ghci.rst
- docs/users_guide/phases.rst
- docs/users_guide/wasm.rst
- ghc/GHC/Driver/Session/Lint.hs
- ghc/GHC/Driver/Session/Mode.hs
- ghc/GHCi/Leak.hs
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Exception.hs
- ghc/GHCi/UI/Info.hs
- ghc/GHCi/UI/Monad.hs
- ghc/Main.hs
- ghc/ghc-bin.cabal.in
- libraries/base/changelog.md
- libraries/exceptions
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Data/OldList.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- rts/Apply.cmm
- rts/Compact.cmm
- rts/ContinuationOps.cmm
- + rts/DeepSeq.cmm
- rts/Exception.cmm
- rts/Jumps.h
- rts/PrimOps.cmm
- rts/RtsMessages.c
- rts/RtsSymbols.c
- rts/StgMiscClosures.cmm
- rts/StgStartup.cmm
- rts/include/Stg.h
- rts/include/rts/Messages.h
- rts/include/stg/MiscClosures.h
- rts/prim/mulIntMayOflo.c
- rts/rts.cabal
- testsuite/tests/diagnostic-codes/codes.stdout
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/jsffi/all.T
- + testsuite/tests/jsffi/bytearrayarg.hs
- + testsuite/tests/jsffi/bytearrayarg.mjs
- + testsuite/tests/jsffi/bytearrayarg.stdout
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/numeric/should_run/foundation.hs
- testsuite/tests/numeric/should_run/foundation.stdout
- testsuite/tests/patsyn/should_fail/all.T
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.hs
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.stderr
- testsuite/tests/perf/should_run/all.T
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.hs
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.stdout
- testsuite/tests/primops/should_run/all.T
- + testsuite/tests/rename/should_compile/T25901_sub_e.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g.hs
- + testsuite/tests/rename/should_compile/T25901_sub_g.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g_helper.hs
- testsuite/tests/rename/should_compile/all.T
- testsuite/tests/rename/should_fail/T23570b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_a.hs
- + testsuite/tests/rename/should_fail/T25901_sub_a.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_b.hs
- + testsuite/tests/rename/should_fail/T25901_sub_b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c.hs
- + testsuite/tests/rename/should_fail/T25901_sub_c.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_d_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.stderr
- testsuite/tests/rename/should_fail/all.T
- + testsuite/tests/simd/should_run/T26411.hs
- + testsuite/tests/simd/should_run/T26411.stdout
- + testsuite/tests/simd/should_run/T26411b.hs
- + testsuite/tests/simd/should_run/T26411b.stdout
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/simplStg/should_compile/all.T
- testsuite/tests/warnings/should_compile/DodgyExports03.stderr
- testsuite/tests/warnings/should_compile/DodgyImports.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports02.hs
- + testsuite/tests/warnings/should_compile/DodgyImports02.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03.hs
- + testsuite/tests/warnings/should_compile/DodgyImports03.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03_helper.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.stderr
- testsuite/tests/warnings/should_compile/DodgyImports_hiding.stderr
- testsuite/tests/warnings/should_compile/all.T
- utils/check-exact/ExactPrint.hs
- utils/genapply/Main.hs
- utils/haddock/haddock-api/haddock-api.cabal
- − utils/haddock/haddock-api/src/Haddock/Backends/HaddockDB.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c1502f714dd63817b24b70b9e64b96…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c1502f714dd63817b24b70b9e64b96…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/romes/hadrian-cross-stage2-rebase_SVEN_FIXED] Build stage1 compiler lib with internal-interpreter
by Sven Tennie (@supersven) 20 Dec '25
by Sven Tennie (@supersven) 20 Dec '25
20 Dec '25
Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FIXED at Glasgow Haskell Compiler / GHC
Commits:
e3930f3e by Sven Tennie at 2025-12-19T20:10:16+01:00
Build stage1 compiler lib with internal-interpreter
This will be used by the stage0 compiler, which runs on build/host and
thus could provide the internal interpreter.
- - - - -
1 changed file:
- hadrian/src/Settings/Packages.hs
Changes:
=====================================
hadrian/src/Settings/Packages.hs
=====================================
@@ -92,7 +92,7 @@ packageArgs = do
-- on the host and must rely on external interpreter to load
-- target code, otherwise enable for stage2 since that runs on
-- the target and can use target's own ghci object linker
- [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter"
+ [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "internal-interpreter"
, orM [ notM cross, haveCurses ] `cabalFlag` "terminfo"
, arg "-build-tool-depends"
, staged (buildFlag UseLibzstd) `cabalFlag` "with-libzstd"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3930f3ee5a0a79c6df6f6ba586b24c…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3930f3ee5a0a79c6df6f6ba586b24c…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Pushed new branch wip/jeltsch/known-key-removals/naturals
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
by Wolfgang Jeltsch (@jeltsch) 20 Dec '25
20 Dec '25
Wolfgang Jeltsch pushed new branch wip/jeltsch/known-key-removals/naturals at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/jeltsch/known-key-removals/na…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/split-sections-for-cross-stage0] 19 commits: X86 CodeGen: fix assign_eax_sse_regs
by Cheng Shao (@TerrorJack) 20 Dec '25
by Cheng Shao (@TerrorJack) 20 Dec '25
20 Dec '25
Cheng Shao pushed to branch wip/split-sections-for-cross-stage0 at Glasgow Haskell Compiler / GHC
Commits:
fca9cd7c by sheaf at 2025-12-18T13:18:18-05:00
X86 CodeGen: fix assign_eax_sse_regs
We must set %al to the number of SSE2 registers that contain arguments
(in case we are dealing with a varargs function). The logic for counting
how many arguments reside in SSE2 registers was incorrect, as it used
'isFloatFormat', which incorrectly ignores vector registers.
We now instead do case analysis on the register class:
is_sse_reg r =
case targetClassOfReg platform r of
RcFloatOrVector -> True
RcInteger -> False
This change is necessary to prevent segfaults in T20030_test1j, because
subsequent commits change the format calculations, resulting in vector
formats more often.
- - - - -
53150617 by sheaf at 2025-12-18T13:18:19-05:00
X86 regUsageOfInstr: fix format for IMUL
When used with 8-bit operands, the IMUL instruction returns the result
in the lower 16 bits of %rax (also known as %ax). This is different
than for the other sizes, where an input at 16, 32 or 64 bits will
result in 16, 32 or 64 bits of output in both %rax and %rdx.
This doesn't affect the behaviour of the compiler, because we don't
allow partial writes at sub-word sizes. The rationale is explained
in Wrinkle [Don't allow scalar partial writes] in Note [Register formats in liveness analysis],
in GHC.CmmToAsm.Reg.Liveness.
- - - - -
c7a56dd1 by sheaf at 2025-12-18T13:18:19-05:00
Liveness analysis: consider register formats
This commit updates the register allocator to be a bit more careful in
situations in which a single register is used at multiple different
formats, e.g. when xmm1 is used both to store a Double# and a DoubleX2#.
This is done by introducing the 'Regs' newtype around 'UniqSet RegWithFormat',
for which the combining operations take the larger of the two formats
instead of overriding the format.
Operations on 'Regs' are defined in 'GHC.CmmToAsm.Reg.Regs'. There is
a modest compile-time cost for the additional overhead for tracking
register formats, which causes the metric increases of this commit.
The subtle aspects of the implementation are outlined in
Note [Register formats in liveness analysis] in GHC.CmmToAsm.Reg.Liveness.
Fixes #26411 #26611
-------------------------
Metric Increase:
T12707
T26425
T3294
-------------------------
- - - - -
c2e83339 by sheaf at 2025-12-18T13:18:19-05:00
Register allocator: reload at same format as spill
This commit ensures that if we spill a register onto the stack at a
given format, we then always reload the register at this same format.
This ensures we don't end up in a situation where we spill F64x2 but end
up only reloading the lower F64. This first reload would make us believe
the whole data is in a register, thus silently losing the upper 64 bits
of the spilled register's contents.
Fixes #26526
- - - - -
55ab583b by sheaf at 2025-12-18T13:18:19-05:00
Register allocation: writes redefine format
As explained in Note [Allocated register formats] in GHC.CmmToAsm.Reg.Linear,
we consider all writes to redefine the format of the register.
This ensures that in a situation such as
movsd .Ln6m(%rip),%v1
shufpd $0,%v1,%v1
we properly consider the broadcast operation to change the format of %v1
from F64 to F64x2.
This completes the fix to #26411 (test in T26411b).
- - - - -
951402ed by Vladislav Zavialov at 2025-12-18T13:19:05-05:00
Parser: improve mkModuleImpExp, remove checkImportSpec
1. The `mkModuleImpExp` helper now knows whether it is processing an import or
export list item, and uses this information to produce a more accurate error
message for `import M (T(..,x))` with PatternSynonyms disabled.
The old message incorrectly referred to this case as an export form.
2. The `checkImportSpec` helper is removed in favor of more comprehensive error
checking in `mkModuleImpExp`.
3. Additionaly, the invariants of `ImpExpList` and `ImpExpAllWith` have been
made more explicit in the comments and assertions (calls to 'panic').
Test case: import-syntax-no-ext
- - - - -
47d83d96 by Vladislav Zavialov at 2025-12-18T13:19:06-05:00
Subordinate namespace-specified wildcards (#25901)
Add support for subordinate namespace-specified wildcards
`X(type ..)` and `X(data ..)` to import and export lists.
Examples:
import M (Cls(type ..)) -- imports Cls and all its associated types
import M (Cls(data ..)) -- imports Cls and all its methods
module M (R(data ..), C(type ..)) where
-- exports R and all its data constructors and record fields;
-- exports C and all its associated types, but not its methods
The scope of this change is limited to the case where the wildcard is the only
subordinate import/export item, whereas the more complex forms `X(type .., f)`
or `X(type .., data ..)` are unsupported and raise the newly introduced
PsErrUnsupportedExplicitNamespace error. This restriction may be lifted later.
Summary of the changes:
1. Refactor IEThingAll to store its extension field XIEThingAll as a record
IEThingAllExt instead of a tuple.
2. Extend the AST by adding a NamespaceSpecifier field to IEThingAllExt,
representing an optional namespace specifier `type` or `data` in front
of a subordinate wildcard `X(..)`.
3. Extend the grammar in Parser.y with productions for `type ..` and `data ..`
in subordinate import/export items.
4. Introduce `filterByNamespaceGREs` to filter [GlobalRdrElt] by a
NamespaceSpecifier; use it in `filterImports` and `exports_from_avail`
to account for the namespace specifier in IEThingAll.
5. Improve diagnostics by storing more information in DodgyImportsEmptyParent
and DodgyExportsEmptyParent.
Test cases:
T25901_sub_e T25901_sub_f T25901_sub_g T25901_sub_a
T25901_sub_b T25901_sub_c T25901_sub_d T25901_sub_w
DodgyImports02 DodgyImports03 DodgyImports04
- - - - -
eac418bb by Recursion Ninja at 2025-12-18T13:19:48-05:00
Removing the 'Data' instance for 'InstEnv'.
The 'Data' instance is blocking work on Trees that Grow, and the
'Data' instance seem to have been added without a clear purpose.
- - - - -
e920e038 by Recursion Ninja at 2025-12-18T13:19:48-05:00
'Decouple Language.Haskell.Syntax.Decls' from 'GHC.Unit.Module.Warnings'
- - - - -
bd38b76c by Cheng Shao at 2025-12-18T13:20:31-05:00
testsuite: improve coverage of foundation test
This patch refactors the `foundation` test a bit to improve coverage:
- Instead of using a hard-coded seed, a random seed is now taken from
the command line, and printed upon test failure. This improves test
coverage over many future CI runs, and shall a failure occur, the
seed is available in the CI log for local reproduction.
- The iterations count is bumped to 1000 instead of 100, similar to
the bump in `test-primops`. Runtime timeout is bumped 2x just to be
safe.
- Improve `newLCGGen` by using non-atomic loads/stores on a
`MutableByteArray#` for storing mutable `Word64`, this test doesn't
use parallelism in the first place
- Fixed a few compiler warnings and removed redundant pragmas and
imports
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
3995187c by Sylvain Henry at 2025-12-18T13:21:45-05:00
Doc: document -pgmi "" (#26634)
- - - - -
5729418c by Cheng Shao at 2025-12-18T13:22:29-05:00
rts: use __builtin_mul_overflow for hs_mulIntMayOflo
This patch uses `__builtin_mul_overflow` to implement
`hs_mulIntMayOflo`. This is a GNU C checked arithmetic builtin
function supported by gcc/clang, is type-generic so works for both
32-bit/64-bit, and makes the code both more efficient and easier to
read/maintain than the previous hand rolled logic.
- - - - -
1ca4b49a by Cheng Shao at 2025-12-18T13:23:11-05:00
compiler/rts: fix ABI mismatch in barf() invocations
This patch fixes a long-standing issue of ABI mismatch in `barf()`
invocations, both in compiler-emitted code and in hand written Cmm
code:
- In RTS, we have `barf()` which reports a fatal internal error
message and exits the program.
- `barf()` is a variadic C function! When used as a callee of a
foreign call with `ccall` calling convention instead of `capi`,
there is an ABI mismatch between the caller and the callee!
- Unfortunately, both the compiler and the Cmm sources contain many
places where we call `barf()` via `ccall` convention!! Like, when
you write `foreign "C" barf("foo object (%p) entered!", R1)`, it
totally doesn't do what you think it'll do at all!! The second
argument `R1` is not properly passed in `va_list`, and the behavior
is completely undefined!!
- Even more unfortunately, this issue has been sitting around long
enough because the ABI mismatch is subtle enough on normie platforms
like x64 and arm64.
- But there are platforms like wasm32 that are stricter about ABI, and
the broken `barf()` invocations already causes trouble for wasm
backend: we had to use ugly hacks like `barf(errmsg, NULL)` to make
`wasm-ld` happy, and even with this band-aid, compiler-generated
`barf()` invocations are still broken, resulting in regressions in
certain debug-related functionality, e.g. `-dtag-inference-checks`
is broken on wasm32 (#22882).
This patch properly fixes the issue:
- We add non-variadic `barf` wrappers in the RTS that can be used as
`ccall` callees
- Both the compiler `emitBarf` logic and the hand-written Cmm are
changed to call these wrappers
- `emitBarf` now also properly annotates the foreign call as
`CmmNeverReturns` to indicate it's a noreturn call to enable more
efficient code generation
`-dtag-inference-checks` now works on wasm. Closes #22882.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
b3dd23b9 by Vilim Lendvaj at 2025-12-18T13:23:57-05:00
Remove outdated comment
The Traversable instance for ZipList is no longer in
GHC.Internal.Data.Traversable. In fact, it is right below this very comment.
- - - - -
9a9c2f03 by Cheng Shao at 2025-12-18T13:24:39-05:00
compiler: remove unused OtherSection logic
This patch removes the OtherSection logic in Cmm, given it's never
actually used by any of our backends.
- - - - -
91edd292 by Wolfgang Jeltsch at 2025-12-19T03:18:19-05:00
Remove unused known-key and name variables for generics
This removes the known-key and corresponding name variables for `K1`,
`M1`, `R`, `D`, `C`, `S`, and `URec` from `GHC.Generics`, as they are
apparently nowhere used in GHC’s source code.
- - - - -
73ee7e38 by Wolfgang Jeltsch at 2025-12-19T03:19:02-05:00
Remove unused known keys and names for generics classes
This removes the known-key and corresponding name variables for
`Datatype`, `Constructor`, and `Selector` from `GHC.Generics`, as they
are apparently nowhere used in GHC’s source code.
- - - - -
f69c5f14 by Cheng Shao at 2025-12-19T03:19:45-05:00
wasm: fix handling of ByteArray#/MutableByteArray# arguments in JSFFI imports
This patch fixes the handling of ByteArray#/MutableByteArray#
arguments in JSFFI imports, see the amended note and manual for
explanation. Also adds a test to witness the fix.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
d83a4ff2 by Cheng Shao at 2025-12-19T19:41:21+01:00
hadrian: enable split sections for cross stage0
This patch fixes a minor issue with `splitSectionsArgs` in hadrian:
previously, it's unconditionally disabled for stage0 libraries because
it's not going to be shipped in the final bindists. But it's only true
when not cross compiling. So for now we also need to enable it for
cross stage0 as well.
- - - - -
126 changed files:
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/LA64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/CmmToAsm/RV64/Ppr.hs
- compiler/GHC/CmmToAsm/Reg/Graph.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Coalesce.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/Base.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- + compiler/GHC/CmmToAsm/Reg/Regs.hs
- compiler/GHC/CmmToAsm/Reg/Target.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/Data.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Warnings.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Errors/Types.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/Utils.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Types/DefaultEnv.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Types/Unique/FM.hs
- compiler/GHC/Types/Unique/Set.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/ghc.cabal.in
- docs/users_guide/phases.rst
- docs/users_guide/wasm.rst
- hadrian/src/Settings/Builders/SplitSections.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- rts/Apply.cmm
- rts/Compact.cmm
- rts/ContinuationOps.cmm
- rts/Exception.cmm
- rts/Jumps.h
- rts/PrimOps.cmm
- rts/RtsMessages.c
- rts/StgMiscClosures.cmm
- rts/StgStartup.cmm
- rts/include/Stg.h
- rts/include/rts/Messages.h
- rts/prim/mulIntMayOflo.c
- testsuite/tests/diagnostic-codes/codes.stdout
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/jsffi/all.T
- + testsuite/tests/jsffi/bytearrayarg.hs
- + testsuite/tests/jsffi/bytearrayarg.mjs
- + testsuite/tests/jsffi/bytearrayarg.stdout
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/numeric/should_run/foundation.hs
- testsuite/tests/numeric/should_run/foundation.stdout
- testsuite/tests/patsyn/should_fail/all.T
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.hs
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.stderr
- testsuite/tests/perf/should_run/all.T
- + testsuite/tests/rename/should_compile/T25901_sub_e.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g.hs
- + testsuite/tests/rename/should_compile/T25901_sub_g.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g_helper.hs
- testsuite/tests/rename/should_compile/all.T
- testsuite/tests/rename/should_fail/T23570b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_a.hs
- + testsuite/tests/rename/should_fail/T25901_sub_a.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_b.hs
- + testsuite/tests/rename/should_fail/T25901_sub_b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c.hs
- + testsuite/tests/rename/should_fail/T25901_sub_c.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_d_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.stderr
- testsuite/tests/rename/should_fail/all.T
- + testsuite/tests/simd/should_run/T26411.hs
- + testsuite/tests/simd/should_run/T26411.stdout
- + testsuite/tests/simd/should_run/T26411b.hs
- + testsuite/tests/simd/should_run/T26411b.stdout
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/simplStg/should_compile/all.T
- testsuite/tests/warnings/should_compile/DodgyExports03.stderr
- testsuite/tests/warnings/should_compile/DodgyImports.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports02.hs
- + testsuite/tests/warnings/should_compile/DodgyImports02.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03.hs
- + testsuite/tests/warnings/should_compile/DodgyImports03.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03_helper.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.stderr
- testsuite/tests/warnings/should_compile/DodgyImports_hiding.stderr
- testsuite/tests/warnings/should_compile/all.T
- utils/check-exact/ExactPrint.hs
- utils/genapply/Main.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c45f3be723fd1cd5dad4517aec4788…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c45f3be723fd1cd5dad4517aec4788…
You're receiving this email because of your account on gitlab.haskell.org.
1
0