Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ghc/ghc
  • bgamari/ghc
  • syd/ghc
  • ggreif/ghc
  • watashi/ghc
  • RolandSenn/ghc
  • mpickering/ghc
  • DavidEichmann/ghc
  • carter/ghc
  • harpocrates/ghc
  • ethercrow/ghc
  • mijicd/ghc
  • adamse/ghc
  • alexbiehl/ghc
  • gridaphobe/ghc
  • trofi/ghc
  • supersven/ghc
  • ppk/ghc
  • ulysses4ever/ghc
  • AndreasK/ghc
  • ghuntley/ghc
  • shayne-fletcher-da/ghc
  • fgaz/ghc
  • yav/ghc
  • osa1/ghc
  • mbbx6spp/ghc
  • JulianLeviston/ghc
  • reactormonk/ghc
  • rae/ghc
  • takenobu-hs/ghc
  • michalt/ghc
  • andrewthad/ghc
  • hsyl20/ghc
  • scottgw/ghc
  • sjakobi/ghc
  • angerman/ghc
  • RyanGlScott/ghc
  • hvr/ghc
  • howtonotwin/ghc
  • chessai/ghc
  • m-renaud/ghc
  • brprice/ghc
  • stevehartdata/ghc
  • sighingnow/ghc
  • kgardas/ghc
  • ckoparkar/ghc
  • alp/ghc
  • smaeul/ghc
  • kakkun61/ghc
  • sykloid/ghc
  • newhoggy/ghc
  • toonn/ghc
  • nineonine/ghc
  • Phyx/ghc
  • ezyang/ghc
  • tweag/ghc
  • langston/ghc
  • ndmitchell/ghc
  • rockbmb/ghc
  • artempyanykh/ghc
  • mniip/ghc
  • mynguyenbmc/ghc
  • alexfmpe/ghc
  • crockeea/ghc
  • nh2/ghc
  • vaibhavsagar/ghc
  • phadej/ghc
  • Haskell-mouse/ghc
  • lolotp/ghc
  • spacekitteh/ghc
  • michaelpj/ghc
  • mgsloan/ghc
  • HPCohen/ghc
  • tmobile/ghc
  • radrow/ghc
  • simonmar/ghc
  • _deepfire/ghc
  • Ericson2314/ghc
  • leitao/ghc
  • fumieval/ghc
  • trac-isovector/ghc
  • cblp/ghc
  • xich/ghc
  • ciil/ghc
  • erthalion/ghc
  • xldenis/ghc
  • autotaker/ghc
  • haskell-wasm/ghc
  • kcsongor/ghc
  • agander/ghc
  • Baranowski/ghc
  • trac-dredozubov/ghc
  • 23Skidoo/ghc
  • iustin/ghc
  • ningning/ghc
  • josefs/ghc
  • kabuhr/ghc
  • gallais/ghc
  • dten/ghc
  • expipiplus1/ghc
  • Pluralia/ghc
  • rohanjr/ghc
  • intricate/ghc
  • kirelagin/ghc
  • Javran/ghc
  • DanielG/ghc
  • trac-mizunashi_mana/ghc
  • pparkkin/ghc
  • bollu/ghc
  • ntc2/ghc
  • jaspervdj/ghc
  • JoshMeredith/ghc
  • wz1000/ghc
  • zkourouma/ghc
  • code5hot/ghc
  • jdprice/ghc
  • tdammers/ghc
  • J-mie6/ghc
  • trac-lantti/ghc
  • ch1bo/ghc
  • cgohla/ghc
  • lucamolteni/ghc
  • acairncross/ghc
  • amerocu/ghc
  • chreekat/ghc
  • txsmith/ghc
  • trupill/ghc
  • typetetris/ghc
  • sergv/ghc
  • fryguybob/ghc
  • erikd/ghc
  • trac-roland/ghc
  • setupminimal/ghc
  • Friede80/ghc
  • SkyWriter/ghc
  • xplorld/ghc
  • abrar/ghc
  • obsidiansystems/ghc
  • Icelandjack/ghc
  • adinapoli/ghc
  • trac-matthewbauer/ghc
  • heatsink/ghc
  • dwijnand/ghc
  • Cmdv/ghc
  • alinab/ghc
  • pepeiborra/ghc
  • fommil/ghc
  • luochen1990/ghc
  • rlupton20/ghc
  • applePrincess/ghc
  • lehins/ghc
  • ronmrdechai/ghc
  • leeadam/ghc
  • harendra/ghc
  • mightymosquito1991/ghc
  • trac-gershomb/ghc
  • lucajulian/ghc
  • Rizary/ghc
  • VictorCMiraldo/ghc
  • jamesbrock/ghc
  • andrewdmeier/ghc
  • luke/ghc
  • pranaysashank/ghc
  • cocreature/ghc
  • hithroc/ghc
  • obreitwi/ghc
  • slrtbtfs/ghc
  • kaol/ghc
  • yairchu/ghc
  • Mathemagician98/ghc
  • trac-taylorfausak/ghc
  • leungbk/ghc
  • MichaWiedenmann/ghc
  • chris-martin/ghc
  • TDecki/ghc
  • adithyaov/ghc
  • trac-gelisam/ghc
  • Lysxia/ghc
  • complyue/ghc
  • bwignall/ghc
  • sternmull/ghc
  • sonika/ghc
  • leif/ghc
  • broadwaylamb/ghc
  • myszon/ghc
  • danbroooks/ghc
  • Mechachleopteryx/ghc
  • zardyh/ghc
  • trac-vdukhovni/ghc
  • OmarKhaledAbdo/ghc
  • arrowd/ghc
  • Bodigrim/ghc
  • matheus23/ghc
  • cardenaso11/ghc
  • trac-Athas/ghc
  • mb720/ghc
  • DylanZA/ghc
  • liff/ghc
  • typedrat/ghc
  • trac-claude/ghc
  • jbm/ghc
  • Gertjan423/ghc
  • PHO/ghc
  • JKTKops/ghc
  • kockahonza/ghc
  • msakai/ghc
  • Sir4ur0n/ghc
  • barambani/ghc
  • vishnu.c/ghc
  • dcoutts/ghc
  • trac-runeks/ghc
  • trac-MaxGabriel/ghc
  • lexi.lambda/ghc
  • strake/ghc
  • spavikevik/ghc
  • JakobBruenker/ghc
  • rmanne/ghc
  • gdziadkiewicz/ghc
  • ani/ghc
  • iliastsi/ghc
  • smunix/ghc
  • judah/ghc
  • blackgnezdo/ghc
  • emilypi/ghc
  • trac-bpfoley/ghc
  • muesli4/ghc
  • trac-gkaracha/ghc
  • Kleidukos/ghc
  • nek0/ghc
  • TristanCacqueray/ghc
  • dwulive/ghc
  • mbakke/ghc
  • arybczak/ghc
  • Yang123321/ghc
  • maksbotan/ghc
  • QuietMisdreavus/ghc
  • trac-olshanskydr/ghc
  • emekoi/ghc
  • samuela/ghc
  • josephcsible/ghc
  • dramforever/ghc
  • lpsmith/ghc
  • DenisFrezzato/ghc
  • michivi/ghc
  • jneira/ghc
  • jeffhappily/ghc
  • Ivan-Yudin/ghc
  • nakaji-dayo/ghc
  • gdevanla/ghc
  • galen/ghc
  • fendor/ghc
  • yaitskov/ghc
  • rcythr/ghc
  • awpr/ghc
  • jeremyschlatter/ghc
  • Aver1y/ghc
  • mitchellvitez/ghc
  • merijn/ghc
  • tomjaguarpaw1/ghc
  • trac-NoidedSuper/ghc
  • erewok/ghc
  • trac-junji.hashimoto/ghc
  • adamwespiser/ghc
  • bjaress/ghc
  • jhrcek/ghc
  • leonschoorl/ghc
  • lukasz-golebiewski/ghc
  • sheaf/ghc
  • last-g/ghc
  • carassius1014/ghc
  • eschwartz/ghc
  • dwincort/ghc
  • felixwiemuth/ghc
  • TimWSpence/ghc
  • marcusmonteirodesouza/ghc
  • WJWH/ghc
  • vtols/ghc
  • theobat/ghc
  • BinderDavid/ghc
  • ckoparkar0/ghc
  • alexander-kjeldaas/ghc
  • dme2/ghc
  • philderbeast/ghc
  • aaronallen8455/ghc
  • rayshih/ghc
  • benkard/ghc
  • mpardalos/ghc
  • saidelman/ghc
  • leiftw/ghc
  • ca333/ghc
  • bwroga/ghc
  • nmichael44/ghc
  • trac-crobbins/ghc
  • felixonmars/ghc
  • adityagupta1089/ghc
  • hgsipiere/ghc
  • treeowl/ghc
  • alexpeits/ghc
  • CraigFe/ghc
  • dnlkrgr/ghc
  • kerckhove_ts/ghc
  • cptwunderlich/ghc
  • eiais/ghc
  • hahohihu/ghc
  • sanchayan/ghc
  • lemmih/ghc
  • sehqlr/ghc
  • trac-dbeacham/ghc
  • luite/ghc
  • trac-f-a/ghc
  • vados/ghc
  • luntain/ghc
  • fatho/ghc
  • alexbiehl-gc/ghc
  • dcbdan/ghc
  • tvh/ghc
  • liam-ly/ghc
  • timbobbarnes/ghc
  • GovanifY/ghc
  • shanth2600/ghc
  • gliboc/ghc
  • duog/ghc
  • moxonsghost/ghc
  • zander/ghc
  • masaeedu/ghc
  • georgefst/ghc
  • guibou/ghc
  • nicuveo/ghc
  • mdebruijne/ghc
  • stjordanis/ghc
  • emiflake/ghc
  • wygulmage/ghc
  • frasertweedale/ghc
  • coot/ghc
  • aratamizuki/ghc
  • tsandstr/ghc
  • mrBliss/ghc
  • Anton-Latukha/ghc
  • tadfisher/ghc
  • vapourismo/ghc
  • Sorokin-Anton/ghc
  • basile-henry/ghc
  • trac-mightybyte/ghc
  • AbsoluteNikola/ghc
  • cobrien99/ghc
  • songzh/ghc
  • blamario/ghc
  • aj4ayushjain/ghc
  • trac-utdemir/ghc
  • tangcl/ghc
  • hdgarrood/ghc
  • maerwald/ghc
  • arjun/ghc
  • ratherforky/ghc
  • haskieLambda/ghc
  • EmilGedda/ghc
  • Bogicevic/ghc
  • eddiejessup/ghc
  • kozross/ghc
  • AlistairB/ghc
  • 3Rafal/ghc
  • christiaanb/ghc
  • trac-bit/ghc
  • matsumonkie/ghc
  • trac-parsonsmatt/ghc
  • chisui/ghc
  • jaro/ghc
  • trac-kmiyazato/ghc
  • davidsd/ghc
  • Tritlo/ghc
  • I-B-3/ghc
  • lykahb/ghc
  • AriFordsham/ghc
  • turion1/ghc
  • berberman/ghc
  • christiantakle/ghc
  • zyklotomic/ghc
  • trac-ocramz/ghc
  • CSEdd/ghc
  • doyougnu/ghc
  • mmhat/ghc
  • why-not-try-calmer/ghc
  • plutotulp/ghc
  • kjekac/ghc
  • Manvi07/ghc
  • teo/ghc
  • cactus/ghc
  • CarrieMY/ghc
  • abel/ghc
  • yihming/ghc
  • tsakki/ghc
  • jessicah/ghc
  • oliverbunting/ghc
  • meld/ghc
  • friedbrice/ghc
  • Joald/ghc
  • abarbu/ghc
  • DigitalBrains1/ghc
  • sterni/ghc
  • alexDarcy/ghc
  • hexchain/ghc
  • minimario/ghc
  • zliu41/ghc
  • tommd/ghc
  • jazcarate/ghc
  • peterbecich/ghc
  • alirezaghey/ghc
  • solomon/ghc
  • mikael.urankar/ghc
  • davjam/ghc
  • int-index/ghc
  • MorrowM/ghc
  • nrnrnr/ghc
  • Sonfamm/ghc-test-only
  • afzt1/ghc
  • nguyenhaibinh-tpc/ghc
  • trac-lierdakil/ghc
  • MichaWiedenmann1/ghc
  • jmorag/ghc
  • Ziharrk/ghc
  • trac-MitchellSalad/ghc
  • juampe/ghc
  • jwaldmann/ghc
  • snowleopard/ghc
  • juhp/ghc
  • normalcoder/ghc
  • ksqsf/ghc
  • trac-jberryman/ghc
  • roberth/ghc
  • 1ntEgr8/ghc
  • epworth/ghc
  • MrAdityaAlok/ghc
  • JunmingZhao42/ghc
  • jappeace/ghc
  • trac-Gabriel439/ghc
  • alt-romes/ghc
  • HugoPeters1024/ghc
  • 10ne1/ghc-fork
  • agentultra/ghc
  • Garfield1002/ghc
  • ChickenProp/ghc
  • clyring/ghc
  • MaxHearnden/ghc
  • jumper149/ghc
  • vem/ghc
  • ketzacoatl/ghc
  • Rosuavio/ghc
  • jackohughes/ghc
  • p4l1ly/ghc
  • konsumlamm/ghc
  • shlevy/ghc
  • torsten.schmits/ghc
  • andremarianiello/ghc
  • amesgen/ghc
  • googleson78/ghc
  • InfiniteVerma/ghc
  • uhbif19/ghc
  • yiyunliu/ghc
  • raehik/ghc
  • mrkun/ghc
  • telser/ghc
  • 1Jajen1/ghc
  • slotThe/ghc
  • WinstonHartnett/ghc
  • mpilgrem/ghc
  • dreamsmasher/ghc
  • schuelermine/ghc
  • trac-Viwor/ghc
  • undergroundquizscene/ghc
  • evertedsphere/ghc
  • coltenwebb/ghc
  • oberblastmeister/ghc
  • agrue/ghc
  • lf-/ghc
  • zacwood9/ghc
  • steshaw/ghc
  • high-cloud/ghc
  • SkamDart/ghc
  • PiDelport/ghc
  • maoif/ghc
  • RossPaterson/ghc
  • CharlesTaylor7/ghc
  • ribosomerocker/ghc
  • trac-ramirez7/ghc
  • daig/ghc
  • NicolasT/ghc
  • FinleyMcIlwaine/ghc
  • lawtonnichols/ghc
  • jmtd/ghc
  • ozkutuk/ghc
  • wildsebastian/ghc
  • nikshalark/ghc
  • lrzlin/ghc
  • tobias/ghc
  • fw/ghc
  • hawkinsw/ghc
  • type-dance/ghc
  • rui314/ghc
  • ocharles/ghc
  • wavewave/ghc
  • TheKK/ghc
  • nomeata/ghc
  • trac-csabahruska/ghc
  • jonathanjameswatson/ghc
  • L-as/ghc
  • Axman6/ghc
  • barracuda156/ghc
  • trac-jship/ghc
  • jake-87/ghc
  • meooow/ghc
  • rebeccat/ghc
  • hamana55/ghc
  • Enigmage/ghc
  • kokobd/ghc
  • agevelt/ghc
  • gshen42/ghc
  • chrismwendt/ghc
  • MangoIV/ghc
  • teto/ghc
  • Sookr1/ghc
  • trac-thomasjm/ghc
  • barci2/ghc-dev
  • trac-m4dc4p/ghc
  • dixonary/ghc
  • breakerzirconia/ghc
  • alexsio27444/ghc
  • glocq/ghc
  • sourabhxyz/ghc
  • ryantrinkle/ghc
  • Jade/ghc
  • scedfaliako/ghc
  • martijnbastiaan/ghc
  • trac-george.colpitts/ghc
  • ammarbinfaisal/ghc
  • mimi.vx/ghc
  • lortabac/ghc
  • trac-zyla/ghc
  • benbellick/ghc
  • aadaa-fgtaa/ghc
  • jvanbruegge/ghc
  • archbung/ghc
  • gilmi/ghc
  • mfonism/ghc
  • alex-mckenna/ghc
  • Ei30metry/ghc
  • DiegoDiverio/ghc
  • jorgecunhamendes/ghc
  • liesnikov/ghc
  • akrmn/ghc
  • trac-simplifierticks/ghc
  • jacco/ghc
  • rhendric/ghc
  • damhiya/ghc
  • ryndubei/ghc
  • DaveBarton/ghc
  • trac-Profpatsch/ghc
  • GZGavinZhao/ghc
  • ncfavier/ghc
  • jameshaydon/ghc
  • ajccosta/ghc
  • dschrempf/ghc
  • cydparser/ghc
  • LinuxUserGD/ghc
  • elodielander/ghc
  • facundominguez/ghc
  • psilospore/ghc
  • lachrimae/ghc
  • dylan-thinnes/ghc-type-errors-plugin
  • hamishmack/ghc
  • Leary/ghc
  • lzszt/ghc
  • lyokha/ghc
  • trac-glaubitz/ghc
  • Rewbert/ghc
  • andreabedini/ghc
  • Jasagredo/ghc
  • sol/ghc
  • OlegAlexander/ghc
  • trac-sthibaul/ghc
  • avdv/ghc
  • Wendaolee/ghc
  • ur4t/ghc
  • daylily/ghc
  • boltzmannrain/ghc
  • mmzk1526/ghc
  • trac-fizzixnerd/ghc
  • soulomoon/ghc
  • rwmjones/ghc
  • j14i/ghc
  • tracsis/ghc
  • gesh/ghc
  • flip101/ghc
  • eldritch-cookie/ghc
  • LemonjamesD/ghc
  • pgujjula/ghc
  • skeuchel/ghc
  • noteed/ghc
  • gulin.serge/ghc
  • Torrekie/ghc
  • jlwoodwa/ghc
  • ayanamists/ghc
  • husong998/ghc
  • trac-edmundnoble/ghc
  • josephf/ghc
  • contrun/ghc
  • baulig/ghc
  • edsko/ghc
  • mzschr/ghc-issue-24732
  • ulidtko/ghc
  • Arsen/ghc
  • trac-sjoerd_visscher/ghc
  • crumbtoo/ghc
  • L0neGamer/ghc
  • DrewFenwick/ghc
  • benz0li/ghc
  • MaciejWas/ghc
  • jordanrule/ghc
  • trac-qqwy/ghc
  • LiamGoodacre/ghc
  • isomorpheme/ghc
  • trac-danidiaz/ghc
  • Kariim/ghc
  • MTaimoorZaeem/ghc
  • hololeap/ghc
  • ticat-fp/ghc
  • meritamen/ghc
  • criskell/ghc
  • trac-kraai/ghc
  • aergus/ghc
  • jdral/ghc
  • SamB/ghc
  • Tristian/ghc
  • ywgrit/ghc
  • KatsuPatrick/ghc
  • OsePedro/ghc
  • mpscholten/ghc
  • fp/ghc
  • zaquest/ghc
  • fangyi-zhou/ghc
  • augyg/ghc
640 results
Show changes
Commits on Source (68)
  • Ben Gamari's avatar
    e9c0110c
  • Sebastian Graf's avatar
    DmdAnal: Improve handling of precise exceptions · 9bd20e83
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    This patch does two things: Fix possible unsoundness in what was called
    the "IO hack" and implement part 2.1 of the "fixing precise exceptions"
    plan in
    https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions,
    which, in combination with !2956, supersedes !3014 and !2525.
    
    **IO hack**
    
    The "IO hack" (which is a fallback to preserve precise exceptions
    semantics and thus soundness, rather than some smart thing that
    increases precision) is called `exprMayThrowPreciseException` now.
    I came up with two testcases exemplifying possible unsoundness (if
    twisted enough) in the old approach:
    
    - `T13380d`: Demonstrating unsoundness of the "IO hack" when resorting
                 to manual state token threading and direct use of primops.
                 More details below.
    - `T13380e`: Demonstrating unsoundness of the "IO hack" when we have
                 Nested CPR. Not currently relevant, as we don't have Nested
                 CPR yet.
    - `T13380f`: Demonstrating unsoundness of the "IO hack" for safe FFI
                 calls.
    
    Basically, the IO hack assumed that precise exceptions can only be
    thrown from a case scrutinee of type `(# State# RealWorld, _ #)`. I
    couldn't come up with a program using the `IO` abstraction that violates
    this assumption. But it's easy to do so via manual state token threading
    and direct use of primops, see `T13380d`. Also similar code might be
    generated by Nested CPR in the (hopefully not too) distant future, see
    `T13380e`. Hence, we now have a more careful test in `forcesRealWorld`
    that passes `T13380{d,e}` (and will hopefully be robust to Nested CPR).
    
    **Precise exceptions**
    
    In #13380 and #17676 we saw that we didn't preserve precise exception
    semantics in demand analysis. We fixed that with minimal changes in
    !2956, but that was terribly unprincipled.
    
    That unprincipledness resulted in a loss of precision, which is tracked
    by these new test cases:
    
    - `T13380b`: Regression in dead code elimination, because !2956 was too
                 syntactic about `raiseIO#`
    - `T13380c`: No need to apply the "IO hack" when the IO action may not
                 throw a precise exception (and the existing IO hack doesn't
                 detect that)
    
    Fixing both issues in !3014 turned out to be too complicated and had
    the potential to regress in the future. Hence we decided to only fix
    `T13380b` and augment the `Divergence` lattice with a new middle-layer
    element, `ExnOrDiv`, which means either `Diverges` (, throws an
    imprecise exception) or throws a *precise* exception.
    
    See the wiki page on Step 2.1 for more implementational details:
    https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions#dead-code-elimination-for-raiseio-with-isdeadenddiv-introducing-exnordiv-step-21
    9bd20e83
  • Ben Gamari's avatar
    GHC.Cmm.Opt: Handle MO_XX_Conv · 568d7279
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This MachOp was introduced by 2c959a18
    but a wildcard match in cmmMachOpFoldM hid the fact that it wasn't
    handled. Ideally we would eliminate the match but this appears to be a
    larger task.
    
    Fixes #18141.
    568d7279
  • Ryan Scott's avatar
    Remove duplicate Note [When to print foralls] in GHC.Core.TyCo.Ppr · 5bcf8606
    Ryan Scott authored
    There are two different Notes named `[When to print foralls]`. The
    most up-to-date one is in `GHC.Iface.Type`, but there is a second
    one in `GHC.Core.TyCo.Ppr`. The latter is less up-to-date, as it was
    written before GHC switched over to using ifaces to pretty-print
    types. I decided to just remove the latter and replace it with a
    reference to the former.
    
    [ci skip]
    5bcf8606
  • Fumiaki Kinoshita's avatar
    base: Add Generic instances to various datatypes under GHC.* · 55f0e783
    Fumiaki Kinoshita authored and Marge Bot's avatar Marge Bot committed
    * GHC.Fingerprint.Types: Fingerprint
    * GHC.RTS.Flags: GiveGCStats, GCFlags, ConcFlags, DebugFlags, CCFlags, DoHeapProfile, ProfFlags, DoTrace, TraceFlags, TickyFlags, ParFlags and RTSFlags
    * GHC.Stats: RTSStats and GCStats
    * GHC.ByteOrder: ByteOrder
    * GHC.Unicode: GeneralCategory
    * GHC.Stack.Types: SrcLoc
    
    Metric Increase:
        haddock.base
    55f0e783
  • Gert-Jan Bottu's avatar
    Explicit Specificity · a9311cd5
    Gert-Jan Bottu authored and Marge Bot's avatar Marge Bot committed
    Implementation for Ticket #16393.
    Explicit specificity allows users to manually create inferred type variables,
    by marking them with braces.
    This way, the user determines which variables can be instantiated through
    visible type application.
    
    The additional syntax is included in the parser, allowing users to write
    braces in type variable binders (type signatures, data constructors etc).
    This information is passed along through the renamer and verified in the
    type checker.
    The AST for type variable binders, data constructors, pattern synonyms,
    partial signatures and Template Haskell has been updated to include the
    specificity of type variables.
    
    Minor notes:
    - Bumps haddock submodule
    - Disables pattern match checking in GHC.Iface.Type with GHC 8.8
    a9311cd5
  • Ben Price's avatar
    Lint should say when it is checking a rule · 24e61aad
    Ben Price authored and Marge Bot's avatar Marge Bot committed
    It is rather confusing that when lint finds an error in a rule attached
    to a binder, it reports the error as in the RHS, not the rule:
      ...
      In the RHS of foo
    
    We add a clarifying line:
      ...
      In the RHS of foo
      In a rule attached to foo
    
    The implication that the rule lives inside the RHS is a bit odd, but
    this niggle is already present for unfoldings, whose pattern we are
    following.
    24e61aad
  • Ben Gamari's avatar
    nonmoving: Optimise the write barrier · 78c6523c
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    78c6523c
  • Andreas Klebinger's avatar
    Refactor linear reg alloc to remember past assignments. · 13f6c9d0
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    When assigning registers we now first try registers we
    assigned to in the past, instead of picking the "first"
    one.
    
    This is in extremely helpful when dealing with loops for
    which variables are dead for part of the loop.
    
    This is important for patterns like this:
    
            foo = arg1
        loop:
            use(foo)
            ...
            foo = getVal()
            goto loop;
    
    There we:
    * assign foo to the register of arg1.
    * use foo, it's dead after this use as it's overwritten after.
    * do other things.
    * look for a register to put foo in.
    
    If we pick an arbitrary one it might differ from the register the
    start of the loop expect's foo to be in.
    To fix this we simply look for past register assignments for
    the given variable. If we find one and the register is free we
    use that register.
    
    This reduces the need for fixup blocks which match the register
    assignment between blocks. In the example above between the end
    and the head of the loop.
    
    This patch also moves branch weight estimation ahead of register
    allocation and adds a flag to control it (cmm-static-pred).
    * It means the linear allocator is more likely to assign the hotter
      code paths first.
    * If it assign these first we are:
      + Less likely to spill on the hot path.
      + Less likely to introduce fixup blocks on the hot path.
    
    These two measure combined are surprisingly effective. Based on nofib
    we get in the mean:
    
    * -0.9% instructions executed
    * -0.1% reads/writes
    * -0.2% code size.
    * -0.1% compiler allocations.
    * -0.9% compile time.
    * -0.8% runtime.
    
    Most of the benefits are simply a result of removing redundant moves
    and spills.
    
    Reduced compiler allocations likely are the result of less code being
    generated. (The added lookup is mostly non-allocating).
    13f6c9d0
  • Andreas Klebinger's avatar
    NCG: Codelayout: Distinguish conditional and other branches. · edc2cc58
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    In #18053 we ended up with a suboptimal code layout because
    the code layout algorithm didn't distinguish between conditional
    and unconditional control flow.
    
    We can completely eliminate unconditional control flow instructions
    by placing blocks next to each other, not so much for conditionals.
    
    In terms of implementation we simply give conditional branches less
    weight before computing the layout.
    
    Fixes #18053
    edc2cc58
  • Gleb Popov's avatar
    gitlab-ci: Set locale to C.UTF-8. · b7a6b2f4
    Gleb Popov authored and Marge Bot's avatar Marge Bot committed
    b7a6b2f4
  • Stefan Holdermans's avatar
    Allow spaces in GHCi :script file names · a8c27cf6
    Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
    This patch updates the user interface of GHCi so that file names passed
    to the ':script' command may contain spaces escaped with a backslash.
    
    For example:
    
      :script foo\ bar.script
    
    The implementation uses a modified version of 'words' that does not
    break on escaped spaces.
    
    Fixes #18027.
    a8c27cf6
  • Stefan Holdermans's avatar
    Add extra tests for GHCi :script syntax checks · 82663959
    Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
    The syntax for GHCi's ":script" command allows for only a single file
    name to be passed as an argument. This patch adds a test for the cases
    in which a file name is missing or multiple file names are passed.
    
    Related to #T18027.
    82663959
  • Stefan Holdermans's avatar
    Allow GHCi :script file names in double quotes · a0b79e1b
    Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
    This patch updates the user interface of GHCi so that file names passed
    to the ':script' command can be wrapped in double quotes.
    
    For example:
    
      :script "foo bar.script"
    
    The implementation uses a modified version of 'words' that treats
    character sequences enclosed in double quotes as single words.
    
    Fixes #18027.
    a0b79e1b
  • Stefan Holdermans's avatar
    Update documentation for GHCi :script · cf566330
    Stefan Holdermans authored and Marge Bot's avatar Marge Bot committed
    This patch adds the fixes that allow for file names containing spaces to
    be passed to GHCi's ':script' command to the release notes for 8.12 and
    expands the user-guide documentation for ':script' by mentioning how
    such file names can be passed.
    
    Related to #18027.
    cf566330
  • Tuan Le's avatar
    llvmGen: Consider Relocatable read-only data as not constantReferences: #18137 · 0004ccb8
    Tuan Le authored and Marge Bot's avatar Marge Bot committed
    0004ccb8
  • John Ericson's avatar
    Use `Checker` for `tc_pat` · 964d3ea2
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    964d3ea2
  • John Ericson's avatar
    Use `Checker` for `tc_lpat` and `tc_lpats` · b797aa42
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    b797aa42
  • John Ericson's avatar
    More judiciously panic in `ts_pat` · 5108e84a
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    5108e84a
  • John Ericson's avatar
    Put `PatEnv` first in `GHC.Tc.Gen.Pat.Checker` · 510e0451
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    510e0451
  • John Ericson's avatar
    Tiny cleaup eta-reduce away a function argument · cb4231db
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    In GHC, not in the code being compiled!
    cb4231db
  • John Ericson's avatar
    Use braces with do in `SplicePat` case for consistency · 6890c38d
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    6890c38d
  • Vilem-Benjamin Liepelt's avatar
    Fix spelling mistakes and typos · 3451584f
    Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
    3451584f
  • Vilem-Benjamin Liepelt's avatar
    Add INLINABLE pragmas to Enum list producers · b552e531
    Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
    The INLINABLE pragmas ensure that we export stable (unoptimised) unfoldings in
    the interface file so we can do list fusion at usage sites.
    
    Related tickets: #15185, #8763, #18178.
    b552e531
  • Vilem-Benjamin Liepelt's avatar
    Piggyback on Enum Word methods for Word64 · e7480063
    Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
    If we are on a 64 bit platform, we can use the efficient Enum Word
    methods for the Enum Word64 instance.
    e7480063
  • Vilem-Benjamin Liepelt's avatar
    Document INLINE(ABLE) pragmas that enable fusion · 892b0c41
    Vilem-Benjamin Liepelt authored and Marge Bot's avatar Marge Bot committed
    892b0c41
  • Richard Eisenberg's avatar
    MR template should ask for key part · 2b363ebb
    Richard Eisenberg authored and Marge Bot's avatar Marge Bot committed
    2b363ebb
  • Sebastian Graf's avatar
    Make `Int`'s `mod` and `rem` strict in their first arguments · a95bbd0b
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    They used to be strict until 4d2ac2d4 (9 years ago).
    
    It's obviously better to be strict for performance reasons.
    It also blocks #18067.
    
    NoFib results:
    
    ```
    --------------------------------------------------------------------------------
            Program         Allocs    Instrs
    --------------------------------------------------------------------------------
            integer          -1.1%     +0.4%
       wheel-sieve2         +21.2%    +20.7%
    --------------------------------------------------------------------------------
                Min          -1.1%     -0.0%
                Max         +21.2%    +20.7%
     Geometric Mean          +0.2%     +0.2%
    ```
    
    The regression in `wheel-sieve2` is due to reboxing that likely will go
    away with the resolution of #18067. See !3282 for details.
    
    Fixes #18187.
    a95bbd0b
  • Galen Huntington's avatar
    Clarify pitfalls of NegativeLiterals; see #18022. · d3d055b8
    Galen Huntington authored and Marge Bot's avatar Marge Bot committed
    d3d055b8
  • Alexey Kuleshevich's avatar
    Fix wording in primops documentation to reflect the correct reasoning: · 1b508a9e
    Alexey Kuleshevich authored and Marge Bot's avatar Marge Bot committed
    * Besides resizing functions, shrinking ones also mutate the
      size of a mutable array and because of those two `sizeofMutabeByteArray`
      and `sizeofSmallMutableArray` are now deprecated
    * Change reference in documentation to the newer functions `getSizeof*`
      instead of `sizeof*` for shrinking functions
    * Fix incorrect mention of "byte" instead of "small"
    1b508a9e
  • Andreas Klebinger's avatar
    Don't variable-length encode magic iface constant. · 4ca0c8a1
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    We changed to use variable length encodings for many types by default,
    including Word32. This makes sense for numbers but not when Word32 is
    meant to represent four bytes.
    
    I added a FixedLengthEncoding newtype to Binary who's instances
    interpret their argument as a collection of bytes instead of a number.
    
    We then use this when writing/reading magic numbers to the iface file.
    
    I also took the libery to remove the dummy iface field.
    
    This fixes #18180.
    4ca0c8a1
  • Krzysztof Gogolewski's avatar
    Add a regression test for #11506 · a1275081
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    The testcase works now.
    See explanation in ghc/ghc#11506 (comment 273202)
    a1275081
  • Krzysztof Gogolewski's avatar
    Sort deterministically metric output · 8a816e5f
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    Previously, we sorted according to the test name and way,
    but the metrics (max_bytes_used/peak_megabytes_allocated etc.)
    were appearing in nondeterministic order.
    8a816e5f
  • Sylvain Henry's avatar
    Move isDynLinkName into GHC.Types.Name · 566cc73f
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    It doesn't belong into GHC.Unit.State
    566cc73f
  • adam's avatar
    docs: fix formatting and add some links · d830bbc9
    adam authored and Marge Bot's avatar Marge Bot committed
    [skip ci]
    d830bbc9
  • Andrew Martin's avatar
    Implement cstringLength# and FinalPtr · 49301ad6
    Andrew Martin authored and Marge Bot's avatar Marge Bot committed
    This function and its accompanying rule resolve issue #5218.
    A future PR to the bytestring library will make the internal
    Data.ByteString.Internal.unsafePackAddress compute string length
    with cstringLength#. This will improve the status quo because it is
    eligible for constant folding.
    
    Additionally, introduce a new data constructor to ForeignPtrContents
    named FinalPtr. This additional data constructor, when used in the
    IsString instance for ByteString, leads to more Core-to-Core
    optimization opportunities, fewer runtime allocations, and smaller
    binaries.
    
    Also, this commit re-exports all the functions from GHC.CString
    (including cstringLength#) in GHC.Exts. It also adds a new test
    driver. This test driver is used to perform substring matches on Core
    that is dumped after all the simplifier passes. In this commit, it is
    used to check that constant folding of cstringLength# works.
    49301ad6
  • Ben Gamari's avatar
    simplCore: Ignore ticks in rule templates · dcd6bdcc
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This fixes #17619, where a tick snuck in to the template of a rule,
    resulting in a panic during rule matching. The tick in question was
    introduced via post-inlining, as discussed in `Note [Simplifying
    rules]`. The solution we decided upon was to simply ignore ticks in the
    rule template, as discussed in `Note [Tick annotations in RULE
    matching]`.
    
    Fixes #18162.
    Fixes #17619.
    dcd6bdcc
  • John Ericson's avatar
    Fix #18145 and also avoid needless work with implicit vars · 82cb8913
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    
     - `forAllOrNothing` now is monadic, so we can trace whether we bind
       an explicit `forall` or not.
    
     - #18145 arose because the free vars calculation was needlessly
       complex. It is now greatly simplified.
    
     - Replaced some other implicit var code with `filterFreeVarsToBind`.
    
    Co-authored-by: default avatarRyan Scott <ryan.gl.scott@gmail.com>
    82cb8913
  • Ben Gamari's avatar
    Bump process submodule · a60dc835
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    Fixes #17926.
    a60dc835
  • Ben Gamari's avatar
    users-guide: Clarify meaning of -haddock flag · 856adf54
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    Fixes #18206.
    856adf54
  • Ben Gamari's avatar
    git: Add ignored commits file · 7ae57afd
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This can be used to tell git to ignore bulk renaming commits like the
    recently-finished module hierarchy refactoring. Configured with,
    
        git config blame.ignoreRevsFile .git-ignore-revs
    7ae57afd
  • Javier Neira 's avatar
    Add hie-bios script for windows systems · 63d30e60
    Javier Neira authored and Marge Bot's avatar Marge Bot committed
    It is a direct translation of the sh script
    63d30e60
  • Javier Neira 's avatar
    Honour previous values for CABAL and CABFLAGS · 59182b88
    Javier Neira authored and Marge Bot's avatar Marge Bot committed
    The immediate goal is let the hie-bios.bat script
    set CABFLAGS with `-v0` and remove all cabal output
    except the compiler arguments
    59182b88
  • Javier Neira 's avatar
    Add specific configuration for windows in hie.yaml · 932dc54e
    Javier Neira authored and Marge Bot's avatar Marge Bot committed
    932dc54e
  • Javier Neira 's avatar
    Remove not needed hie-bios output · e0eda070
    Javier Neira authored and Marge Bot's avatar Marge Bot committed
    e0eda070
  • Sylvain Henry's avatar
    Move Config module into GHC.Settings · a0ea59d6
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    a0ea59d6
  • Sylvain Henry's avatar
    Rename GHC.Core.Arity into GHC.Core.Opt.Arity · 37430251
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    37430251
  • Sylvain Henry's avatar
    Rename GHC.Hs.Types into GHC.Hs.Type · a426abb9
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    See discussion in #13009 (comment 268610)
    a426abb9
  • Sylvain Henry's avatar
    Bump haddock submodule · 1c91a7a0
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    1c91a7a0
  • Ryan Scott's avatar
    Add orderingTyCon to wiredInTyCons (#18185) · 66bd24d1
    Ryan Scott authored and Marge Bot's avatar Marge Bot committed
    `Ordering` needs to be wired in for use in the built-in `CmpNat` and
    `CmpSymbol` type families, but somehow it was never added to the list
    of `wiredInTyCons`, leading to the various oddities observed
    in #18185. Easily fixed by moving `orderingTyCon` from
    `basicKnownKeyNames` to `wiredInTyCons`.
    
    Fixes #18185.
    66bd24d1
  • Matthew Pickering's avatar
    Remove unused hs-boot file · 01c43634
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    01c43634
  • Sylvain Henry's avatar
    Hadrian: fix cross-compiler build (#16051) · 7a07aa71
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    7a07aa71
  • Sylvain Henry's avatar
    Hadrian: fix distDir per stage · 15ccca16
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    15ccca16
  • Sylvain Henry's avatar
    Hadrian: fix hp2ps error during cross-compilation · b420fb24
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    Fixed by @alp (see #16051 (comment 274265))
    b420fb24
  • Joshua Price's avatar
    Make Unicode brackets opening/closing tokens (#18225) · cd339ef0
    Joshua Price authored and Marge Bot's avatar Marge Bot committed
    The tokens `[|`, `|]`, `(|`, and `|)` are opening/closing tokens as
    described in GHC Proposal #229. This commit makes the unicode
    variants (`⟦`, `⟧`, `⦇`, and `⦈`) act the same as their ASCII
    counterparts.
    cd339ef0
  • Ben Gamari's avatar
    Revert "Specify kind variables for inferred kinds in base." · 013d7120
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    As noted in !3132, this has rather severe knock-on consequences in
    user-code. We'll need to revisit this before merging something along
    these lines.
    
    This reverts commit 9749fe12.
    013d7120
  • Ben Gamari's avatar
    Coverage: Drop redundant ad-hoc boot module check · 4c4312ed
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    To determine whether the module is a boot module
    Coverage.addTicksToBinds was checking for a `boot` suffix in the module
    source filename. This is quite ad-hoc and shouldn't be necessary; the
    callsite in `deSugar` already checks that the module isn't a boot
    module.
    4c4312ed
  • Ben Gamari's avatar
    Coverage: Make tickBoxCount strict · 1abf3c84
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This could otherwise easily cause a leak of (+) thunks.
    1abf3c84
  • Ben Gamari's avatar
    Coverage: Make ccIndices strict · b2813750
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This just seems like a good idea.
    b2813750
  • Ben Gamari's avatar
    Coverage: Don't produce ModBreaks if not HscInterpreted · 02e278eb
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    emptyModBreaks contains a bottom and consequently it's important that we
    don't use it unless necessary.
    02e278eb
  • Ben Gamari's avatar
    Coverage: Factor out addMixEntry · b8c014ce
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    b8c014ce
  • Zubin's avatar
    Add info about typeclass evidence to .hie files · 53814a64
    Zubin authored and Marge Bot's avatar Marge Bot committed
    See `testsuite/tests/hiefile/should_run/HieQueries.hs` and
    `testsuite/tests/hiefile/should_run/HieQueries.stdout` for an example of this
    
    We add two new fields, `EvidenceVarBind` and `EvidenceVarUse` to the
    `ContextInfo` associated with an Identifier. These are associated with the
    appropriate identifiers for the evidence variables collected when we come across
    `HsWrappers`, `TcEvBinds` and `IPBinds` while traversing the AST.
    
    Instance dictionary and superclass selector dictionaries from `tcg_insts` and
    classes defined in `tcg_tcs` are also recorded in the AST as originating from
    their definition span
    
    This allows us to save a complete picture of the evidence constructed by the
    constraint solver, and will let us report this to the user, enabling features
    like going to the instance definition from the invocation of a class method(or
    any other method taking a constraint) and finding all usages of a particular
    instance.
    
    Additionally,
    
    - Mark NodeInfo with an origin so we can differentiate between bindings
      origininating in the source vs those in ghc
    - Along with typeclass evidence info, also include information on Implicit
      Parameters
    - Add a few utility functions to HieUtils in order to query the new info
    
    Updates haddock submodule
    53814a64
  • Sebastian Graf's avatar
    Make WorkWrap.Lib.isWorkerSmallEnough aware of the old arity · 6604906c
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    We should allow a wrapper with up to 82 parameters when the original
    function had 82 parameters to begin with.
    
    I verified that this made no difference on NoFib, but then again
    it doesn't use huge records...
    
    Fixes #18122.
    6604906c
  • Sylvain Henry's avatar
    Enhance Note [About units] for Backpack · cf772f19
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    cf772f19
  • Takenobu Tani's avatar
    core-spec: Modify file paths according to new module hierarchy · ede24126
    Takenobu Tani authored and Marge Bot's avatar Marge Bot committed
    This patch updates file paths according to new module hierarchy [1]:
    
      * GHC/Core.hs                <= coreSyn/CoreSyn.hs
      * GHC/Core/Coercion.hs       <= types/Coercion.hs
      * GHC/Core/Coercion/Axiom.hs <= types/CoAxiom.hs
      * GHC/Core/Coercion/Opt.hs   <= types/OptCoercion.hs
      * GHC/Core/DataCon.hs        <= basicTypes/DataCon.hs
      * GHC/Core/FamInstEnv.hs     <= types/FamInstEnv.hs
      * GHC/Core/Lint.hs           <= coreSyn/CoreLint.hs
      * GHC/Core/Subst.hs          <= coreSyn/CoreSubst.hs
      * GHC/Core/TyCo/Rep.hs       <= types/TyCoRep.hs
      * GHC/Core/TyCon.hs          <= types/TyCon.hs
      * GHC/Core/Type.hs           <= types/Type.hs
      * GHC/Core/Unify.hs          <= types/Unify.hs
      * GHC/Types/Literal.hs       <= basicTypes/Literal.hs
      * GHC/Types/Var.hs           <= basicTypes/Var.hs
    
    [1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/Make-GHC-codebase-more-modular
    
    [skip ci]
    ede24126
  • Ben Gamari's avatar
    eventlog: Fix racy flushing · 04750304
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    Previously no attempt was made to avoid multiple threads writing their
    capability-local eventlog buffers to the eventlog writer simultaneously.
    This could result in multiple eventlog streams being interleaved. Fix
    this by documenting that the EventLogWriter's write() and flush()
    functions may be called reentrantly and fix the default writer to
    protect its FILE* by a mutex.
    
    Fixes #18210.
    04750304
  • Joshua Price's avatar
    Make `identifier` parse unparenthesized `->` (#18060) · d6203f24
    Joshua Price authored and Marge Bot's avatar Marge Bot committed
    d6203f24
  • Ben Gamari's avatar
    nonmoving: Optimise log2_ceil · d0c7ac14
    Ben Gamari authored
    d0c7ac14
Showing
with 291 additions and 101 deletions
# Configure git to ignore commits listed in this file with:
#
# git config blame.ignoreRevsFile .git-ignore-revs
# Module Hierarchy Renamings
af332442123878c1b61d236dce46418efcbe8750
255418da5d264fb2758bc70925adb2094f34adc3
1941ef4f050c0dfcb68229641fcbbde3a10f1072
528df8ecb4e2f9c78b1ae4ab7ff8230644e9b643
18a346a4b5a02b8c62e8eedb91b35c2d8e754b96
817f93eac4d13f680e8e3e7a25eb403b1864f82e
1b1067d14b656bbbfa7c47f156ec2700c9751549
240f5bf6f53515535be5bf3ef7632aa69ae21e3e
1500f0898e85316c7c97a2f759d83278a072ab0e
3ca52151881451ce5b3a7740d003e811b586140d
cf739945b8b28ff463dc44925348f20b3c1f22cb
da7f74797e8c322006eba385c9cbdce346dd1d43
6e2d9ee25bce06ae51d2f1cf8df4f7422106a383
d491a6795d507eabe35d8aec63c534d29f2d305b
99a9f51bf8207c79241fc0b685fadeb222a61292
eb6082358cdb5f271a8e4c74044a12f97352c52f
5119296440e6846c553c72b8a93afc5ecfa576f0
447864a94a1679b5b079e08bb7208a0005381cef
......@@ -2,7 +2,7 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 3f731f5d37a156e7ebe10cd32656946083baaf4a
DOCKER_REV: 6223fe0b5942f4fa35bdec92c74566cf195bfb42
# Sequential version number capturing the versions of all tools fetched by
# .gitlab/ci.sh.
......
......@@ -26,6 +26,9 @@ LT_CYAN="1;36"
WHITE="1;37"
LT_GRAY="0;37"
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
# GitLab Pipelines log section delimiters
# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
start_section() {
......
Thank you for your contribution to GHC!
**Please read the checklist below to make sure your contribution fulfills these
expectations. Also please answer the following question in your MR description:**
**Where is the key part of this patch? That is, what should reviewers look at first?**
Please take a few moments to verify that your commits fulfill the following:
* [ ] are either individually buildable or squashed
......@@ -10,7 +15,7 @@ Please take a few moments to verify that your commits fulfill the following:
likely should add a [Note][notes] and cross-reference it from the relevant
places.
* [ ] add a [testcase to the testsuite](https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding).
* [ ] if your MR affects library interfaces (e.g. changes `base`) please add
* [ ] if your MR affects library interfaces (e.g. changes `base`) or affects whether GHC will accept user-written code, please add
the ~"user facing" label.
* [ ] updates the users guide if applicable
* [ ] mentions new features in the release notes for the next release
......
......@@ -178,7 +178,7 @@ module GHC (
isRecordSelector,
isPrimOpId, isFCallId, isClassOpId_maybe,
isDataConWorkId, idDataCon,
isBottomingId, isDictonaryId,
isDeadEndId, isDictonaryId,
recordSelectorTyCon,
-- ** Type constructors
......
......@@ -349,6 +349,7 @@ basicKnownKeyNames
-- Strings and lists
unpackCStringName,
unpackCStringFoldrName, unpackCStringUtf8Name,
cstringLengthName,
-- Overloaded lists
isListClassName,
......@@ -428,10 +429,6 @@ basicKnownKeyNames
-- Annotation type checking
toAnnotationWrapperName
-- The Ordering type
, orderingTyConName
, ordLTDataConName, ordEQDataConName, ordGTDataConName
-- The SPEC type for SpecConstr
, specTyConName
......@@ -1014,10 +1011,11 @@ modIntName = varQual gHC_CLASSES (fsLit "modInt#") modIntIdKey
-- Base strings Strings
unpackCStringName, unpackCStringFoldrName,
unpackCStringUtf8Name, eqStringName :: Name
unpackCStringUtf8Name, eqStringName, cstringLengthName :: Name
unpackCStringName = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
unpackCStringFoldrName = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey
unpackCStringUtf8Name = varQual gHC_CSTRING (fsLit "unpackCStringUtf8#") unpackCStringUtf8IdKey
cstringLengthName = varQual gHC_CSTRING (fsLit "cstringLength#") cstringLengthIdKey
eqStringName = varQual gHC_BASE (fsLit "eqString") eqStringIdKey
-- The 'inline' function
......@@ -2097,7 +2095,7 @@ wildCardKey, absentErrorIdKey, augmentIdKey, appendIdKey,
unpackCStringUtf8IdKey, unpackCStringAppendIdKey,
unpackCStringFoldrIdKey, unpackCStringIdKey,
typeErrorIdKey, divIntIdKey, modIntIdKey,
absentSumFieldErrorIdKey :: Unique
absentSumFieldErrorIdKey, cstringLengthIdKey :: Unique
wildCardKey = mkPreludeMiscIdUnique 0 -- See Note [WildCard binders]
absentErrorIdKey = mkPreludeMiscIdUnique 1
......@@ -2124,6 +2122,7 @@ voidPrimIdKey = mkPreludeMiscIdUnique 21
typeErrorIdKey = mkPreludeMiscIdUnique 22
divIntIdKey = mkPreludeMiscIdUnique 23
modIntIdKey = mkPreludeMiscIdUnique 24
cstringLengthIdKey = mkPreludeMiscIdUnique 25
concatIdKey, filterIdKey, zipIdKey,
bindIOIdKey, returnIOIdKey, newStablePtrIdKey,
......
module GHC.Builtin.Names where
import GHC.Unit.Module
import GHC.Types.Unique
mAIN :: Module
liftedTypeKindTyConKey :: Unique
......@@ -105,6 +105,9 @@ templateHaskellNames = [
numTyLitName, strTyLitName,
-- TyVarBndr
plainTVName, kindedTVName,
plainInvisTVName, kindedInvisTVName,
-- Specificity
specifiedSpecName, inferredSpecName,
-- Role
nominalRName, representationalRName, phantomRName, inferRName,
-- Kind
......@@ -152,7 +155,7 @@ templateHaskellNames = [
expQTyConName, fieldExpTyConName, predTyConName,
stmtTyConName, decsTyConName, conTyConName, bangTypeTyConName,
varBangTypeTyConName, typeQTyConName, expTyConName, decTyConName,
typeTyConName, tyVarBndrTyConName, clauseTyConName,
typeTyConName, tyVarBndrUnitTyConName, tyVarBndrSpecTyConName, clauseTyConName,
patQTyConName, funDepTyConName, decsQTyConName,
ruleBndrTyConName, tySynEqnTyConName,
roleTyConName, tExpTyConName, injAnnTyConName, kindTyConName,
......@@ -471,6 +474,15 @@ plainTVName, kindedTVName :: Name
plainTVName = libFun (fsLit "plainTV") plainTVIdKey
kindedTVName = libFun (fsLit "kindedTV") kindedTVIdKey
plainInvisTVName, kindedInvisTVName :: Name
plainInvisTVName = libFun (fsLit "plainInvisTV") plainInvisTVIdKey
kindedInvisTVName = libFun (fsLit "kindedInvisTV") kindedInvisTVIdKey
-- data Specificity = ...
specifiedSpecName, inferredSpecName :: Name
specifiedSpecName = libFun (fsLit "specifiedSpec") specifiedSpecKey
inferredSpecName = libFun (fsLit "inferredSpec") inferredSpecKey
-- data Role = ...
nominalRName, representationalRName, phantomRName, inferRName :: Name
nominalRName = libFun (fsLit "nominalR") nominalRIdKey
......@@ -546,7 +558,8 @@ patQTyConName, expQTyConName, stmtTyConName,
conTyConName, bangTypeTyConName,
varBangTypeTyConName, typeQTyConName,
decsQTyConName, ruleBndrTyConName, tySynEqnTyConName, roleTyConName,
derivClauseTyConName, kindTyConName, tyVarBndrTyConName,
derivClauseTyConName, kindTyConName,
tyVarBndrUnitTyConName, tyVarBndrSpecTyConName,
derivStrategyTyConName :: Name
-- These are only used for the types of top-level splices
expQTyConName = libTc (fsLit "ExpQ") expQTyConKey
......@@ -564,7 +577,8 @@ tySynEqnTyConName = thTc (fsLit "TySynEqn") tySynEqnTyConKey
roleTyConName = libTc (fsLit "Role") roleTyConKey
derivClauseTyConName = thTc (fsLit "DerivClause") derivClauseTyConKey
kindTyConName = thTc (fsLit "Kind") kindTyConKey
tyVarBndrTyConName = thTc (fsLit "TyVarBndr") tyVarBndrTyConKey
tyVarBndrUnitTyConName = libTc (fsLit "TyVarBndrUnit") tyVarBndrUnitTyConKey
tyVarBndrSpecTyConName = libTc (fsLit "TyVarBndrSpec") tyVarBndrSpecTyConKey
derivStrategyTyConName = thTc (fsLit "DerivStrategy") derivStrategyTyConKey
-- quasiquoting
......@@ -628,7 +642,8 @@ quoteClassKey = mkPreludeClassUnique 201
expTyConKey, matchTyConKey, clauseTyConKey, qTyConKey, expQTyConKey,
patTyConKey,
stmtTyConKey, conTyConKey, typeQTyConKey, typeTyConKey,
tyVarBndrTyConKey, decTyConKey, bangTypeTyConKey, varBangTypeTyConKey,
tyVarBndrUnitTyConKey, tyVarBndrSpecTyConKey,
decTyConKey, bangTypeTyConKey, varBangTypeTyConKey,
fieldExpTyConKey, fieldPatTyConKey, nameTyConKey, patQTyConKey,
funDepTyConKey, predTyConKey,
predQTyConKey, decsQTyConKey, ruleBndrTyConKey, tySynEqnTyConKey,
......@@ -655,7 +670,8 @@ patQTyConKey = mkPreludeTyConUnique 219
funDepTyConKey = mkPreludeTyConUnique 222
predTyConKey = mkPreludeTyConUnique 223
predQTyConKey = mkPreludeTyConUnique 224
tyVarBndrTyConKey = mkPreludeTyConUnique 225
tyVarBndrUnitTyConKey = mkPreludeTyConUnique 225
tyVarBndrSpecTyConKey = mkPreludeTyConUnique 237
decsQTyConKey = mkPreludeTyConUnique 226
ruleBndrTyConKey = mkPreludeTyConUnique 227
tySynEqnTyConKey = mkPreludeTyConUnique 228
......@@ -985,6 +1001,10 @@ plainTVIdKey, kindedTVIdKey :: Unique
plainTVIdKey = mkPreludeMiscIdUnique 413
kindedTVIdKey = mkPreludeMiscIdUnique 414
plainInvisTVIdKey, kindedInvisTVIdKey :: Unique
plainInvisTVIdKey = mkPreludeMiscIdUnique 482
kindedInvisTVIdKey = mkPreludeMiscIdUnique 483
-- data Role = ...
nominalRIdKey, representationalRIdKey, phantomRIdKey, inferRIdKey :: Unique
nominalRIdKey = mkPreludeMiscIdUnique 415
......@@ -1060,6 +1080,11 @@ anyclassStrategyIdKey = mkPreludeDataConUnique 495
newtypeStrategyIdKey = mkPreludeDataConUnique 496
viaStrategyIdKey = mkPreludeDataConUnique 497
-- data Specificity = ...
specifiedSpecKey, inferredSpecKey :: Unique
specifiedSpecKey = mkPreludeMiscIdUnique 498
inferredSpecKey = mkPreludeMiscIdUnique 499
{-
************************************************************************
* *
......
......@@ -202,8 +202,11 @@ names in GHC.Builtin.Names, so they use wTcQual, wDataQual, etc
-- that occurs in this list that name will be assigned the wired-in key we
-- define here.
--
-- Because of their infinite nature, this list excludes tuples, Any and implicit
-- parameter TyCons (see Note [Built-in syntax and the OrigNameCache]).
-- Because of their infinite nature, this list excludes
-- * tuples, including boxed, unboxed and constraint tuples
--- (mkTupleTyCon, unitTyCon, pairTyCon)
-- * unboxed sums (sumTyCon)
-- See Note [Infinite families of known-key names] in GHC.Builtin.Names
--
-- See also Note [Known-key names]
wiredInTyCons :: [TyCon]
......@@ -224,6 +227,7 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they
, wordTyCon
, word8TyCon
, listTyCon
, orderingTyCon
, maybeTyCon
, heqTyCon
, eqTyCon
......@@ -586,7 +590,7 @@ pcDataConWithFixity' declared_infix dc_name wrk_key rri
(map (const no_bang) arg_tys)
[] -- No labelled fields
tyvars ex_tyvars
(mkTyCoVarBinders Specified user_tyvars)
(mkTyVarBinders SpecifiedSpec user_tyvars)
[] -- No equality spec
[] -- No theta
arg_tys (mkTyConApp tycon (mkTyVarTys tyvars))
......
......@@ -1254,7 +1254,7 @@ primop ShrinkSmallMutableArrayOp_Char "shrinkSmallMutableArray#" GenPrimOp
SmallMutableArray# s a -> Int# -> State# s -> State# s
{Shrink mutable array to new specified size, in
the specified state thread. The new size argument must be less than or
equal to the current size as reported by {\tt sizeofSmallMutableArray\#}.}
equal to the current size as reported by {\tt getSizeofSmallMutableArray\#}.}
with out_of_line = True
has_side_effects = True
......@@ -1279,8 +1279,8 @@ primop SizeofSmallArrayOp "sizeofSmallArray#" GenPrimOp
primop SizeofSmallMutableArrayOp "sizeofSmallMutableArray#" GenPrimOp
SmallMutableArray# s a -> Int#
{Return the number of elements in the array. Note that this is deprecated
as it is unsafe in the presence of resize operations on the
same byte array.}
as it is unsafe in the presence of shrink and resize operations on the
same small mutable array.}
with deprecated_msg = { Use 'getSizeofSmallMutableArray#' instead }
primop GetSizeofSmallMutableArrayOp "getSizeofSmallMutableArray#" GenPrimOp
......@@ -1451,7 +1451,7 @@ primop ShrinkMutableByteArrayOp_Char "shrinkMutableByteArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> State# s
{Shrink mutable byte array to new specified size (in bytes), in
the specified state thread. The new size argument must be less than or
equal to the current size as reported by {\tt sizeofMutableByteArray\#}.}
equal to the current size as reported by {\tt getSizeofMutableByteArray\#}.}
with out_of_line = True
has_side_effects = True
......@@ -1484,7 +1484,7 @@ primop SizeofByteArrayOp "sizeofByteArray#" GenPrimOp
primop SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
MutableByteArray# s -> Int#
{Return the size of the array in bytes. Note that this is deprecated as it is
unsafe in the presence of resize operations on the same byte
unsafe in the presence of shrink and resize operations on the same mutable byte
array.}
with deprecated_msg = { Use 'getSizeofMutableByteArray#' instead }
......@@ -2567,14 +2567,17 @@ section "Exceptions"
------------------------------------------------------------------------
-- Note [Strictness for mask/unmask/catch]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Consider this example, which comes from GHC.IO.Handle.Internals:
-- wantReadableHandle3 f ma b st
-- = case ... of
-- DEFAULT -> case ma of MVar a -> ...
-- 0# -> maskAsynchExceptions# (\st -> case ma of MVar a -> ...)
-- 0# -> maskAsyncExceptions# (\st -> case ma of MVar a -> ...)
-- The outer case just decides whether to mask exceptions, but we don't want
-- thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd.
-- thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd
-- in mask and unmask. But catch really is lazy in its first argument, see
-- #11555. So for IO actions 'ma' we often use a wrapper around it that is
-- head-strict in 'ma': GHC.IO.catchException.
primop CatchOp "catch#" GenPrimOp
(State# RealWorld -> (# State# RealWorld, a #) )
......@@ -2593,13 +2596,16 @@ primop RaiseOp "raise#" GenPrimOp
b -> o
-- NB: the type variable "o" is "a", but with OpenKind
with
-- In contrast to 'raiseIO#', which throws a *precise* exception,
-- exceptions thrown by 'raise#' are considered *imprecise*.
-- See Note [Precise vs imprecise exceptions] in GHC.Types.Demand.
-- Hence, it has 'botDiv', not 'exnDiv'.
-- For the same reasons, 'raise#' is marked as "can_fail" (which 'raiseIO#'
-- is not), but not as "has_side_effects" (which 'raiseIO#' is).
-- See Note [PrimOp can_fail and has_side_effects] in PrimOp.hs.
strictness = { \ _arity -> mkClosedStrictSig [topDmd] botDiv }
out_of_line = True
has_side_effects = True
-- raise# certainly throws a Haskell exception and hence has_side_effects
-- It doesn't actually make much difference because the fact that it
-- returns bottom independently ensures that we are careful not to discard
-- it. But still, it's better to say the Right Thing.
can_fail = True
-- Note [Arithmetic exception primops]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -2648,8 +2654,8 @@ primop RaiseIOOp "raiseIO#" GenPrimOp
a -> State# RealWorld -> (# State# RealWorld, b #)
with
-- See Note [Precise exceptions and strictness analysis] in Demand.hs
-- for why we give it topDiv
-- strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topDiv }
-- for why this is the *only* primop that has 'exnDiv'
strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnDiv }
out_of_line = True
has_side_effects = True
......
......@@ -12,7 +12,7 @@ module GHC.Cmm (
CmmBlock, RawCmmDecl,
Section(..), SectionType(..),
GenCmmStatics(..), type CmmStatics, type RawCmmStatics, CmmStatic(..),
isSecConstant,
SectionProtection(..), sectionProtection,
-- ** Blocks containing lists
GenBasicBlock(..), blockId,
......@@ -185,17 +185,33 @@ data SectionType
| OtherSection String
deriving (Show)
-- | Should a data in this section be considered constant
isSecConstant :: Section -> Bool
isSecConstant (Section t _) = case t of
Text -> True
ReadOnlyData -> True
RelocatableReadOnlyData -> True
ReadOnlyData16 -> True
CString -> True
Data -> False
UninitialisedData -> False
(OtherSection _) -> False
data SectionProtection
= ReadWriteSection
| ReadOnlySection
| WriteProtectedSection -- See Note [Relocatable Read-Only Data]
deriving (Eq)
-- | Should a data in this section be considered constant at runtime
sectionProtection :: Section -> SectionProtection
sectionProtection (Section t _) = case t of
Text -> ReadOnlySection
ReadOnlyData -> ReadOnlySection
RelocatableReadOnlyData -> WriteProtectedSection
ReadOnlyData16 -> ReadOnlySection
CString -> ReadOnlySection
Data -> ReadWriteSection
UninitialisedData -> ReadWriteSection
(OtherSection _) -> ReadWriteSection
{-
Note [Relocatable Read-Only Data]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Relocatable data are only read-only after relocation at the start of the
program. They should be writable from the source code until then. Failure to
do so would end up in segfaults at execution when using linkers that do not
enforce writability of those sections, such as the gold linker.
-}
data Section = Section SectionType CLabel
......
......@@ -119,7 +119,6 @@ import GHC.Prelude
import GHC.Types.Id.Info
import GHC.Types.Basic
import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId)
import GHC.Unit.State
import GHC.Unit
import GHC.Types.Name
import GHC.Types.Unique
......
......@@ -69,6 +69,7 @@ cmmMachOpFoldM _ op [CmmLit (CmmInt x rep)]
MO_SF_Conv _from to -> CmmLit (CmmFloat (fromInteger x) to)
MO_SS_Conv from to -> CmmLit (CmmInt (narrowS from x) to)
MO_UU_Conv from to -> CmmLit (CmmInt (narrowU from x) to)
MO_XX_Conv from to -> CmmLit (CmmInt (narrowS from x) to)
_ -> panic $ "cmmMachOpFoldM: unknown unary op: " ++ show op
......@@ -76,6 +77,7 @@ cmmMachOpFoldM _ op [CmmLit (CmmInt x rep)]
-- Eliminate conversion NOPs
cmmMachOpFoldM _ (MO_SS_Conv rep1 rep2) [x] | rep1 == rep2 = Just x
cmmMachOpFoldM _ (MO_UU_Conv rep1 rep2) [x] | rep1 == rep2 = Just x
cmmMachOpFoldM _ (MO_XX_Conv rep1 rep2) [x] | rep1 == rep2 = Just x
-- Eliminate nested conversions where possible
cmmMachOpFoldM platform conv_outer [CmmMachOp conv_inner [x]]
......
......@@ -62,7 +62,7 @@ import GHC.Utils.Asm
import GHC.CmmToAsm.Reg.Target
import GHC.Platform
import GHC.CmmToAsm.BlockLayout as BlockLayout
import Config
import GHC.Settings.Config
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.PIC
import GHC.Platform.Reg
......@@ -728,7 +728,7 @@ cmmNativeGen dflags this_mod modLoc ncgImpl us fileIds dbgMap cmm count
let optimizedCFG :: Maybe CFG
optimizedCFG =
optimizeCFG (cfgWeightInfo dflags) cmm <$!> postShortCFG
optimizeCFG (gopt Opt_CmmStaticPred dflags) (cfgWeightInfo dflags) cmm <$!> postShortCFG
maybeDumpCfg dflags optimizedCFG "CFG Weights - Final" proc_name
......
......@@ -240,7 +240,44 @@ import Control.Monad (foldM)
Assuming that Lwork is large the chance that the "call" ends up
in the same cache line is also fairly small.
-}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~ Note [Layout relevant edge weights]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The input to the chain based code layout algorithm is a CFG
with edges annotated with their frequency. The frequency
of traversal corresponds quite well to the cost of not placing
the connected blocks next to each other.
However even if having the same frequency certain edges are
inherently more or less relevant to code layout.
In particular:
* Edges which cross an info table are less relevant than others.
If we place the blocks across this edge next to each other
they are still separated by the info table which negates
much of the benefit. It makes it less likely both blocks
will share a cache line reducing the benefits from locality.
But it also prevents us from eliminating jump instructions.
* Conditional branches and switches are slightly less relevant.
We can completely remove unconditional jumps by placing them
next to each other. This is not true for conditional branch edges.
We apply a small modifier to them to ensure edges for which we can
eliminate the overhead completely are considered first. See also #18053.
* Edges constituted by a call are ignored.
Considering these hardly helped with performance and ignoring
them helps quite a bit to improve compiler performance.
So we perform a preprocessing step where we apply a multiplicator
to these kinds of edges.
-}
-- | Look at X number of blocks in two chains to determine
......@@ -636,35 +673,35 @@ sequenceChain :: forall a i. (Instruction i, Outputable i)
-> [GenBasicBlock i] -- ^ Blocks placed in sequence.
sequenceChain _info _weights [] = []
sequenceChain _info _weights [x] = [x]
sequenceChain info weights' blocks@((BasicBlock entry _):_) =
let weights :: CFG
weights = --pprTrace "cfg'" (pprEdgeWeights cfg')
cfg'
where
(_, globalEdgeWeights) = {-# SCC mkGlobalWeights #-} mkGlobalWeights entry weights'
cfg' = {-# SCC rewriteEdges #-}
mapFoldlWithKey
(\cfg from m ->
mapFoldlWithKey
(\cfg to w -> setEdgeWeight cfg (EdgeWeight w) from to )
cfg m )
weights'
globalEdgeWeights
directEdges :: [CfgEdge]
sequenceChain info weights blocks@((BasicBlock entry _):_) =
let directEdges :: [CfgEdge]
directEdges = sortBy (flip compare) $ catMaybes . map relevantWeight $ (infoEdgeList weights)
where
-- Apply modifiers to turn edge frequencies into useable weights
-- for computing code layout.
-- See also Note [Layout relevant edge weights]
relevantWeight :: CfgEdge -> Maybe CfgEdge
relevantWeight edge@(CfgEdge from to edgeInfo)
| (EdgeInfo CmmSource { trans_cmmNode = CmmCall {} } _) <- edgeInfo
-- Ignore edges across calls
-- Ignore edges across calls.
= Nothing
| mapMember to info
, w <- edgeWeight edgeInfo
-- The payoff is small if we jump over an info table
-- The payoff is quite small if we jump over an info table
= Just (CfgEdge from to edgeInfo { edgeWeight = w/8 })
| (EdgeInfo CmmSource { trans_cmmNode = exitNode } _) <- edgeInfo
, cantEliminate exitNode
, w <- edgeWeight edgeInfo
-- A small penalty to edge types which
-- we can't optimize away by layout.
-- w * 0.96875 == w - w/32
= Just (CfgEdge from to edgeInfo { edgeWeight = w * 0.96875 })
| otherwise
= Just edge
where
cantEliminate CmmCondBranch {} = True
cantEliminate CmmSwitch {} = True
cantEliminate _ = False
blockMap :: LabelMap (GenBasicBlock i)
blockMap
......
......@@ -670,11 +670,21 @@ findBackEdges root cfg =
typedEdges =
classifyEdges root getSuccs edges :: [((BlockId,BlockId),EdgeType)]
optimizeCFG :: D.CfgWeights -> RawCmmDecl -> CFG -> CFG
optimizeCFG _ (CmmData {}) cfg = cfg
optimizeCFG weights (CmmProc info _lab _live graph) cfg =
{-# SCC optimizeCFG #-}
optimizeCFG :: Bool -> D.CfgWeights -> RawCmmDecl -> CFG -> CFG
optimizeCFG _ _ (CmmData {}) cfg = cfg
optimizeCFG doStaticPred weights proc@(CmmProc _info _lab _live graph) cfg =
(if doStaticPred then staticPredCfg (g_entry graph) else id) $
optHsPatterns weights proc $ cfg
-- | Modify branch weights based on educated guess on
-- patterns GHC tends to produce and how they affect
-- performance.
--
-- Most importantly we penalize jumps across info tables.
optHsPatterns :: D.CfgWeights -> RawCmmDecl -> CFG -> CFG
optHsPatterns _ (CmmData {}) cfg = cfg
optHsPatterns weights (CmmProc info _lab _live graph) cfg =
{-# SCC optHsPatterns #-}
-- pprTrace "Initial:" (pprEdgeWeights cfg) $
-- pprTrace "Initial:" (ppr $ mkGlobalWeights (g_entry graph) cfg) $
......@@ -749,6 +759,21 @@ optimizeCFG weights (CmmProc info _lab _live graph) cfg =
| CmmSource { trans_cmmNode = CmmCondBranch {} } <- source = True
| otherwise = False
-- | Convert block-local branch weights to global weights.
staticPredCfg :: BlockId -> CFG -> CFG
staticPredCfg entry cfg = cfg'
where
(_, globalEdgeWeights) = {-# SCC mkGlobalWeights #-}
mkGlobalWeights entry cfg
cfg' = {-# SCC rewriteEdges #-}
mapFoldlWithKey
(\cfg from m ->
mapFoldlWithKey
(\cfg to w -> setEdgeWeight cfg (EdgeWeight w) from to )
cfg m )
cfg
globalEdgeWeights
-- | Determine loop membership of blocks based on SCC analysis
-- This is faster but only gives yes/no answers.
loopMembers :: HasDebugCallStack => CFG -> LabelMap Bool
......@@ -922,6 +947,10 @@ revPostorderFrom cfg root =
-- reverse post order. Which is required for diamond control flow to work probably.
--
-- We also apply a few prediction heuristics (based on the same paper)
--
-- The returned result represents frequences.
-- For blocks it's the expected number of executions and
-- for edges is the number of traversals.
{-# NOINLINE mkGlobalWeights #-}
{-# SCC mkGlobalWeights #-}
......
......@@ -5,9 +5,9 @@ module GHC.CmmToAsm.Dwarf (
import GHC.Prelude
import GHC.Cmm.CLabel
import GHC.Cmm.Expr ( GlobalReg(..) )
import Config ( cProjectName, cProjectVersion )
import GHC.Core ( Tickish(..) )
import GHC.Cmm.Expr ( GlobalReg(..) )
import GHC.Settings.Config ( cProjectName, cProjectVersion )
import GHC.Core ( Tickish(..) )
import GHC.Cmm.DebugBlock
import GHC.Driver.Session
import GHC.Unit.Module
......
......@@ -37,7 +37,10 @@ import GHC.CmmToAsm.Config
-- (for allocation purposes, anyway).
--
data RegUsage
= RU [Reg] [Reg]
= RU {
reads :: [Reg],
writes :: [Reg]
}
-- | No regs read or written to.
noUsage :: RegUsage
......
{-# LANGUAGE BangPatterns, CPP, ScopedTypeVariables #-}
{-# LANGUAGE ConstraintKinds #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
......@@ -137,6 +138,7 @@ import GHC.Platform
import Data.Maybe
import Data.List
import Control.Monad
import Control.Applicative
-- -----------------------------------------------------------------------------
-- Top level of the register allocator
......@@ -229,8 +231,13 @@ linearRegAlloc config entry_ids block_live sccs
go f = linearRegAlloc' config f entry_ids block_live sccs
platform = ncgPlatform config
-- | Constraints on the instruction instances used by the
-- linear allocator.
type OutputableRegConstraint freeRegs instr =
(FR freeRegs, Outputable freeRegs, Outputable instr, Instruction instr)
linearRegAlloc'
:: (FR freeRegs, Outputable instr, Instruction instr)
:: OutputableRegConstraint freeRegs instr
=> NCGConfig
-> freeRegs
-> [BlockId] -- ^ entry points
......@@ -246,7 +253,7 @@ linearRegAlloc' config initFreeRegs entry_ids block_live sccs
return (blocks, stats, getStackUse stack)
linearRA_SCCs :: (FR freeRegs, Instruction instr, Outputable instr)
linearRA_SCCs :: OutputableRegConstraint freeRegs instr
=> [BlockId]
-> BlockMap RegSet
-> [NatBasicBlock instr]
......@@ -281,7 +288,7 @@ linearRA_SCCs entry_ids block_live blocksAcc (CyclicSCC blocks : sccs)
more sanity checking to guard against this eventuality.
-}
process :: (FR freeRegs, Instruction instr, Outputable instr)
process :: OutputableRegConstraint freeRegs instr
=> [BlockId]
-> BlockMap RegSet
-> [GenBasicBlock (LiveInstr instr)]
......@@ -325,15 +332,18 @@ process entry_ids block_live (b@(BasicBlock id _) : blocks)
-- | Do register allocation on this basic block
--
processBlock
:: (FR freeRegs, Outputable instr, Instruction instr)
:: OutputableRegConstraint freeRegs instr
=> BlockMap RegSet -- ^ live regs on entry to each basic block
-> LiveBasicBlock instr -- ^ block to do register allocation on
-> RegM freeRegs [NatBasicBlock instr] -- ^ block with registers allocated
processBlock block_live (BasicBlock id instrs)
= do initBlock id block_live
= do -- pprTraceM "processBlock" $ text "" $$ ppr (BasicBlock id instrs)
initBlock id block_live
(instrs', fixups)
<- linearRA block_live [] [] id instrs
-- pprTraceM "blockResult" $ ppr (instrs', fixups)
return $ BasicBlock id instrs' : fixups
......@@ -369,7 +379,7 @@ initBlock id block_live
-- | Do allocation for a sequence of instructions.
linearRA
:: (FR freeRegs, Outputable instr, Instruction instr)
:: OutputableRegConstraint freeRegs instr
=> BlockMap RegSet -- ^ map of what vregs are live on entry to each block.
-> [instr] -- ^ accumulator for instructions already processed.
-> [NatBasicBlock instr] -- ^ accumulator for blocks of fixup code.
......@@ -396,7 +406,7 @@ linearRA block_live accInstr accFixups id (instr:instrs)
-- | Do allocation for a single instruction.
raInsn
:: (FR freeRegs, Outputable instr, Instruction instr)
:: OutputableRegConstraint freeRegs instr
=> BlockMap RegSet -- ^ map of what vregs are love on entry to each block.
-> [instr] -- ^ accumulator for instructions already processed.
-> BlockId -- ^ the id of the current block, for debugging
......@@ -476,7 +486,7 @@ isInReg src assig | Just (InReg _) <- lookupUFM assig src = True
| otherwise = False
genRaInsn :: (FR freeRegs, Instruction instr, Outputable instr)
genRaInsn :: OutputableRegConstraint freeRegs instr
=> BlockMap RegSet
-> [instr]
-> BlockId
......@@ -486,6 +496,7 @@ genRaInsn :: (FR freeRegs, Instruction instr, Outputable instr)
-> RegM freeRegs ([instr], [NatBasicBlock instr])
genRaInsn block_live new_instrs block_id instr r_dying w_dying = do
-- pprTraceM "genRaInsn" $ ppr (block_id, instr)
platform <- getPlatform
case regUsageOfInstr platform instr of { RU read written ->
do
......@@ -525,6 +536,8 @@ genRaInsn block_live new_instrs block_id instr r_dying w_dying = do
(fixup_blocks, adjusted_instr)
<- joinToTargets block_live block_id instr
-- when (not $ null fixup_blocks) $ pprTraceM "genRA:FixBlocks" $ ppr fixup_blocks
-- Debugging - show places where the reg alloc inserted
-- assignment fixup blocks.
-- when (not $ null fixup_blocks) $
......@@ -737,7 +750,7 @@ data SpillLoc = ReadMem StackSlot -- reading from register only in memory
-- the list of free registers and free stack slots.
allocateRegsAndSpill
:: (FR freeRegs, Outputable instr, Instruction instr)
:: forall freeRegs instr. (FR freeRegs, Outputable instr, Instruction instr)
=> Bool -- True <=> reading (load up spilled regs)
-> [VirtualReg] -- don't push these out
-> [instr] -- spill insns
......@@ -749,7 +762,8 @@ allocateRegsAndSpill _ _ spills alloc []
= return (spills, reverse alloc)
allocateRegsAndSpill reading keep spills alloc (r:rs)
= do assig <- getAssigR
= do assig <- getAssigR :: RegM freeRegs (RegMap Loc)
-- pprTraceM "allocateRegsAndSpill:assig" (ppr (r:rs) $$ ppr assig)
let doSpill = allocRegsAndSpill_spill reading keep spills alloc r rs assig
case lookupUFM assig r of
-- case (1a): already in a register
......@@ -779,6 +793,26 @@ allocateRegsAndSpill reading keep spills alloc (r:rs)
| otherwise -> doSpill WriteNew
-- | Given a virtual reg find a preferred real register.
-- The preferred register is simply the first one the variable
-- was assigned to (if any). This way when we allocate for a loop
-- variables are likely to end up in the same registers at the
-- end and start of the loop, avoiding redundant reg-reg moves.
-- Note: I tried returning a list of past assignments, but that
-- turned out to barely matter but added a few tenths of
-- a percent to compile time.
findPrefRealReg :: forall freeRegs u. Uniquable u
=> u -> RegM freeRegs (Maybe RealReg)
findPrefRealReg vreg = do
bassig <- getBlockAssigR :: RegM freeRegs (BlockMap (freeRegs,RegMap Loc))
return $ foldr (findVirtRegAssig) Nothing bassig
where
findVirtRegAssig :: (freeRegs,RegMap Loc) -> Maybe RealReg -> Maybe RealReg
findVirtRegAssig assig z =
z <|> case lookupUFM (snd assig) vreg of
Just (InReg real_reg) -> Just real_reg
Just (InBoth real_reg _) -> Just real_reg
_ -> z
-- reading is redundant with reason, but we keep it around because it's
-- convenient and it maintains the recursive structure of the allocator. -- EZY
......@@ -795,18 +829,26 @@ allocRegsAndSpill_spill :: (FR freeRegs, Instruction instr, Outputable instr)
allocRegsAndSpill_spill reading keep spills alloc r rs assig spill_loc
= do platform <- getPlatform
freeRegs <- getFreeRegsR
let freeRegs_thisClass = frGetFreeRegs platform (classOfVirtualReg r) freeRegs
let freeRegs_thisClass = frGetFreeRegs platform (classOfVirtualReg r) freeRegs :: [RealReg]
case freeRegs_thisClass of
-- Can we put the variable into a register it already was?
pref_reg <- findPrefRealReg r
case freeRegs_thisClass of
-- case (2): we have a free register
(my_reg : _) ->
do spills' <- loadTemp r spill_loc my_reg spills
(first_free : _) ->
do let final_reg
| Just reg <- pref_reg
, reg `elem` freeRegs_thisClass
= reg
| otherwise
= first_free
spills' <- loadTemp r spill_loc final_reg spills
setAssigR (addToUFM assig r $! newLocation spill_loc my_reg)
setFreeRegsR $ frAllocateReg platform my_reg freeRegs
setAssigR (addToUFM assig r $! newLocation spill_loc final_reg)
setFreeRegsR $ frAllocateReg platform final_reg freeRegs
allocateRegsAndSpill reading keep spills' (my_reg : alloc) rs
allocateRegsAndSpill reading keep spills' (final_reg : alloc) rs
-- case (3): we need to push something out to free up a register
......@@ -814,7 +856,8 @@ allocRegsAndSpill_spill reading keep spills alloc r rs assig spill_loc
do let inRegOrBoth (InReg _) = True
inRegOrBoth (InBoth _ _) = True
inRegOrBoth _ = False
let candidates' =
let candidates' :: UniqFM Loc
candidates' =
flip delListFromUFM keep $
filterUFM inRegOrBoth $
assig
......
......@@ -30,6 +30,7 @@ import GHC.Types.Unique.FM
import GHC.Types.Unique.Supply
import GHC.Cmm.BlockId
data ReadingOrWriting = Reading | Writing deriving (Eq,Ord)
-- | Used to store the register assignment on entry to a basic block.
-- We use this to handle join points, where multiple branch instructions
......@@ -138,6 +139,8 @@ data RA_State freeRegs
, ra_config :: !NCGConfig
-- | (from,fixup,to) : We inserted fixup code between from and to
, ra_fixups :: [(BlockId,BlockId,BlockId)] }
, ra_fixups :: [(BlockId,BlockId,BlockId)]
}