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

Commits:

2 changed files:

Changes:

  • .gitlab/merge_request_templates/Default.md
    1
    +
    
    2
    +<!--
    
    1 3
     Thank you for your contribution to GHC!
    
    2 4
     
    
    3
    -**Please read the checklist below to make sure your contribution fulfills these
    
    4
    -expectations. Also please answer the following question in your MR description:**
    
    5
    -
    
    6
    -**Where is the key part of this patch? That is, what should reviewers look at first?**
    
    7
    -
    
    8
    -Please take a few moments to address the following points:
    
    9
    -
    
    10
    - * [ ] if your MR touches `base` (or touches parts of `ghc-internal` used
    
    11
    -   or re-exported by `base`) more substantially than just amending comments
    
    12
    -   or documentation, you likely need to raise a
    
    13
    -   [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package)
    
    14
    -   before merging it.
    
    15
    - * [ ] if your MR may break existing programs (e.g. causes the
    
    16
    -   compiler to reject programs), please describe the expected breakage and add
    
    17
    -   the ~"user-facing" label. This will run ghc/head.hackage> to characterise
    
    18
    -   the effect of your change on Hackage.
    
    19
    - * [ ] ensure that your commits are either individually buildable or squashed
    
    20
    - * [ ] ensure that your commit messages describe *what they do*
    
    21
    -   (referring to tickets using `#NNNN` syntax when appropriate)
    
    22
    - * [ ] have added source comments describing your change. For larger changes you
    
    23
    -   likely should add a [Note][notes] and cross-reference it from the relevant
    
    24
    -   places.
    
    25
    - * [ ] add a [testcase to the testsuite][adding test].
    
    26
    - * [ ] updates the users guide if applicable
    
    27
    - * [ ] add a changelog entry in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
    
    28
    -   If this MR does not need a changelog entry, apply the ~"no-changelog" label.
    
    5
    +Please read the checklist below to make sure your contribution fulfills these
    
    6
    +expectations.
    
    29 7
     
    
    30 8
     If you have any questions don't hesitate to open your merge request and inquire
    
    31 9
     in a comment. If your patch isn't quite done yet please do add prefix your MR
    
    32
    -title with `WIP:`.
    
    10
    +title with Draft:
    
    11
    +
    
    12
    +To make your contribution experience as smooth as possible, also check out
    
    13
    +https://gitlab.haskell.org/ghc/ghc/-/wikis/Contributing-a-Patch
    
    14
    +--> 
    
    15
    +
    
    16
    +## Changes contained in this patch
    
    17
    +<!-- Where is the key part of this patch? That is, what should reviewers look at first? -->
    
    18
    +
    
    19
    +
    
    20
    +## MR Checklist
    
    21
    +<!-- Please take a few moments to address the following points: -->
    
    22
    +
    
    23
    +- [ ] This MR solves the problem described in the following issue: <!-- issue number here (please open a new issue if there isn't one) -->
    
    24
    +- [ ] A changelog entry was added in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
    
    25
    +      If this MR does not need a changelog entry, the ~"no-changelog" label was applied.
    
    26
    +- [ ] This MR does not make any significant changes to `base`, or it has an accompanying [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package).
    
    27
    +- [ ] If this MR has the potential to break user programs, the ~"user-facing" label was applied to 
    
    28
    +      test against head.hackage.
    
    29
    +- [ ] All commits are either individually buildable or squashed.
    
    30
    +- [ ] Commit messages describe *what they do*, referring to tickets using `#NNNNN` syntax.
    
    31
    +- [ ] Source comments describing the change were added. For larger changes [notes][notes] and 
    
    32
    +      cross-references from the relevant places were added (as applicable).
    
    33
    +- [ ] [Testcases to the testsuite][adding test] were added (as applicable).
    
    34
    +- [ ] The users guide was updated (as applicable).
    
    33 35
     
    
    36
    +<!--
    
    34 37
     By default a minimal validation pipeline is run on each merge request, the ~full-ci
    
    35 38
     label can be applied to perform additional validation checks if your MR affects a more
    
    36 39
     unusual configuration.
    
    37 40
     
    
    38
    -Once your change is ready please remove the `WIP:` tag and wait for review. If
    
    41
    +Once your change is ready please remove the `Draft:` tag and wait for review. If
    
    39 42
     no one has offered a review in a few days then please leave a comment mentioning
    
    40 43
     @triagers and apply the ~"Blocked on Review" label.
    
    44
    +-->
    
    41 45
     
    
    42 46
     [notes]: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/coding-style#comments-in-the-source-code
    
    43 47
     [adding test]: https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding
    

  • compiler/GHC/Data/FastString.hs
    ... ... @@ -139,6 +139,7 @@ import Foreign.C
    139 139
     import System.IO
    
    140 140
     import Data.Data
    
    141 141
     import Data.IORef
    
    142
    +import qualified Data.List.NonEmpty as NE
    
    142 143
     import Data.Semigroup as Semi
    
    143 144
     
    
    144 145
     import Foreign
    
    ... ... @@ -232,6 +233,7 @@ instance IsString FastString where
    232 233
     
    
    233 234
     instance Semi.Semigroup FastString where
    
    234 235
         (<>) = appendFS
    
    236
    +    sconcat = concatFS . NE.toList
    
    235 237
     
    
    236 238
     instance Monoid FastString where
    
    237 239
         mempty = nilFS
    
    ... ... @@ -619,6 +621,42 @@ unpackFS fs = utf8DecodeShortByteString $ fs_sbs fs
    619 621
     zEncodeFS :: FastString -> FastZString
    
    620 622
     zEncodeFS fs = fs_zenc fs
    
    621 623
     
    
    624
    +-- Sometimes an `appendFS` operand is temporarily constructed, and we
    
    625
    +-- should avoid retaining the unused `FastString` operand in the
    
    626
    +-- table. The RULES below mitigate the issue by concatenating the
    
    627
    +-- `ShortByteString`s instead when an operand is `fsLit` or
    
    628
    +-- `mkFastString`, which cover most such `appendFS` use cases. See
    
    629
    +-- #27205.
    
    630
    +
    
    631
    +{-# RULES
    
    632
    +"appendFS/fsLit y" forall x y.
    
    633
    +  appendFS x (fsLit y) =
    
    634
    +    mkFastStringShortByteString $
    
    635
    +      fs_sbs x Semi.<> utf8EncodeShortByteString y
    
    636
    +  #-}
    
    637
    +
    
    638
    +{-# RULES
    
    639
    +"appendFS/fsLit x" forall x y.
    
    640
    +  appendFS (fsLit x) y =
    
    641
    +    mkFastStringShortByteString $
    
    642
    +      utf8EncodeShortByteString x Semi.<> fs_sbs y
    
    643
    +  #-}
    
    644
    +
    
    645
    +{-# RULES
    
    646
    +"appendFS/mkFastString y" forall x y.
    
    647
    +  appendFS x (mkFastString y) =
    
    648
    +    mkFastStringShortByteString $
    
    649
    +      fs_sbs x Semi.<> utf8EncodeShortByteString y
    
    650
    +  #-}
    
    651
    +
    
    652
    +{-# RULES
    
    653
    +"appendFS/mkFastString x" forall x y.
    
    654
    +  appendFS (mkFastString x) y =
    
    655
    +    mkFastStringShortByteString $
    
    656
    +      utf8EncodeShortByteString x Semi.<> fs_sbs y
    
    657
    +  #-}
    
    658
    +
    
    659
    +{-# INLINE[1] appendFS #-}
    
    622 660
     appendFS :: FastString -> FastString -> FastString
    
    623 661
     appendFS fs1 fs2 = mkFastStringShortByteString
    
    624 662
                      $ (Semi.<>) (fs_sbs fs1) (fs_sbs fs2)