Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC

Commits:

13 changed files:

Changes:

  • .gitlab/ci.sh
    ... ... @@ -8,7 +8,7 @@ set -Eeuo pipefail
    8 8
     
    
    9 9
     # Configuration:
    
    10 10
     # N.B. You may want to also update the index-state in hadrian/cabal.project.
    
    11
    -HACKAGE_INDEX_STATE="2025-01-27T17:45:32Z"
    
    11
    +HACKAGE_INDEX_STATE="2025-12-19T19:24:24Z"
    
    12 12
     MIN_HAPPY_VERSION="1.20"
    
    13 13
     MIN_ALEX_VERSION="3.2.6"
    
    14 14
     
    

  • hadrian/cabal.project
    ... ... @@ -4,11 +4,11 @@ packages: ./
    4 4
     
    
    5 5
     -- This essentially freezes the build plan for hadrian
    
    6 6
     -- It would be wise to keep this up to date with the state set in .gitlab/ci.sh.
    
    7
    -index-state: 2025-01-27T17:45:32Z
    
    7
    +index-state: 2025-12-19T19:24:24Z
    
    8 8
     
    
    9
    --- unordered-containers-0.2.20-r1 requires template-haskell < 2.22
    
    10
    --- ghc-9.10 has template-haskell-2.22.0.0
    
    11
    -allow-newer: unordered-containers:template-haskell
    
    9
    +-- Fixes bootstrapping with ghc-9.14
    
    10
    +allow-newer: all:base, all:ghc-bignum, all:template-haskell
    
    11
    +constraints: hashable >= 1.5.0.0
    
    12 12
     
    
    13 13
     -- N.B. Compile with -O0 since this is not a performance-critical executable
    
    14 14
     -- and the Cabal takes nearly twice as long to build with -O1. See #16817.
    

  • hadrian/src/Settings/Builders/RunTest.hs
    ... ... @@ -47,12 +47,20 @@ runTestGhcFlags = do
    47 47
                                then "-optc-fno-builtin"
    
    48 48
                                else ""
    
    49 49
     
    
    50
    +    -- Also pass -keep-tmp-files to GHC when --keep-test-files is
    
    51
    +    -- passed to hadrian for debugging purpose (#26688)
    
    52
    +    keepFiles <- testKeepFiles <$> userSetting defaultTestArgs
    
    53
    +    let keepTmpFilesFlag
    
    54
    +          | keepFiles = "-keep-tmp-files"
    
    55
    +          | otherwise = ""
    
    56
    +
    
    50 57
         -- Take flags to send to the Haskell compiler from test.mk.
    
    51 58
         -- See: https://github.com/ghc/ghc/blob/master/testsuite/mk/test.mk#L37
    
    52 59
         unwords <$> sequence
    
    53 60
             [ pure " -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -fno-dump-with-ways -fprint-error-index-links=never -rtsopts"
    
    54 61
             , pure ghcOpts
    
    55 62
             , pure ghcExtraFlags
    
    63
    +        , pure keepTmpFilesFlag
    
    56 64
             , ifMinGhcVer "711" "-fno-warn-missed-specialisations"
    
    57 65
             , ifMinGhcVer "711" "-fshow-warning-groups"
    
    58 66
             , ifMinGhcVer "801" "-fdiagnostics-color=never"
    

  • libraries/base/changelog.md
    1 1
     # Changelog for [`base` package](http://hackage.haskell.org/package/base)
    
    2 2
     
    
    3 3
     ## 4.23.0.0 *TBA*
    
    4
    +  * Add `System.IO.hGetNewlineMode`. ([CLC proposal #370](https://github.com/haskell/core-libraries-committee/issues/370))
    
    4 5
       * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{init,last}`.
    
    5 6
         Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it.
    
    6 7
         ([CLC proposal #87](https://github.com/haskell/core-libraries-committee/issues/292))
    

  • libraries/base/src/System/IO.hs
    ... ... @@ -175,6 +175,7 @@ module System.IO
    175 175
          -- Binary-mode 'Handle's do no newline translation at all.
    
    176 176
     
    
    177 177
          hSetNewlineMode,
    
    178
    +     hGetNewlineMode,
    
    178 179
          Newline(..),
    
    179 180
          nativeNewline,
    
    180 181
          NewlineMode(..),
    

  • libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
    ... ... @@ -40,7 +40,7 @@ module GHC.Internal.IO.Handle (
    40 40
        hIsOpen, hIsClosed, hIsReadable, hIsWritable, hGetBuffering, hIsSeekable,
    
    41 41
        hSetEcho, hGetEcho, hIsTerminalDevice,
    
    42 42
     
    
    43
    -   hSetNewlineMode, Newline(..), NewlineMode(..), nativeNewline,
    
    43
    +   hSetNewlineMode, hGetNewlineMode, Newline(..), NewlineMode(..), nativeNewline,
    
    44 44
        noNewlineTranslation, universalNewlineMode, nativeNewlineMode,
    
    45 45
     
    
    46 46
        hShow,
    
    ... ... @@ -238,7 +238,7 @@ hSetBuffering handle mode =
    238 238
               return Handle__{ haBufferMode = mode,.. }
    
    239 239
     
    
    240 240
     -- -----------------------------------------------------------------------------
    
    241
    --- hSetEncoding
    
    241
    +-- Setting and getting the text encoding
    
    242 242
     
    
    243 243
     -- | The action 'hSetEncoding' @hdl@ @encoding@ changes the text encoding
    
    244 244
     -- for the handle @hdl@ to @encoding@.  The default encoding when a 'Handle' is
    
    ... ... @@ -624,16 +624,24 @@ hSetBinaryMode handle bin =
    624 624
                               haOutputNL = outputNL nl, .. }
    
    625 625
     
    
    626 626
     -- -----------------------------------------------------------------------------
    
    627
    --- hSetNewlineMode
    
    627
    +-- Setting and getting the newline mode
    
    628 628
     
    
    629
    --- | Set the 'NewlineMode' on the specified 'Handle'.  All buffered
    
    629
    +-- | Set the 'NewlineMode' for the specified 'Handle'.  All buffered
    
    630 630
     -- data is flushed first.
    
    631 631
     hSetNewlineMode :: Handle -> NewlineMode -> IO ()
    
    632
    -hSetNewlineMode handle NewlineMode{ inputNL=i, outputNL=o } =
    
    632
    +hSetNewlineMode handle NewlineMode{..} =
    
    633 633
       withAllHandles__ "hSetNewlineMode" handle $ \h_@Handle__{} ->
    
    634 634
         do
    
    635 635
              flushBuffer h_
    
    636
    -         return h_{ haInputNL=i, haOutputNL=o }
    
    636
    +         return h_{ haInputNL = inputNL, haOutputNL = outputNL }
    
    637
    +
    
    638
    +-- | Return the current 'NewlineMode' for the specified 'Handle'.
    
    639
    +--
    
    640
    +-- @since 4.23.0.0
    
    641
    +hGetNewlineMode :: Handle -> IO NewlineMode
    
    642
    +hGetNewlineMode hdl =
    
    643
    +  withHandle_ "hGetNewlineMode" hdl $ \h_@Handle__{..} ->
    
    644
    +    return NewlineMode{ inputNL = haInputNL, outputNL = haOutputNL }
    
    637 645
     
    
    638 646
     -- -----------------------------------------------------------------------------
    
    639 647
     -- Duplicating a Handle
    

  • libraries/ghc-internal/src/GHC/Internal/System/IO.hs
    ... ... @@ -214,6 +214,7 @@ module GHC.Internal.System.IO (
    214 214
         -- Binary-mode 'Handle's do no newline translation at all.
    
    215 215
         --
    
    216 216
         hSetNewlineMode,
    
    217
    +    hGetNewlineMode,
    
    217 218
         Newline(..), nativeNewline,
    
    218 219
         NewlineMode(..),
    
    219 220
         noNewlineTranslation, universalNewlineMode, nativeNewlineMode,
    

  • rts/PrimOps.cmm
    ... ... @@ -204,12 +204,47 @@ stg_isMutableByteArrayWeaklyPinnedzh ( gcptr mba )
    204 204
     stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size )
    
    205 205
     // MutableByteArray# s -> Int# -> State# s -> State# s
    
    206 206
     {
    
    207
    -   ASSERT(new_size <= StgArrBytes_bytes(mba));
    
    207
    +   W_ old_size, old_wds, new_wds;
    
    208
    +   W_ bd;
    
    209
    +
    
    210
    +   old_size = StgArrBytes_bytes(mba);
    
    211
    +   ASSERT(new_size <= old_size);
    
    212
    +   old_wds = BYTES_TO_WDS(SIZEOF_StgArrBytes) + ROUNDUP_BYTES_TO_WDS(old_size);
    
    213
    +   new_wds = BYTES_TO_WDS(SIZEOF_StgArrBytes) + ROUNDUP_BYTES_TO_WDS(new_size);
    
    214
    +
    
    215
    +   // Try to shrink bd->free as well, to reclaim slop space at the end
    
    216
    +   // of current block and avoid unnecessary fragmentation. But we
    
    217
    +   // must guarantee that:
    
    218
    +   //
    
    219
    +   // 1. mba is already at the end of current block (check bd->free).
    
    220
    +   //    Otherwise we can't move closures that come after it anyway.
    
    221
    +   // 2. It's a nursery block that belongs to the current Capability,
    
    222
    +   //    so check rCurrentAlloc (used by allocateMightFail) or
    
    223
    +   //    pinned_object_block (used by allocatePinned). There's also no
    
    224
    +   //    point if it's an older generation block, the mutator won't
    
    225
    +   //    allocate into those blocks anyway.
    
    226
    +   //
    
    227
    +   // If check fails, fall back to the conservative code path: just
    
    228
    +   // zero the slop and return.
    
    229
    +   bd = Bdescr(mba);
    
    230
    +   if (bdescr_free(bd) != mba + WDS(old_wds) ||
    
    231
    +       (bd != StgRegTable_rCurrentAlloc(BaseReg) && bd != Capability_pinned_object_block(MyCapability()))) {
    
    232
    +       OVERWRITING_CLOSURE_MUTABLE(mba, new_wds);
    
    233
    +       StgArrBytes_bytes(mba) = new_size;
    
    234
    +       // No need to call PROF_HEADER_CREATE. See Note [LDV profiling and resizing arrays]
    
    235
    +       return ();
    
    236
    +   }
    
    208 237
     
    
    209
    -   OVERWRITING_CLOSURE_MUTABLE(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
    
    210
    -                                     ROUNDUP_BYTES_TO_WDS(new_size)));
    
    238
    +   // Check passes, we can shrink bd->free! Also uninitialize the slop
    
    239
    +   // if zero_on_gc is enabled, to conform with debug RTS convention.
    
    211 240
        StgArrBytes_bytes(mba) = new_size;
    
    212
    -   // No need to call PROF_HEADER_CREATE. See Note [LDV profiling and resizing arrays]
    
    241
    +   IF_DEBUG(zero_on_gc,
    
    242
    +       prim %memset(mba + WDS(new_wds),
    
    243
    +                    0xaa,
    
    244
    +                    WDS(old_wds - new_wds),
    
    245
    +                    1);
    
    246
    +   );
    
    247
    +   bdescr_free(bd) = mba + WDS(new_wds);
    
    213 248
     
    
    214 249
        return ();
    
    215 250
     }
    
    ... ... @@ -223,18 +258,10 @@ stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size )
    223 258
     stg_resizzeMutableByteArrayzh ( gcptr mba, W_ new_size )
    
    224 259
     // MutableByteArray# s -> Int# -> State# s -> (# State# s,MutableByteArray# s #)
    
    225 260
     {
    
    226
    -   W_ new_size_wds;
    
    227
    -
    
    228
    -   ASSERT(new_size >= 0);
    
    229
    -
    
    230
    -   new_size_wds = ROUNDUP_BYTES_TO_WDS(new_size);
    
    231
    -
    
    232
    -   if (new_size_wds <= BYTE_ARR_WDS(mba)) {
    
    233
    -      OVERWRITING_CLOSURE_MUTABLE(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
    
    234
    -                                        new_size_wds));
    
    235
    -      StgArrBytes_bytes(mba) = new_size;
    
    236
    -      // No need to call PROF_HEADER_CREATE. See Note [LDV profiling and resizing arrays]
    
    261
    +   ASSERT(new_size `ge` 0);
    
    237 262
     
    
    263
    +   if (new_size <= StgArrBytes_bytes(mba)) {
    
    264
    +      call stg_shrinkMutableByteArrayzh(mba, new_size);
    
    238 265
           return (mba);
    
    239 266
        } else {
    
    240 267
           (P_ new_mba) = call stg_newByteArrayzh(new_size);
    

  • testsuite/tests/interface-stability/base-exports.stdout
    ... ... @@ -10263,6 +10263,7 @@ module System.IO where
    10263 10263
       hGetEcho :: Handle -> IO GHC.Internal.Types.Bool
    
    10264 10264
       hGetEncoding :: Handle -> IO (GHC.Internal.Maybe.Maybe TextEncoding)
    
    10265 10265
       hGetLine :: Handle -> IO GHC.Internal.Base.String
    
    10266
    +  hGetNewlineMode :: Handle -> IO NewlineMode
    
    10266 10267
       hGetPosn :: Handle -> IO HandlePosn
    
    10267 10268
       hIsClosed :: Handle -> IO GHC.Internal.Types.Bool
    
    10268 10269
       hIsEOF :: Handle -> IO GHC.Internal.Types.Bool
    

  • testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
    ... ... @@ -13309,6 +13309,7 @@ module System.IO where
    13309 13309
       hGetEcho :: Handle -> IO GHC.Internal.Types.Bool
    
    13310 13310
       hGetEncoding :: Handle -> IO (GHC.Internal.Maybe.Maybe TextEncoding)
    
    13311 13311
       hGetLine :: Handle -> IO GHC.Internal.Base.String
    
    13312
    +  hGetNewlineMode :: Handle -> IO NewlineMode
    
    13312 13313
       hGetPosn :: Handle -> IO HandlePosn
    
    13313 13314
       hIsClosed :: Handle -> IO GHC.Internal.Types.Bool
    
    13314 13315
       hIsEOF :: Handle -> IO GHC.Internal.Types.Bool
    

  • testsuite/tests/interface-stability/base-exports.stdout-mingw32
    ... ... @@ -10543,6 +10543,7 @@ module System.IO where
    10543 10543
       hGetEcho :: Handle -> IO GHC.Internal.Types.Bool
    
    10544 10544
       hGetEncoding :: Handle -> IO (GHC.Internal.Maybe.Maybe TextEncoding)
    
    10545 10545
       hGetLine :: Handle -> IO GHC.Internal.Base.String
    
    10546
    +  hGetNewlineMode :: Handle -> IO NewlineMode
    
    10546 10547
       hGetPosn :: Handle -> IO HandlePosn
    
    10547 10548
       hIsClosed :: Handle -> IO GHC.Internal.Types.Bool
    
    10548 10549
       hIsEOF :: Handle -> IO GHC.Internal.Types.Bool
    

  • testsuite/tests/interface-stability/base-exports.stdout-ws-32
    ... ... @@ -10263,6 +10263,7 @@ module System.IO where
    10263 10263
       hGetEcho :: Handle -> IO GHC.Internal.Types.Bool
    
    10264 10264
       hGetEncoding :: Handle -> IO (GHC.Internal.Maybe.Maybe TextEncoding)
    
    10265 10265
       hGetLine :: Handle -> IO GHC.Internal.Base.String
    
    10266
    +  hGetNewlineMode :: Handle -> IO NewlineMode
    
    10266 10267
       hGetPosn :: Handle -> IO HandlePosn
    
    10267 10268
       hIsClosed :: Handle -> IO GHC.Internal.Types.Bool
    
    10268 10269
       hIsEOF :: Handle -> IO GHC.Internal.Types.Bool
    

  • utils/deriveConstants/Main.hs
    ... ... @@ -395,6 +395,7 @@ wanteds os = concat
    395 395
               ,fieldOffset Both "StgRegTable" "rCurrentTSO"
    
    396 396
               ,fieldOffset Both "StgRegTable" "rCurrentNursery"
    
    397 397
               ,fieldOffset Both "StgRegTable" "rHpAlloc"
    
    398
    +          ,structField C    "StgRegTable" "rCurrentAlloc"
    
    398 399
               ,structField C    "StgRegTable" "rRet"
    
    399 400
               ,structField C    "StgRegTable" "rNursery"
    
    400 401
     
    
    ... ... @@ -414,6 +415,7 @@ wanteds os = concat
    414 415
               ,structField C    "Capability" "weak_ptr_list_hd"
    
    415 416
               ,structField C    "Capability" "weak_ptr_list_tl"
    
    416 417
               ,structField C    "Capability" "n_run_queue"
    
    418
    +          ,structField C    "Capability" "pinned_object_block"
    
    417 419
     
    
    418 420
               ,structField Both "bdescr" "start"
    
    419 421
               ,structField Both "bdescr" "free"
    
    ... ... @@ -629,6 +631,8 @@ wanteds os = concat
    629 631
                               "RTS_FLAGS" "DebugFlags.sanity"
    
    630 632
               ,structField_ C "RtsFlags_DebugFlags_weak"
    
    631 633
                               "RTS_FLAGS" "DebugFlags.weak"
    
    634
    +          ,structField_ C "RtsFlags_DebugFlags_zero_on_gc"
    
    635
    +                          "RTS_FLAGS" "DebugFlags.zero_on_gc"
    
    632 636
               ,structField_ C "RtsFlags_GcFlags_initialStkSize"
    
    633 637
                               "RTS_FLAGS" "GcFlags.initialStkSize"
    
    634 638
               ,structField_ C "RtsFlags_MiscFlags_tickInterval"