Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
224446a2
by Cheng Shao at 2025-12-20T07:49:54-05:00
-
251ec087
by Cheng Shao at 2025-12-20T07:49:54-05:00
-
fb586c67
by Cheng Shao at 2025-12-20T07:50:36-05:00
-
6d689b7e
by Cheng Shao at 2025-12-20T11:26:24-05:00
-
31f9ba76
by Cheng Shao at 2025-12-20T11:26:24-05:00
-
442c9612
by Cheng Shao at 2025-12-20T11:26:25-05:00
8 changed files:
- .gitlab/ci.sh
- compiler/GHC/Parser/String.hs
- compiler/GHC/StgToCmm/InfoTableProv.hs
- hadrian/doc/flavours.md
- hadrian/src/Flavour.hs
- hadrian/src/Settings/Packages.hs
- rts/linker/InitFini.c
- rts/sm/Sanity.c
Changes:
| ... | ... | @@ -265,6 +265,15 @@ function setup() { |
| 265 | 265 | # testsuite driver!
|
| 266 | 266 | git config gc.auto 0
|
| 267 | 267 | |
| 268 | + # Some runners still choke at the perf note fetch step, which has to
|
|
| 269 | + # do with slow internet connection, see
|
|
| 270 | + # https://docs.gitlab.com/topics/git/troubleshooting_git/#error-stream-0-was-not-closed-cleanly
|
|
| 271 | + # for the http.postBuffer mitigation. It might seem
|
|
| 272 | + # counter-intuitive that "post buffer" helps with fetching, but git
|
|
| 273 | + # indeed issues post requests when fetching over https, it's a
|
|
| 274 | + # bidirectional negotiation with the remote.
|
|
| 275 | + git config http.postBuffer 52428800
|
|
| 276 | + |
|
| 268 | 277 | info "====================================================="
|
| 269 | 278 | info "Toolchain versions"
|
| 270 | 279 | info "====================================================="
|
| ... | ... | @@ -19,6 +19,7 @@ import Data.Char (chr, ord) |
| 19 | 19 | import qualified Data.Foldable1 as Foldable1
|
| 20 | 20 | import qualified Data.List.NonEmpty as NonEmpty
|
| 21 | 21 | import Data.Maybe (listToMaybe, mapMaybe)
|
| 22 | +import GHC.Data.OrdList (fromOL, nilOL, snocOL)
|
|
| 22 | 23 | import GHC.Data.StringBuffer (StringBuffer)
|
| 23 | 24 | import qualified GHC.Data.StringBuffer as StringBuffer
|
| 24 | 25 | import GHC.Parser.CharClass (
|
| ... | ... | @@ -167,16 +168,16 @@ collapseGaps = go |
| 167 | 168 | [] -> panic "gap unexpectedly ended"
|
| 168 | 169 | |
| 169 | 170 | resolveEscapes :: HasChar c => [c] -> Either (c, LexErr) [c]
|
| 170 | -resolveEscapes = go dlistEmpty
|
|
| 171 | +resolveEscapes = go nilOL
|
|
| 171 | 172 | where
|
| 172 | 173 | go !acc = \case
|
| 173 | - [] -> pure $ dlistToList acc
|
|
| 174 | + [] -> pure $ fromOL acc
|
|
| 174 | 175 | Char '\\' : Char '&' : cs -> go acc cs
|
| 175 | 176 | backslash@(Char '\\') : cs ->
|
| 176 | 177 | case resolveEscapeChar cs of
|
| 177 | - Right (esc, cs') -> go (acc `dlistSnoc` setChar esc backslash) cs'
|
|
| 178 | + Right (esc, cs') -> go (acc `snocOL` setChar esc backslash) cs'
|
|
| 178 | 179 | Left (c, e) -> Left (c, e)
|
| 179 | - c : cs -> go (acc `dlistSnoc` c) cs
|
|
| 180 | + c : cs -> go (acc `snocOL` c) cs
|
|
| 180 | 181 | |
| 181 | 182 | -- -----------------------------------------------------------------------------
|
| 182 | 183 | -- Escape characters
|
| ... | ... | @@ -420,17 +421,3 @@ It's more precisely defined with the following algorithm: |
| 420 | 421 | * Lines with only whitespace characters
|
| 421 | 422 | 3. Calculate the longest prefix of whitespace shared by all lines in the remaining list
|
| 422 | 423 | -} |
| 423 | - |
|
| 424 | --- -----------------------------------------------------------------------------
|
|
| 425 | --- DList
|
|
| 426 | - |
|
| 427 | -newtype DList a = DList ([a] -> [a])
|
|
| 428 | - |
|
| 429 | -dlistEmpty :: DList a
|
|
| 430 | -dlistEmpty = DList id
|
|
| 431 | - |
|
| 432 | -dlistToList :: DList a -> [a]
|
|
| 433 | -dlistToList (DList f) = f []
|
|
| 434 | - |
|
| 435 | -dlistSnoc :: DList a -> a -> DList a
|
|
| 436 | -dlistSnoc (DList f) x = DList (f . (x :)) |
| ... | ... | @@ -11,6 +11,7 @@ import GHC.IO (unsafePerformIO) |
| 11 | 11 | #endif
|
| 12 | 12 | |
| 13 | 13 | import Data.Char
|
| 14 | +import Data.Foldable
|
|
| 14 | 15 | import GHC.Prelude
|
| 15 | 16 | import GHC.Platform
|
| 16 | 17 | import GHC.Types.SrcLoc (pprUserRealSpan, srcSpanFile)
|
| ... | ... | @@ -18,6 +19,7 @@ import GHC.Types.Unique.DSM |
| 18 | 19 | import GHC.Unit.Module
|
| 19 | 20 | import GHC.Utils.Outputable
|
| 20 | 21 | import GHC.Data.FastString (fastStringToShortText, unpackFS, LexicalFastString(..))
|
| 22 | +import GHC.Data.OrdList (OrdList, nilOL, snocOL)
|
|
| 21 | 23 | |
| 22 | 24 | import GHC.Cmm
|
| 23 | 25 | import GHC.Cmm.CLabel
|
| ... | ... | @@ -286,7 +288,7 @@ data CgInfoProvEnt = CgInfoProvEnt |
| 286 | 288 | , ipeSrcSpan :: !StrTabOffset
|
| 287 | 289 | }
|
| 288 | 290 | |
| 289 | -data StringTable = StringTable { stStrings :: DList ShortText
|
|
| 291 | +data StringTable = StringTable { stStrings :: !(OrdList ShortText)
|
|
| 290 | 292 | , stLength :: !Int
|
| 291 | 293 | , stLookup :: !(M.Map ShortText StrTabOffset)
|
| 292 | 294 | }
|
| ... | ... | @@ -295,7 +297,7 @@ type StrTabOffset = Word32 |
| 295 | 297 | |
| 296 | 298 | emptyStringTable :: StringTable
|
| 297 | 299 | emptyStringTable =
|
| 298 | - StringTable { stStrings = emptyDList
|
|
| 300 | + StringTable { stStrings = nilOL
|
|
| 299 | 301 | , stLength = 0
|
| 300 | 302 | , stLookup = M.empty
|
| 301 | 303 | }
|
| ... | ... | @@ -303,7 +305,7 @@ emptyStringTable = |
| 303 | 305 | getStringTableStrings :: StringTable -> BS.ByteString
|
| 304 | 306 | getStringTableStrings st =
|
| 305 | 307 | BSL.toStrict $ BSB.toLazyByteString
|
| 306 | - $ foldMap f $ dlistToList (stStrings st)
|
|
| 308 | + $ foldMap' f $ stStrings st
|
|
| 307 | 309 | where
|
| 308 | 310 | f x = BSB.shortByteString (ST.contents x) `mappend` BSB.word8 0
|
| 309 | 311 | |
| ... | ... | @@ -312,7 +314,7 @@ lookupStringTable str = state $ \st -> |
| 312 | 314 | case M.lookup str (stLookup st) of
|
| 313 | 315 | Just off -> (off, st)
|
| 314 | 316 | Nothing ->
|
| 315 | - let !st' = st { stStrings = stStrings st `snoc` str
|
|
| 317 | + let !st' = st { stStrings = stStrings st `snocOL` str
|
|
| 316 | 318 | , stLength = stLength st + ST.byteLength str + 1
|
| 317 | 319 | , stLookup = M.insert str res (stLookup st)
|
| 318 | 320 | }
|
| ... | ... | @@ -359,14 +361,3 @@ foreign import ccall unsafe "ZSTD_compressBound" |
| 359 | 361 | |
| 360 | 362 | defaultCompressionLevel :: Int
|
| 361 | 363 | defaultCompressionLevel = 3 |
| 362 | - |
|
| 363 | -newtype DList a = DList ([a] -> [a])
|
|
| 364 | - |
|
| 365 | -emptyDList :: DList a
|
|
| 366 | -emptyDList = DList id
|
|
| 367 | - |
|
| 368 | -snoc :: DList a -> a -> DList a
|
|
| 369 | -snoc (DList f) x = DList (f . (x:))
|
|
| 370 | - |
|
| 371 | -dlistToList :: DList a -> [a]
|
|
| 372 | -dlistToList (DList f) = f [] |
| ... | ... | @@ -249,10 +249,6 @@ The supported transformers are listed below: |
| 249 | 249 | <tr>
|
| 250 | 250 | <td><code>profiled_ghc</code></td>
|
| 251 | 251 | <td>Build the GHC executable with cost-centre profiling support.
|
| 252 | - It is recommended that you use this in conjunction with `no_dynamic_ghc` since
|
|
| 253 | - GHC does not support loading of profiled libraries with the
|
|
| 254 | - dynamic linker. You should use a flavour that builds profiling libs and rts,
|
|
| 255 | - i.e. not <code>quick</code>. <br>
|
|
| 256 | 252 | This flag adds cost centres with the -fprof-late flag.</td>
|
| 257 | 253 | </tr>
|
| 258 | 254 | <tr>
|
| ... | ... | @@ -274,6 +270,10 @@ The supported transformers are listed below: |
| 274 | 270 | <td><code>text_simdutf</code></td>
|
| 275 | 271 | <td>Enable building the <code>text</code> package with <code>simdutf</code> support.</td>
|
| 276 | 272 | </tr>
|
| 273 | + <tr>
|
|
| 274 | + <td><code>with_profiled_libs</code></td>
|
|
| 275 | + <td>Enables building of stage1+ libraries and the RTS in profiled build ways (the opposite of <code>no_profiled_libs</code>).</td>
|
|
| 276 | + </tr>
|
|
| 277 | 277 | <tr>
|
| 278 | 278 | <td><code>no_profiled_libs</code></td>
|
| 279 | 279 | <td>Disables building of libraries in profiled build ways.</td>
|
| ... | ... | @@ -15,6 +15,7 @@ module Flavour |
| 15 | 15 | , enableProfiledGhc
|
| 16 | 16 | , disableDynamicGhcPrograms
|
| 17 | 17 | , disableDynamicLibs
|
| 18 | + , enableProfiledLibs
|
|
| 18 | 19 | , disableProfiledLibs
|
| 19 | 20 | , enableLinting
|
| 20 | 21 | , enableHaddock
|
| ... | ... | @@ -62,6 +63,7 @@ flavourTransformers = M.fromList |
| 62 | 63 | , "no_dynamic_libs" =: disableDynamicLibs
|
| 63 | 64 | , "native_bignum" =: useNativeBignum
|
| 64 | 65 | , "text_simdutf" =: enableTextWithSIMDUTF
|
| 66 | + , "with_profiled_libs" =: enableProfiledLibs
|
|
| 65 | 67 | , "no_profiled_libs" =: disableProfiledLibs
|
| 66 | 68 | , "omit_pragmas" =: omitPragmas
|
| 67 | 69 | , "ipe" =: enableIPE
|
| ... | ... | @@ -169,6 +171,7 @@ enableDebugInfo :: Flavour -> Flavour |
| 169 | 171 | enableDebugInfo = addArgs $ notStage0 ? mconcat
|
| 170 | 172 | [ builder (Ghc CompileHs) ? pure ["-g3"]
|
| 171 | 173 | , builder (Ghc CompileCWithGhc) ? pure ["-optc-g3"]
|
| 174 | + , builder (Ghc CompileCppWithGhc) ? pure ["-optcxx-g3"]
|
|
| 172 | 175 | , builder (Cc CompileC) ? arg "-g3"
|
| 173 | 176 | , builder (Cabal Setup) ? arg "--disable-library-stripping"
|
| 174 | 177 | , builder (Cabal Setup) ? arg "--disable-executable-stripping"
|
| ... | ... | @@ -307,29 +310,11 @@ enableUBSan = |
| 307 | 310 | viaLlvmBackend :: Flavour -> Flavour
|
| 308 | 311 | viaLlvmBackend = addArgs $ notStage0 ? builder Ghc ? arg "-fllvm"
|
| 309 | 312 | |
| 310 | --- | Build the GHC executable with profiling enabled in stages 2 and later. It
|
|
| 311 | --- is also recommended that you use this with @'dynamicGhcPrograms' = False@
|
|
| 312 | --- since GHC does not support loading of profiled libraries with the
|
|
| 313 | --- dynamically-linker.
|
|
| 313 | +-- | Build the GHC executable with profiling enabled in stages 2 and
|
|
| 314 | +-- later.
|
|
| 314 | 315 | enableProfiledGhc :: Flavour -> Flavour
|
| 315 | 316 | enableProfiledGhc flavour =
|
| 316 | - enableLateCCS flavour
|
|
| 317 | - { rtsWays = do
|
|
| 318 | - ws <- rtsWays flavour
|
|
| 319 | - mconcat
|
|
| 320 | - [ pure ws
|
|
| 321 | - , buildingCompilerStage' (>= Stage2) ? pure (foldMap profiled_ways ws)
|
|
| 322 | - ]
|
|
| 323 | - , libraryWays = mconcat
|
|
| 324 | - [ libraryWays flavour
|
|
| 325 | - , buildingCompilerStage' (>= Stage2) ? pure (Set.singleton profiling)
|
|
| 326 | - ]
|
|
| 327 | - , ghcProfiled = (>= Stage2)
|
|
| 328 | - }
|
|
| 329 | - where
|
|
| 330 | - profiled_ways w
|
|
| 331 | - | wayUnit Dynamic w = Set.empty
|
|
| 332 | - | otherwise = Set.singleton (w <> profiling)
|
|
| 317 | + enableLateCCS $ enableProfiledLibs flavour { ghcProfiled = (>= Stage2) }
|
|
| 333 | 318 | |
| 334 | 319 | -- | Disable 'dynamicGhcPrograms'.
|
| 335 | 320 | disableDynamicGhcPrograms :: Flavour -> Flavour
|
| ... | ... | @@ -346,6 +331,20 @@ disableDynamicLibs flavour = |
| 346 | 331 | prune :: Ways -> Ways
|
| 347 | 332 | prune = fmap $ Set.filter (not . wayUnit Dynamic)
|
| 348 | 333 | |
| 334 | +-- | Build libraries and the RTS in profiled ways (opposite of
|
|
| 335 | +-- 'disableProfiledLibs').
|
|
| 336 | +enableProfiledLibs :: Flavour -> Flavour
|
|
| 337 | +enableProfiledLibs flavour =
|
|
| 338 | + flavour
|
|
| 339 | + { libraryWays = addProfilingWays $ libraryWays flavour,
|
|
| 340 | + rtsWays = addProfilingWays $ rtsWays flavour
|
|
| 341 | + }
|
|
| 342 | + where
|
|
| 343 | + addProfilingWays :: Ways -> Ways
|
|
| 344 | + addProfilingWays ways = do
|
|
| 345 | + ws <- ways
|
|
| 346 | + buildProfiled <- notStage0
|
|
| 347 | + pure $ if buildProfiled then ws <> Set.map (<> profiling) ws else ws
|
|
| 349 | 348 | |
| 350 | 349 | -- | Don't build libraries in profiled 'Way's.
|
| 351 | 350 | disableProfiledLibs :: Flavour -> Flavour
|
| ... | ... | @@ -351,7 +351,7 @@ rtsPackageArgs = package rts ? do |
| 351 | 351 | , Debug `wayUnit` way ? pure [ "-DDEBUG"
|
| 352 | 352 | , "-fno-omit-frame-pointer"
|
| 353 | 353 | , "-g3"
|
| 354 | - , "-O0" ]
|
|
| 354 | + , "-Og" ]
|
|
| 355 | 355 | -- Set the namespace for the rts fs functions
|
| 356 | 356 | , arg $ "-DFS_NAMESPACE=rts"
|
| 357 | 357 |
| ... | ... | @@ -75,7 +75,7 @@ static void sortInitFiniList(struct InitFiniList **slist, enum SortOrder order) |
| 75 | 75 | while (*last != NULL && (*last)->next != NULL) {
|
| 76 | 76 | struct InitFiniList *s0 = *last;
|
| 77 | 77 | struct InitFiniList *s1 = s0->next;
|
| 78 | - bool flip;
|
|
| 78 | + bool flip = false;
|
|
| 79 | 79 | switch (order) {
|
| 80 | 80 | case INCREASING: flip = s0->priority > s1->priority; break;
|
| 81 | 81 | case DECREASING: flip = s0->priority < s1->priority; break;
|
| ... | ... | @@ -692,7 +692,7 @@ checkCompactObjects(bdescr *bd) |
| 692 | 692 | ASSERT((W_)str == (W_)block + sizeof(StgCompactNFDataBlock));
|
| 693 | 693 | |
| 694 | 694 | StgWord totalW = 0;
|
| 695 | - StgCompactNFDataBlock *last;
|
|
| 695 | + StgCompactNFDataBlock *last = block;
|
|
| 696 | 696 | for ( ; block ; block = block->next) {
|
| 697 | 697 | last = block;
|
| 698 | 698 | ASSERT(block->owner == str);
|