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
638 results
Show changes
Commits on Source (41)
  • Simon Peyton Jones's avatar
    Improve treatment of type applications in patterns · 9f95db54
    Simon Peyton Jones authored
    This patch fixes a subtle bug in the typechecking of type
    applications in patterns, e.g.
       f (MkT @Int @a x y) = ...
    
    See Note [Type applications in patterns] in GHC.Tc.Gen.Pat.
    
    This fixes #19847, #22383, #19577, #21501
    9f95db54
  • Simon Peyton Jones's avatar
    Treat existentials correctly in dubiousDataConInstArgTys · 955a99ea
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    Consider (#22849)
    
     data T a where
       MkT :: forall k (t::k->*) (ix::k). t ix -> T @k a
    
    Then dubiousDataConInstArgTys MkT [Type, Foo] should return
            [Foo (ix::Type)]
    NOT     [Foo (ix::k)]
    
    A bit of an obscure case, but it's an outright bug, and the fix is easy.
    955a99ea
  • Matthew Pickering's avatar
    Bump supported LLVM range from 10 through 15 to 11 through 16 · 0cc16aaf
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    LLVM 15 turns on the new pass manager by default, which we have yet to
    migrate to so for new we pass the `-enable-new-pm-0` flag in our
    llvm-passes flag.
    
    LLVM 11 was the first version to support the `-enable-new-pm` flag so we
    bump the lowest supported version to 11.
    
    Our CI jobs are using LLVM 12 so they should continue to work despite
    this bump to the lower bound.
    
    Fixes #21936
    0cc16aaf
  • Matthew Pickering's avatar
    Bump DOCKER_REV to use alpine image without LLVM installed · f94f1450
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    alpine_3_12 only supports LLVM 10, which is now outside the supported
    version range.
    f94f1450
  • Matthew Pickering's avatar
    Remove tracing OPTIONS_GHC · 083e26ed
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    These were accidentally left over from !9542
    083e26ed
  • Teo Camarasu's avatar
    doc: fix gcdetails_block_fragmentation_bytes since annotation · 354aa47d
    Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
    354aa47d
  • Jaro Reinders's avatar
    compiler: Implement higher order patterns in the rule matcher · 61ce5bf6
    Jaro Reinders authored and Marge Bot's avatar Marge Bot committed
    This implements proposal 555 and closes ticket #22465.
    See the proposal and ticket for motivation.
    
    The core changes of this patch are in the GHC.Core.Rules.match function
    and they are explained in the Note [Matching higher order patterns].
    61ce5bf6
  • jeffrey young's avatar
    CI: JavaScript backend runs testsuite · 394b91ce
    jeffrey young authored and Marge Bot's avatar Marge Bot committed
    This MR runs the testsuite for the JS backend. Note that this is a
    temporary solution until !9515 is merged.
    
    Key point: The CI runs hadrian on the built cross compiler _but not_ on
    the bindist.
    
    Other Highlights:
    
     - stm submodule gets a bump to mark tests as broken
     - several tests are marked as broken or are fixed by adding more
     - conditions to their test runner instance.
    
    List of working commit messages:
    
    CI: test cross target _and_ emulator
    
    CI: JS: Try run testsuite with hadrian
    
    JS.CI: cleanup and simplify hadrian invocation
    
    use single bracket, print info
    
    JS CI: remove call to test_compiler from hadrian
    
    don't build haddock
    
    JS: mark more tests as broken
    
    Tracked in #22576
    
    JS testsuite: don't skip sum_mod test
    
    Its expected to fail, yet we skipped it which automatically makes it
    succeed leading to an unexpected success,
    
    JS testsuite: don't mark T12035j as skip
    
    leads to an unexpected pass
    
    JS testsuite: remove broken on T14075
    
    leads to unexpected pass
    
    JS testsuite: mark more tests as broken
    
    JS testsuite: mark T11760 in base as broken
    
    JS testsuite: mark ManyUnbSums broken
    
    submodules: bump process and hpc for JS tests
    
    Both submodules has needed tests skipped or marked broken for th JS
    backend. This commit now adds these changes to GHC.
    
    See:
    
    HPC: hpc/hpc!21
    
    Process: https://github.com/haskell/process/pull/268
    
    remove js_broken on now passing tests
    
    separate wasm and js backend ci
    
    test: T11760: add threaded, non-moving only_ways
    
    test: T10296a add req_c
    
    T13894: skip for JS backend
    
    tests: jspace, T22333: mark as js_broken(22573)
    
    test: T22513i mark as req_th
    
    stm submodule: mark stm055, T16707 broken for JS
    
    tests: js_broken(22374) on unpack_sums_6, T12010
    
    dont run diff on JS CI, cleanup
    
    fixup: More CI cleanup
    
    fix: align text to master
    
    fix: align exceptions submodule to master
    
    CI: Bump DOCKER_REV
    
    Bump to ci-images commit that has a deb11 build with node. Required for
    !9552
    
    testsuite: mark T22669 as js_skip
    
    See #22669
    
    This test tests that .o-boot files aren't created when run in using the
    interpreter backend. Thus this is not relevant for the JS backend.
    
    testsuite: mark T22671 as broken on JS
    
    See #22835
    
    base.testsuite: mark Chan002 fragile for JS
    
    see #22836
    
    revert: submodule process bump
    
    bump stm submodule
    
    New hash includes skips for the JS backend.
    
    testsuite: mark RnPatternSynonymFail broken on JS
    
    Requires TH:
     - see !9779
     - and #22261
    
    compiler: GHC.hs ifdef import Utils.Panic.Plain
    394b91ce
  • Cheng Shao's avatar
    docs: 9.6 release notes for wasm backend · 1ffe770c
    Cheng Shao authored and Matthew Pickering's avatar Matthew Pickering committed
    1ffe770c
  • Matthew Pickering's avatar
    Disable unfolding sharing for interface files with core definitions · 0ada4547
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    Ticket #22807 pointed out that the RHS sharing was not compatible with
    -fignore-interface-pragmas because the flag would remove unfoldings from
    identifiers before the `extra-decls` field was populated.
    
    For the 9.6 timescale the only solution is to disable this sharing,
    which will make interface files bigger but this is acceptable for the
    first release of `-fwrite-if-simplified-core`.
    
    For 9.8 it would be good to fix this by implementing #20056 due to the
    large number of other bugs that would fix.
    
    I also improved the error message in tc_iface_binding to avoid the "no match
    in record selector" error but it should never happen now as the entire
    sharing logic is disabled.
    
    Also added the currently broken test for #22807 which could be fixed by
    !6080
    
    Fixes #22807
    0ada4547
  • lrzlin's avatar
    Enable tables next to code for LoongArch64 · 7e2d3eb5
    lrzlin authored and Marge Bot's avatar Marge Bot committed
    7e2d3eb5
  • Wander Hillen's avatar
    Move pthread and timerfd ticker implementations to separate files · 2931712a
    Wander Hillen authored and Marge Bot's avatar Marge Bot committed
    2931712a
  • Ben Gamari's avatar
    base: Fix Note references in GHC.IO.Handle.Types · 41c4baf8
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    41c4baf8
  • Bodigrim's avatar
    Bump submodule containers to 0.6.7 · 31358198
    Bodigrim authored and Marge Bot's avatar Marge Bot committed
    Metric Decrease:
        ManyConstructors
        T10421
        T12425
        T12707
        T13035
        T13379
        T15164
        T1969
        T783
        T9198
        T9961
        WWRec
    31358198
  • Ben Gamari's avatar
    gitlab-ci: Eliminate redundant ghc --info output · 8feb9301
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    Previously ci.sh would emit the output of `ghc --info` every time it ran
    when using the nix toolchain. This produced a significant amount of
    noise.
    
    See #22861.
    8feb9301
  • Ryan Scott's avatar
    Windows: Remove mingwex dependency · de1d1512
    Ryan Scott authored and Marge Bot's avatar Marge Bot committed
    The clang based toolchain uses ucrt as its math library
    and so mingwex is no longer needed.  In fact using mingwex
    will cause incompatibilities as the default routines in both
    have differing ULPs and string formatting modifiers.
    
    ```
    $ LIBRARY_PATH=/mingw64/lib ghc/_build/stage1/bin/ghc Bug.hs -fforce-recomp && ./Bug.exe
    [1 of 2] Compiling Main             ( Bug.hs, Bug.o )
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__imp___p__environ'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__hscore_get_errno'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziError_errnoToIOError_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziWindows_failIf2_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePageziAPI_mkCodePageEncoding_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePage_currentCodePage_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncoding_getForeignEncoding_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziString_withCStringLen1_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziInternals_zdwflushCharReadBuffer_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziText_hGetBuf1_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziFingerprint_fingerprintString_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_DataziTypeableziInternal_mkTrCon_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziException_errorCallWithCallStackException_closure'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziErr_error_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `base_DataziMaybe_fromJust1_info'
    ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `templatezmhaskell_LanguageziHaskellziTHziSyntax_IntPrimL_con_info'
    ghc.exe: ^^ Could not load 'templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure', dependency unresolved. See top entry above.
    
    <no location info>: error:
    
    GHC.ByteCode.Linker.lookupCE
    During interactive linking, GHCi couldn't find the following symbol:
      templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure
    This may be due to you not asking GHCi to load extra object files,
    archives or DLLs needed by your current session.  Restart GHCi, specifying
    the missing library using the -L/path/to/object/dir and -lmissinglibname
    flags, or simply by naming the relevant files on the GHCi command line.
    Alternatively, this link failure might indicate a bug in GHCi.
    If you suspect the latter, please report this as a GHC bug:
      https://www.haskell.org/ghc/reportabug
    ```
    de1d1512
  • Tamar Christina's avatar
    linker: Fix BFD import libraries · 48e39195
    Tamar Christina authored and Marge Bot's avatar Marge Bot committed
    This commit fixes the BFD style import library support in the runtime
    linker.  This was accidentally broken during the refactoring to clang
    and went unnoticed because clang itself is unable to generate the BFD
    style import libraries.
    
    With this change we can not link against both GCC or Clang produced
    libraries again and intermix code produced by both compilers.
    48e39195
  • Ben Gamari's avatar
    Bump Windows toolchain · b2bb3e62
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    Updates to LLVM 14, hopefully fixing #21964.
    b2bb3e62
  • Andreas Klebinger's avatar
    Fix CallerCC potentially shadowing other cost centres. · bf3f88a1
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    Add a CallerCC cost centre flavour for cost centres added by the
    CallerCC pass. This avoids potential accidental shadowing between
    CCs added by user annotations and ones added by CallerCC.
    bf3f88a1
  • j's avatar
    Disable several ignore-warning flags in genapply. · faea4bcd
    j authored and Marge Bot's avatar Marge Bot committed
    faea4bcd
  • Ben Gamari's avatar
    Revert "Use fix-sized bit-fiddling primops for fixed size boxed types" · 25537dfd
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This reverts commit 4512ad2d.
    
    This was never applied to master/9.6 originally.
    
    (cherry picked from commit a44bdc27)
    25537dfd
  • Krzysztof Gogolewski's avatar
    Minor refactor · 7612dc71
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    * Introduce refactorDupsOn f = refactorDups (comparing f)
    * Make mkBigTupleCase and coreCaseTuple monadic.
      Every call to those functions was preceded by calling newUniqueSupply.
    * Use mkUserLocalOrCoVar, which is equivalent to combining
      mkLocalIdOrCoVar with mkInternalName.
    7612dc71
  • Bodigrim's avatar
    Fix colors in emacs terminal · 5a54ac0b
    Bodigrim authored and Marge Bot's avatar Marge Bot committed
    5a54ac0b
  • Bodigrim's avatar
    3c0f0c6d
  • Josh Meredith's avatar
    b18fbf52
  • Sylvain Henry's avatar
    JS: replace "js" architecture with "javascript" · 6636b670
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    
    Despite Cabal supporting any architecture name, `cabal --check` only
    supports a few built-in ones. Sadly `cabal --check` is used by Hackage
    hence using any non built-in name in a package (e.g. `arch(js)`) is
    rejected and the package is prevented from being uploaded on Hackage.
    
    Luckily built-in support for the `javascript` architecture was added for
    GHCJS a while ago. In order to allow newer `base` to be uploaded on
    Hackage we make the switch from `js` to `javascript` architecture.
    
    Fixes #22740.
    
    Co-authored-by: default avatarBen Gamari <ben@smart-cactus.org>
    6636b670
  • Luite Stegeman's avatar
    Fix marking async exceptions in the JS backend · 77a8234c
    Luite Stegeman authored and Marge Bot's avatar Marge Bot committed
    Async exceptions are posted as a pair of the exception and
    the thread object. This fixes the marking pass to correctly
    follow the two elements of the pair.
    
    Potentially fixes #22836
    77a8234c
  • Jan Hrček's avatar
    Remove extraneous word in Roles user guide · 3e09cf82
    Jan Hrček authored and Marge Bot's avatar Marge Bot committed
    3e09cf82
  • sheaf's avatar
    Don't allow . in overloaded labels · b17fb3d9
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This patch removes . from the list of allowed characters in a non-quoted
    overloaded label, as it was realised this steals syntax, e.g. (#.).
    
    Users who want this functionality will have to add quotes around the
    label, e.g. `#"17.28"`.
    
    Fixes #22821
    b17fb3d9
  • Rodrigo Mesquita's avatar
    Update kinds in comments in GHC.Core.TyCon · 5dce04ee
    Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
    Use `Type` instead of star kind (*)
    Fix comment with incorrect kind * to have kind `Constraint`
    5dce04ee
  • Ben Gamari's avatar
    Revert "Use fix-sized equality primops for fixed size boxed types" · 92916194
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This reverts commit 024020c3.
    
    This was never applied to master/9.6 originally.
    
    See #20405 for why using these primops is a bad idea.
    
    (cherry picked from commit b1d109ad)
    92916194
  • Sylvain Henry's avatar
    JS: avoid head/tail and unpackFS · c1670c6b
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    c1670c6b
  • Krzysztof Gogolewski's avatar
    testsuite: Fix Python warnings (#22856) · a9912de7
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    a9912de7
  • sheaf's avatar
    Fix tyvar scoping within class SPECIALISE pragmas · 9ee761bf
    sheaf authored and Marge Bot's avatar Marge Bot committed
    Type variables from class/instance headers scope over class/instance
    method type signatures, but DO NOT scope over the type signatures in
    SPECIALISE and SPECIALISE instance pragmas.
    
    The logic in GHC.Rename.Bind.rnMethodBinds correctly accounted for
    SPECIALISE inline pragmas, but forgot to apply the same treatment
    to method SPECIALISE pragmas, which lead to a Core Lint failure with
    an out-of-scope type variable. This patch makes sure we apply the same
    logic for both cases.
    
    Fixes #22913
    9ee761bf
  • Matthew Pickering's avatar
    Revert "Don't keep exit join points so much" · 7eac2468
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    This reverts commit caced757.
    
    It seems the patch "Don't keep exit join points so much" is causing
    wide-spread regressions in the bytestring library benchmarks. If I
    revert it then the 9.6 numbers are better on average than 9.4.
    
    See ghc/ghc#22893 (comment 479525)
    
    -------------------------
    Metric Decrease:
        MultiComponentModules
        MultiComponentModulesRecomp
        MultiLayerModules
        MultiLayerModulesRecomp
        MultiLayerModulesTH_Make
        T12150
        T13386
        T13719
        T21839c
        T3294
        parsing001
    -------------------------
    7eac2468
  • Cheng Shao's avatar
    testsuite: remove config.use_threads · 633f2799
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    This patch simplifies the testsuite driver by removing the use_threads
    config field. It's just a degenerate case of threads=1.
    633f2799
  • Cheng Shao's avatar
    testsuite: use concurrent.futures.ThreadPoolExecutor in the driver · ca6673e3
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    The testsuite driver used to create one thread per test case, and
    explicitly use semaphore and locks for rate limiting and
    synchronization. This is a bad practice in any language, and
    occasionally may result in livelock conditions (e.g. #22889). This
    patch uses concurrent.futures.ThreadPoolExecutor for scheduling test
    case runs, which is simpler and more robust.
    ca6673e3
  • Alan Zimmerman's avatar
    EPA: Comment between module and where should be in header comments · f22cce70
    Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
    Do not apply the heuristic to associate a comment with a prior
    declaration for the first declaration in the file.
    
    Closes #22919
    f22cce70
  • Josh Meredith's avatar
    JS generated refs: update testsuite conditions · d69ecac2
    Josh Meredith authored and Marge Bot's avatar Marge Bot committed
    d69ecac2
  • sheaf's avatar
    Bump transformers to 0.6.1.0 · 2ea1a6bc
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This allows us to avoid orphans for Foldable1 instances,
    fixing #22898.
    
    Updates transformers submodule.
    2ea1a6bc
  • Josh Meredith's avatar
    CodeBuffer: change to use unboxed tuples for encoders/decoders · 14a8af20
    Josh Meredith authored
    Updates submodules for filepath and haskeline
    14a8af20
Showing
with 328 additions and 184 deletions
......@@ -2,11 +2,11 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 2d59d551647d102c4af44f257c520a94f04ea3f6
DOCKER_REV: 572353e0644044fe3a5465bba4342a9a0b0eb60e
# Sequential version number of all cached things.
# Bump to invalidate GitLab CI cache.
CACHE_REV: 9
CACHE_REV: 10
# Disable shallow clones; they break our linting rules
GIT_DEPTH: 0
......
......@@ -214,8 +214,6 @@ function set_toolchain_paths() {
cat toolchain.sh
fi
source toolchain.sh
info "--info for GHC for $NIX_SYSTEM"
$GHC --info
;;
env)
# These are generally set by the Docker image but
......@@ -274,6 +272,11 @@ function setup() {
show_tool CABAL
show_tool HAPPY
show_tool ALEX
info "====================================================="
info "ghc --info"
info "====================================================="
$GHC --info
}
function fetch_ghc() {
......@@ -601,6 +604,16 @@ function test_hadrian() {
if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then
info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
return
# special case for JS backend
elif [ -n "${CROSS_TARGET:-}" ] && [ "${CROSS_EMULATOR:-}" == "js-emulator" ]; then
# run "hadrian test" directly, not using the bindist, even though it did get installed.
# This is a temporary solution, See !9515 for the status of hadrian support.
run_hadrian \
test \
--summary-junit=./junit.xml \
--test-have-intree-files \
--docs=none \
"runtest.opts+=${RUNTEST_ARGS:-}" || fail "cross-compiled hadrian main testsuite"
elif [ -n "${CROSS_TARGET:-}" ]; then
local instdir="$TOP/_build/install"
local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
......
......@@ -882,7 +882,7 @@ job_groups =
, standardBuildsWithConfig Amd64 (Linux Alpine) (splitSectionsBroken static)
, disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt))
, validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
, validateBuilds Amd64 (Linux Debian11) (crossConfig "js-unknown-ghcjs" NoEmulatorNeeded (Just "emconfigure")
, validateBuilds Amd64 (Linux Debian11) (crossConfig "javascript-unknown-ghcjs" (Emulator "js-emulator") (Just "emconfigure")
)
{ bignumBackend = Native
}
......
......@@ -1449,7 +1449,7 @@
"XZ_OPT": "-9"
}
},
"nightly-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate": {
"nightly-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
......@@ -1459,7 +1459,7 @@
"artifacts": {
"expire_in": "8 weeks",
"paths": [
"ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate.tar.xz",
"ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz",
"junit.xml"
],
"reports": {
......@@ -1501,12 +1501,13 @@
],
"variables": {
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate",
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate",
"BUILD_FLAVOUR": "validate",
"CONFIGURE_ARGS": "--with-intree-gmp",
"CONFIGURE_WRAPPER": "emconfigure",
"CROSS_TARGET": "js-unknown-ghcjs",
"TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate",
"CROSS_EMULATOR": "js-emulator",
"CROSS_TARGET": "javascript-unknown-ghcjs",
"TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate",
"XZ_OPT": "-9"
}
},
......@@ -3992,7 +3993,7 @@
"TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate"
}
},
"x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate": {
"x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate": {
"after_script": [
".gitlab/ci.sh save_cache",
".gitlab/ci.sh clean",
......@@ -4002,7 +4003,7 @@
"artifacts": {
"expire_in": "2 weeks",
"paths": [
"ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate.tar.xz",
"ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate.tar.xz",
"junit.xml"
],
"reports": {
......@@ -4044,12 +4045,13 @@
],
"variables": {
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate",
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate",
"BUILD_FLAVOUR": "validate",
"CONFIGURE_ARGS": "--with-intree-gmp",
"CONFIGURE_WRAPPER": "emconfigure",
"CROSS_TARGET": "js-unknown-ghcjs",
"TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-validate"
"CROSS_EMULATOR": "js-emulator",
"CROSS_TARGET": "javascript-unknown-ghcjs",
"TEST_ENV": "x86_64-linux-deb11-int_native-cross_javascript-unknown-ghcjs-validate"
}
},
"x86_64-linux-fedora33-release": {
......
......@@ -3,7 +3,6 @@
{-# LANGUAGE TupleSections, NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -ddump-stg-final -ddump-to-file #-}
-- -----------------------------------------------------------------------------
--
......@@ -358,7 +357,9 @@ import GHC.Utils.Monad
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
#if !defined(javascript_HOST_ARCH)
import GHC.Utils.Panic.Plain
#endif
import GHC.Utils.Logger
import GHC.Utils.Fingerprint
......@@ -559,13 +560,13 @@ withCleanupSession ghc = ghc `MC.finally` cleanup
initGhcMonad :: GhcMonad m => Maybe FilePath -> m ()
initGhcMonad mb_top_dir = setSession =<< liftIO ( do
#if !defined(javascript_HOST_ARCH)
-- The call to c_keepCAFsForGHCi must not be optimized away. Even in non-debug builds.
-- So we can't use assertM here.
-- See Note [keepCAFsForGHCi] in keepCAFsForGHCi.c for details about why.
-- #if MIN_VERSION_GLASGOW_HASKELL(9,7,0,0)
!keep_cafs <- c_keepCAFsForGHCi
massert keep_cafs
-- #endif
#endif
initHscEnv mb_top_dir
)
......@@ -1960,7 +1961,8 @@ instance Exception GhcApiError
mkApiErr :: DynFlags -> SDoc -> GhcApiError
mkApiErr dflags msg = GhcApiError (showSDoc dflags msg)
--
#if !defined(javascript_HOST_ARCH)
foreign import ccall unsafe "keepCAFsForGHCi"
c_keepCAFsForGHCi :: IO Bool
#endif
......@@ -38,7 +38,7 @@ llvmFixupAsm platform f1 f2 = {-# SCC "llvm_mangler" #-}
-- | These are the rewrites that the mangler will perform
rewrites :: [Rewrite]
rewrites = [rewriteSymType, rewriteAVX, rewriteCall]
rewrites = [rewriteSymType, rewriteAVX, rewriteCall, rewriteJump]
type Rewrite = Platform -> B.ByteString -> Maybe B.ByteString
......@@ -123,6 +123,29 @@ rewriteCall platform l
removePlt = replaceOnce (B.pack "@plt") (B.pack "")
appendInsn i = (`B.append` B.pack ("\n\t" ++ i))
-- | This rewrites bl and b jump inst to avoid creating PLT entries for
-- functions on loongarch64, because there is no separate call instruction
-- for function calls in loongarch64. Also, this replacement will load
-- the function address from the GOT, which is resolved to point to the
-- real address of the function.
rewriteJump :: Rewrite
rewriteJump platform l
| not isLoongArch64 = Nothing
| isBL l = Just $ replaceJump "bl" "$ra" "$ra" l
| isB l = Just $ replaceJump "b" "$zero" "$t0" l
| otherwise = Nothing
where
isLoongArch64 = platformArch platform == ArchLoongArch64
isBL = B.isPrefixOf (B.pack "bl\t")
isB = B.isPrefixOf (B.pack "b\t")
replaceJump jump rd rj l =
appendInsn ("jirl" ++ "\t" ++ rd ++ ", " ++ rj ++ ", 0") $ removeBracket $
replaceOnce (B.pack (jump ++ "\t%plt(")) (B.pack ("la\t" ++ rj ++ ", ")) l
where
removeBracket = replaceOnce (B.pack ")") (B.pack "")
appendInsn i = (`B.append` B.pack ("\n\t" ++ i))
-- | @replaceOnce match replace bs@ replaces the first occurrence of the
-- substring @match@ in @bs@ with @replace@.
replaceOnce :: B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString
......
......@@ -441,6 +441,7 @@ data DataCon
-- INVARIANT(dataConTyVars): the set of tyvars in dcUserTyVarBinders is
-- exactly the set of tyvars (*not* covars) of dcExTyCoVars unioned
-- with the set of dcUnivTyVars whose tyvars do not appear in dcEqSpec
-- So dcUserTyVarBinders is a subset of (dcUnivTyVars ++ dcExTyCoVars)
-- See Note [DataCon user type variable binders]
dcUserTyVarBinders :: [InvisTVBinder],
......
......@@ -142,7 +142,7 @@ initLateCCState :: LateCCState
initLateCCState = LateCCState newCostCentreState mempty
getCCFlavour :: FastString -> M CCFlavour
getCCFlavour name = LateCC <$> getCCIndex' name
getCCFlavour name = mkLateCCFlavour <$> getCCIndex' name
getCCIndex' :: FastString -> M CostCentreIndex
getCCIndex' name = do
......
......@@ -96,7 +96,6 @@ import Data.Foldable ( for_, toList )
import Data.List.NonEmpty ( NonEmpty(..), groupWith )
import Data.List ( partition )
import Data.Maybe
import Data.Ord ( comparing )
import GHC.Data.Pair
import GHC.Base (oneShot)
import GHC.Data.Unboxed
......@@ -478,7 +477,7 @@ lintCoreBindings' cfg binds
-- M.n{r3} = ...
-- M.n{r29} = ...
-- because they both get the same linker symbol
ext_dups = snd $ removeDups (comparing ord_ext) $
ext_dups = snd $ removeDupsOn ord_ext $
filter isExternalName $ map Var.varName binders
ord_ext n = (nameModule n, nameOccName n)
......
......@@ -648,12 +648,12 @@ mkSmallTupleSelector1 vars the_var scrut_var scrut
-- To avoid shadowing, we use uniques to invent new variables.
--
-- If necessary we pattern match on a "big" tuple.
mkBigTupleCase :: UniqSupply -- ^ For inventing names of intermediate variables
-> [Id] -- ^ The tuple identifiers to pattern match on;
mkBigTupleCase :: MonadUnique m -- For inventing names of intermediate variables
=> [Id] -- ^ The tuple identifiers to pattern match on;
-- Bring these into scope in the body
-> CoreExpr -- ^ Body of the case
-> CoreExpr -- ^ Scrutinee
-> CoreExpr
-> m CoreExpr
-- ToDo: eliminate cases where none of the variables are needed.
--
-- mkBigTupleCase uniqs [a,b,c,d] body v e
......@@ -661,11 +661,11 @@ mkBigTupleCase :: UniqSupply -- ^ For inventing names of intermediate vari
-- case p of p { (a,b) ->
-- case q of q { (c,d) ->
-- body }}}
mkBigTupleCase us vars body scrut
= mk_tuple_case wrapped_us (chunkify wrapped_vars) wrapped_body
mkBigTupleCase vars body scrut
= do us <- getUniqueSupplyM
let (wrapped_us, wrapped_vars, wrapped_body) = foldr unwrap (us,[],body) vars
return $ mk_tuple_case wrapped_us (chunkify wrapped_vars) wrapped_body
where
(wrapped_us, wrapped_vars, wrapped_body) = foldr unwrap (us,[],body) vars
scrut_ty = exprType scrut
unwrap var (us,vars,body)
......
......@@ -84,7 +84,7 @@ doExpr env e@(Var v)
span = case revParents env of
top:_ -> nameSrcSpan $ varName top
_ -> noSrcSpan
cc = NormalCC (ExprCC ccIdx) ccName (thisModule env) span
cc = NormalCC (mkExprCCFlavour ccIdx) ccName (thisModule env) span
tick :: CoreTickish
tick = ProfNote cc count True
pure $ Tick tick e
......
......@@ -433,7 +433,6 @@ inlining.
Exit join points, recognizable using `isExitJoinId` are join points with an
occurrence in a recursive group, and can be recognized (after the occurrence
analyzer ran!) using `isExitJoinId`.
This function detects joinpoints with `occ_in_lam (idOccinfo id) == True`,
because the lambdas of a non-recursive join point are not considered for
`occ_in_lam`. For example, in the following code, `j1` is /not/ marked
......@@ -447,29 +446,6 @@ To prevent inlining, we check for isExitJoinId
* In `simplLetUnfolding` we simply give exit join points no unfolding, which
prevents inlining in `postInlineUnconditionally` and call sites.
But see Note [Be selective about not-inlining exit join points]
Note [Be selective about not-inlining exit join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we follow "do not inline exit join points" mantra throughout,
some bad things happen.
* We can lose CPR information: see #21148
* We get useless clutter (#22084) that
- makes the program bigger (including duplicated code #20739), and
- adds extra jumps (and maybe stack saves) at runtime
So instead we follow "do not inline exit join points" for a /single run/
of the simplifier, right after Exitification. That should give a
sufficient chance for used-once things to inline, but subsequent runs
will inline them back in. (Annoyingly, as things stand, only with -O2
is there a subsequent run, but that might change, and it's not a huge
deal anyway.)
This is controlled by the Simplifier's sm_keep_exits flag; see
GHC.Core.Opt.Pipeline.
Note [Placement of the exitification pass]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I (Joachim) experimented with multiple positions for the Exitification pass in
......
......@@ -15,7 +15,7 @@ import GHC.Driver.Plugins ( withPlugins, installCoreToDos )
import GHC.Driver.Env
import GHC.Driver.Config.Core.Lint ( endPass )
import GHC.Driver.Config.Core.Opt.LiberateCase ( initLiberateCaseOpts )
import GHC.Driver.Config.Core.Opt.Simplify ( initSimplifyOpts, initSimplMode )
import GHC.Driver.Config.Core.Opt.Simplify ( initSimplifyOpts, initSimplMode, initGentleSimplMode )
import GHC.Driver.Config.Core.Opt.WorkWrap ( initWorkWrapOpts )
import GHC.Driver.Config.Core.Rules ( initRuleOpts )
import GHC.Platform.Ways ( hasWay, Way(WayProf) )
......@@ -28,7 +28,6 @@ import GHC.Core.Utils ( dumpIdInfoOfProgram )
import GHC.Core.Lint ( lintAnnots )
import GHC.Core.Lint.Interactive ( interactiveInScope )
import GHC.Core.Opt.Simplify ( simplifyExpr, simplifyPgm )
import GHC.Core.Opt.Simplify.Env( SimplMode(..) )
import GHC.Core.Opt.Simplify.Monad
import GHC.Core.Opt.Monad
import GHC.Core.Opt.Pipeline.Types
......@@ -153,45 +152,32 @@ getCoreToDo dflags hpt_rule_base extra_vars
maybe_strictness_before _
= CoreDoNothing
----------------------------
base_simpl_mode :: SimplMode
base_simpl_mode = initSimplMode dflags
-- gentle_mode: make specialiser happy: minimum effort please
-- See Note [Inline in InitialPhase]
-- See Note [RULEs enabled in InitialPhase]
gentle_mode = base_simpl_mode { sm_names = ["Gentle"]
, sm_phase = InitialPhase
, sm_case_case = False }
simpl_mode phase name
= base_simpl_mode { sm_names = [name], sm_phase = phase }
keep_exits :: SimplMode -> SimplMode
-- See Note [Be selective about not-inlining exit join points]
-- in GHC.Core.Opt.Exitify
keep_exits mode = mode { sm_keep_exits = True }
----------------------------
run_simplifier mode iter
= CoreDoSimplify $ initSimplifyOpts dflags extra_vars iter mode hpt_rule_base
simpl_phase phase name iter = CoreDoPasses $
[ maybe_strictness_before phase
, run_simplifier (simpl_mode phase name) iter
, maybe_rule_check phase ]
simpl_phase phase name iter
= CoreDoPasses
$ [ maybe_strictness_before phase
, CoreDoSimplify $ initSimplifyOpts dflags extra_vars iter
(initSimplMode dflags phase name) hpt_rule_base
, maybe_rule_check phase ]
-- Run GHC's internal simplification phase, after all rules have run.
-- See Note [Compiler phases] in GHC.Types.Basic
simpl_gently = run_simplifier gentle_mode max_iter
simplify_final name = run_simplifier ( simpl_mode FinalPhase name) max_iter
simpl_keep_exits name = run_simplifier (keep_exits $ simpl_mode FinalPhase name) max_iter
simplify name = simpl_phase FinalPhase name max_iter
-- initial simplify: mk specialiser happy: minimum effort please
-- See Note [Inline in InitialPhase]
-- See Note [RULEs enabled in InitialPhase]
simpl_gently = CoreDoSimplify $ initSimplifyOpts dflags extra_vars max_iter
(initGentleSimplMode dflags) hpt_rule_base
----------------------------
dmd_cpr_ww = if ww_on then [CoreDoDemand True,CoreDoCpr,CoreDoWorkerWrapper]
else [CoreDoDemand False] -- NB: No CPR! See Note [Don't change boxity without worker/wrapper]
demand_analyser = (CoreDoPasses (
dmd_cpr_ww ++
[simplify "post-worker-wrapper"]
))
-- Static forms are moved to the top level with the FloatOut pass.
-- See Note [Grand plan for static forms] in GHC.Iface.Tidy.StaticPtrTable.
static_ptrs_float_outwards =
......@@ -281,16 +267,14 @@ getCoreToDo dflags hpt_rule_base extra_vars
runWhen call_arity $ CoreDoPasses
[ CoreDoCallArity
, simplify_final "post-call-arity"
, simplify "post-call-arity"
],
-- Strictness analysis
runWhen strictness $ CoreDoPasses
(dmd_cpr_ww ++ [simplify_final "post-worker-wrapper"]),
runWhen strictness demand_analyser,
runWhen exitification CoreDoExitify,
-- See Note [Placement of the exitification pass]
-- in GHC.Core.Opt.Exitify
runWhen full_laziness $
CoreDoFloatOutwards FloatOutSwitches {
......@@ -312,17 +296,7 @@ getCoreToDo dflags hpt_rule_base extra_vars
runWhen do_float_in CoreDoFloatInwards,
-- Final tidy-up run of the simplifier
simpl_keep_exits "final tidy up",
-- Keep exit join point because this is the first
-- Simplifier run after Exitify. Subsequent runs will
-- re-inline those exit join points; their work is done.
-- See Note [Be selective about not-inlining exit join points]
-- in GHC.Core.Opt.Exitify
--
-- Annoyingly, we only /have/ a subsequent run with -O2. With
-- plain -O we'll still have those exit join points hanging around.
-- Oh well.
simplify "final", -- Final tidy-up
maybe_rule_check FinalPhase,
......@@ -332,31 +306,31 @@ getCoreToDo dflags hpt_rule_base extra_vars
-- Case-liberation for -O2. This should be after
-- strictness analysis and the simplification which follows it.
runWhen liberate_case $ CoreDoPasses
[ CoreLiberateCase, simplify_final "post-liberate-case" ],
[ CoreLiberateCase, simplify "post-liberate-case" ],
-- Run the simplifier after LiberateCase to vastly
-- reduce the possibility of shadowing
-- Reason: see Note [Shadowing] in GHC.Core.Opt.SpecConstr
runWhen spec_constr $ CoreDoPasses
[ CoreDoSpecConstr, simplify_final "post-spec-constr"],
[ CoreDoSpecConstr, simplify "post-spec-constr"],
-- See Note [Simplify after SpecConstr]
maybe_rule_check FinalPhase,
runWhen late_specialise $ CoreDoPasses
[ CoreDoSpecialising, simplify_final "post-late-spec"],
[ CoreDoSpecialising, simplify "post-late-spec"],
-- LiberateCase can yield new CSE opportunities because it peels
-- off one layer of a recursive function (concretely, I saw this
-- in wheel-sieve1), and I'm guessing that SpecConstr can too
-- And CSE is a very cheap pass. So it seems worth doing here.
runWhen ((liberate_case || spec_constr) && cse) $ CoreDoPasses
[ CoreCSE, simplify_final "post-final-cse" ],
[ CoreCSE, simplify "post-final-cse" ],
--------- End of -O2 passes --------------
runWhen late_dmd_anal $ CoreDoPasses (
dmd_cpr_ww ++ [simplify_final "post-late-ww"]
dmd_cpr_ww ++ [simplify "post-late-ww"]
),
-- Final run of the demand_analyser, ensures that one-shot thunks are
......
......@@ -248,16 +248,13 @@ data SimplMode = SimplMode -- See comments in GHC.Core.Opt.Simplify.Monad
, sm_uf_opts :: !UnfoldingOpts -- ^ Unfolding options
, sm_case_case :: !Bool -- ^ Whether case-of-case is enabled
, sm_pre_inline :: !Bool -- ^ Whether pre-inlining is enabled
, sm_keep_exits :: !Bool -- ^ True <=> keep ExitJoinIds
-- See Note [Do not inline exit join points]
-- in GHC.Core.Opt.Exitify
, sm_float_enable :: !FloatEnable -- ^ Whether to enable floating out
, sm_float_enable :: !FloatEnable -- ^ Whether to enable floating out
, sm_do_eta_reduction :: !Bool
, sm_arity_opts :: !ArityOpts
, sm_rule_opts :: !RuleOpts
, sm_case_folding :: !Bool
, sm_case_merge :: !Bool
, sm_co_opt_opts :: !OptCoercionOpts -- ^ Coercion optimiser options
, sm_arity_opts :: !ArityOpts
, sm_rule_opts :: !RuleOpts
, sm_case_folding :: !Bool
, sm_case_merge :: !Bool
, sm_co_opt_opts :: !OptCoercionOpts -- ^ Coercion optimiser options
}
instance Outputable SimplMode where
......
......@@ -1395,11 +1395,11 @@ preInlineUnconditionally
-- Reason: we don't want to inline single uses, or discard dead bindings,
-- for unlifted, side-effect-ful bindings
preInlineUnconditionally env top_lvl bndr rhs rhs_env
| not pre_inline = Nothing
| not pre_inline_unconditionally = Nothing
| not active = Nothing
| isTopLevel top_lvl && isDeadEndId bndr = Nothing -- Note [Top-level bottoming Ids]
| isCoVar bndr = Nothing -- Note [Do not inline CoVars unconditionally]
| keep_exits, isExitJoinId bndr = Nothing -- Note [Do not inline exit join points]
| isExitJoinId bndr = Nothing -- Note [Do not inline exit join points]
-- in module Exitify
| not (one_occ (idOccInfo bndr)) = Nothing
| not (isStableUnfolding unf) = Just $! (extend_subst_with rhs)
......@@ -1409,36 +1409,19 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env
, Just inl <- maybeUnfoldingTemplate unf = Just $! (extend_subst_with inl)
| otherwise = Nothing
where
mode = seMode env
phase = sm_phase mode
keep_exits = sm_keep_exits mode
pre_inline = sm_pre_inline mode
unf = idUnfolding bndr
extend_subst_with inl_rhs = extendIdSubst env bndr $! (mkContEx rhs_env inl_rhs)
one_occ IAmDead = True -- Happens in ((\x.1) v)
one_occ OneOcc{ occ_n_br = 1
, occ_in_lam = NotInsideLam } = isNotTopLevel top_lvl || early_phase
one_occ OneOcc{ occ_n_br = 1
, occ_in_lam = IsInsideLam
, occ_int_cxt = IsInteresting } = canInlineInLam rhs
one_occ _ = False
one_occ OneOcc{ occ_n_br = 1 } -- Inline join point that are used once, even inside
| isJoinId bndr = True -- lambdas (which are presumably other join points)
-- E.g. join j x = rhs in
-- joinrec k y = ....j x....
-- Here j must be an exit for k, and we can safely inline it under the lambda
-- This includes the case where j is nullary: a nullary join point is just the
-- same as an arity-1 one. So we don't look at occ_int_cxt.
-- All of this only applies if keep_exits is False, otherwise the
-- earlier guard on preInlineUnconditionally would have fired
one_occ _ = False
active = isActive phase (inlinePragmaActivation inline_prag)
pre_inline_unconditionally = sePreInline env
active = isActive (sePhase env) (inlinePragmaActivation inline_prag)
-- See Note [pre/postInlineUnconditionally in gentle mode]
inline_prag = idInlinePragma bndr
......@@ -1470,7 +1453,7 @@ preInlineUnconditionally env top_lvl bndr rhs rhs_env
-- not ticks. Counting ticks cannot be duplicated, and non-counting
-- ticks around a Lam will disappear anyway.
early_phase = phase /= FinalPhase
early_phase = sePhase env /= FinalPhase
-- If we don't have this early_phase test, consider
-- x = length [1,2,3]
-- The full laziness pass carefully floats all the cons cells to
......
......@@ -1532,10 +1532,8 @@ scExpr' env (Case scrut b ty alts)
scrut_occ = case con of
DataAlt dc -- See Note [Do not specialise evals]
| not (single_alt && all deadArgOcc arg_occs)
-> -- pprTrace "sc_alt1" (ppr b' $$ ppr con $$ ppr bs $$ ppr arg_occs) $
ScrutOcc (unitUFM dc arg_occs)
_ -> -- pprTrace "sc_alt1" (ppr b' $$ ppr con $$ ppr bs $$ ppr arg_occs) $
UnkOcc
-> ScrutOcc (unitUFM dc arg_occs)
_ -> UnkOcc
; return (usg', b_occ `combineOcc` scrut_occ, Alt con bs2 rhs') }
......
......@@ -707,7 +707,7 @@ Worker/wrapper will unbox
* is an algebraic data type (not a newtype)
* is not recursive (as per 'isRecDataCon')
* has a single constructor (thus is a "product")
* that may bind existentials
* that may bind existentials (#18982)
We can transform
> data D a = forall b. D a b
> f (D @ex a b) = e
......@@ -1272,16 +1272,25 @@ also unbox its components. That is governed by the `usefulSplit` mechanism.
-}
-- | Exactly 'dataConInstArgTys', but lacks the (ASSERT'ed) precondition that
-- the 'DataCon' may not have existentials. The lack of cloning the existentials
-- compared to 'dataConInstExAndArgVars' makes this function \"dubious\";
-- only use it where type variables aren't substituted for!
-- the 'DataCon' may not have existentials. The lack of cloning the
-- existentials this function \"dubious\"; only use it where type variables
-- aren't substituted for! Why may the data con bind existentials?
-- See Note [Which types are unboxed?]
dubiousDataConInstArgTys :: DataCon -> [Type] -> [Type]
dubiousDataConInstArgTys dc tc_args = arg_tys
where
univ_tvs = dataConUnivTyVars dc
ex_tvs = dataConExTyCoVars dc
subst = extendSubstInScopeList (zipTvSubst univ_tvs tc_args) ex_tvs
arg_tys = map (GHC.Core.Type.substTy subst . scaledThing) (dataConRepArgTys dc)
univ_tvs = dataConUnivTyVars dc
ex_tvs = dataConExTyCoVars dc
univ_subst = zipTvSubst univ_tvs tc_args
(full_subst, _) = substTyVarBndrs univ_subst ex_tvs
arg_tys = map (substTy full_subst . scaledThing) $
dataConRepArgTys dc
-- NB: use substTyVarBndrs on ex_tvs to ensure that we
-- substitute in their kinds. For example (#22849)
-- Consider data T a where
-- MkT :: forall k (t::k->*) (ix::k). t ix -> T @k a
-- Then dubiousDataConInstArgTys MkT [Type, Foo] should return
-- [Foo (ix::Type)], not [Foo (ix::k)]!
findTypeShape :: FamInstEnvs -> Type -> TypeShape
-- Uncover the arrow and product shape of a type
......
......@@ -62,6 +62,7 @@ import GHC.Core.Coercion as Coercion
import GHC.Core.Tidy ( tidyRules )
import GHC.Core.Map.Expr ( eqCoreExpr )
import GHC.Core.Opt.Arity( etaExpandToJoinPointRule )
import GHC.Core.Make ( mkCoreLams )
import GHC.Tc.Utils.TcType ( tcSplitTyConApp_maybe )
import GHC.Builtin.Types ( anyTypeOfKind )
......@@ -82,6 +83,7 @@ import GHC.Types.Basic
import GHC.Data.FastString
import GHC.Data.Maybe
import GHC.Data.Bag
import GHC.Data.List.SetOps( hasNoDups )
import GHC.Utils.Misc as Utils
import GHC.Utils.Outputable
......@@ -881,8 +883,13 @@ rvInScopeEnv renv = ISE (rnInScopeSet (rv_lcl renv)) (rv_unf renv)
-- * The BindWrapper in a RuleSubst are the bindings floated out
-- from nested matches; see the Let case of match, below
--
data RuleSubst = RS { rs_tv_subst :: TvSubstEnv -- Range is the
, rs_id_subst :: IdSubstEnv -- template variables
data RuleSubst = RS { -- Substitution; applied only to the template, not the target
-- Domain is the template variables
-- Range never includes template variables
rs_tv_subst :: TvSubstEnv
, rs_id_subst :: IdSubstEnv
-- Floated bindings
, rs_binds :: BindWrapper -- Floated bindings
, rs_bndrs :: [Var] -- Variables bound by floated lets
}
......@@ -1059,6 +1066,165 @@ match renv subst e1 (Var v2) mco -- Note [Expanding variables]
-- because of the not-inRnEnvR
------------------------ Applications ---------------------
-- See Note [Matching higher order patterns]
match renv@(RV { rv_tmpls = tmpls, rv_lcl = rn_env })
subst e1@App{} e2
MRefl -- Like the App case we insist on Refl here
-- See Note [Casts in the target]
| (Var f, args) <- collectArgs e1
, let f' = rnOccL rn_env f -- See similar rnOccL in match_var
, f' `elemVarSet` tmpls -- (HOP1)
, Just vs2 <- traverse arg_as_lcl_var args -- (HOP2), (HOP3)
, hasNoDups vs2 -- (HOP4)
, not can_decompose_app_instead
= match_tmpl_var renv subst f' (mkCoreLams vs2 e2)
-- match_tmpl_var checks (HOP5) and (HOP6)
where
arg_as_lcl_var :: CoreExpr -> Maybe Var
arg_as_lcl_var (Var v)
| Just v' <- rnOccL_maybe rn_env v
, not (v' `elemVarSet` tmpls) -- rnEnvL contains the template variables
= Just (to_target v') -- to_target: see (W1)
-- in Note [Matching higher order patterns]
arg_as_lcl_var _ = Nothing
can_decompose_app_instead -- Template (e1 v), target (e2 v), and v # fvs(e2)
= case (e1, e2) of -- See (W2) in Note [Matching higher order patterns]
(App _ (Var v1), App f2 (Var v2))
-> rnOccL rn_env v1 == rnOccR rn_env v2
&& not (v2 `elemVarSet` exprFreeVars f2)
_ -> False
----------------
-- to_target: see (W1) in Note [Matching higher order patterns]
to_target :: Var -> Var -- From canonical variable back to target-expr variable
to_target v = lookupVarEnv rev_envR v `orElse` v
rev_envR :: VarEnv Var -- Inverts rnEnvR: from canonical variable
-- back to target-expr variable
rev_envR = nonDetStrictFoldVarEnv_Directly add_one emptyVarEnv (rnEnvR rn_env)
add_one uniq var env = extendVarEnv env var (var `setVarUnique` uniq)
{- Note [Matching higher order patterns]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Higher order patterns provide a limited form of higher order matching.
See GHC Proposal #555
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0555-template-patterns.rst
and #22465 for more details and related work.
Consider the potential match:
Template: forall f. foo (\x -> f x)
Target: foo (\x -> x*2 + x)
The expression `x*2 + x` in the target is not literally an application of a
function to the variable `x`, so the simple application rule does not apply.
However, we can match them modulo beta equivalence with the substitution:
[f :-> \x -> x*2 + x]
The general problem of higher order matching is tricky to implement, but
the subproblem which we call /higher order pattern matching/ is sufficient
for the given example and much easier to implement.
Design:
We start with terminology.
* /Template variables/. The forall'd variables are called the template
variables. In the example match above, `f` is a template variable.
* /Local binders/. The local binders of a rule are the variables bound
inside the template. In the example match above, `x` is a local binder.
Note that local binders can be term variables and type variables.
A /higher order pattern/ (HOP) is a sub-expression of the template,
of form (f x y z) where:
* (HOP1) f is a template variable
* (HOP2) x, y, z are local binders (like y in rule "wombat" above; see definitions).
* (HOP3) The arguments x, y, z are term variables
* (HOP4) The arguments x, y, z are distinct (no duplicates)
Matching of higher order patterns (HOP-matching). A higher order pattern (f x y z)
(in the template) matches any target expression e provided:
* (HOP5) The target has the same type as the template
* (HOP6) No local binder is free in e, other than x, y, z.
If these two condition hold, the higher order pattern (f x y z) matches
the target expression e, yielding the substitution [f :-> \x y z. e].
Notice that this substitution is type preserving, and the RHS
of the substitution has no free local binders.
HOP matching is small enough to be done in-line in the `match` function.
Two wrinkles:
(W1) Consider the potential match:
Template: forall f. foo (\x -> f x)
Target: foo (\y -> (y, y))
During matching we make `x` the canonical variable for the lambdas
and then we see:
Template: f x rnEnvL = []
Target: (y, y) rnEnvR = [y :-> x]
We could bind [f :-> \x. (x,x)], by applying rnEnvR substitution to the target
expression. But that is tiresome (a) because it involves a traversal, and
(b) because rnEnvR is a VarEnv Var, and we don't have a substitution function
for that.
So instead, we invert rnEnvR, and apply it to the binders, to get
[f :-> \y. (y,y)]. This is done by `to_target` in the HOP-matching case.
It takes a little bit of thinking to be sure this will work right in the case
of shadowing. E.g. Template (\x y. f x y) Target (\p p. p*p)
Here rnEnvR will be just [p :-> y], so after inversion we'll get
[f :-> \x p. p*p]
but that is fine.
(W2) This wrinkle concerns the overlp between the new HOP rule and the existing
decompose-application rule. See 3.1 of GHC Proposal #555 for a discussion.
Consider potential match:
Template: forall f. foo (\x y. Just (f y x))
Target: foo (\p q. Just (h (1+q) p)))
During matching we will encounter:
Template: f x y
Target: h (1+q) p rnEnvR = [p:->x, q:->y]
The rnEnvR renaming `[p:->x, q:->y]` is done by the matcher (today) on the fly,
to make the bound variables of the template and target "line up".
But now we can:
* Either use the new HOP rule to succeed with
[f :-> \x y. h (1+x) y]
* Or use the existing decompose-application rule to match
(f x) against (h (1+q)) and `y` against `p`.
This will succeed with
[f :-> \y. h (1+y)]
Note that the result of the HOP rule will always be eta-equivalent to
the result of the decompose-application rule. But the proposal specifies
that we should use the decompose-application rule because it involves
less eta-expansion.
But take care:
Template: forall f. foo (\x y. Just (f y x))
Target: foo (\p q. Just (h (p+q) p)))
Then during matching we will encounter:
Template: f x y
Target: h (p+q) p rnEnvR = [p:->x, q:->y]
Now, we cannot use the decompose-application rule, because p is free in
(h (p+q)). So, we can only use the new HOP rule.
(W3) You might wonder if a HOP can have /type/ arguments, thus (in Core)
RULE forall h.
f (\(MkT @b (d::Num b) (x::b)) -> h @b d x) = ...
where the HOP is (h @b d x). In principle this might be possible, but
it seems fragile; e.g. we would still need to insist that the (invisible)
@b was a type variable. And since `h` gets a polymoprhic type, that
type would have to be declared by the programmer.
Maybe one day. But for now, we insist (in `arg_as_lcl_var`)that a HOP
has only term-variable arguments.
-}
-- Note the match on MRefl! We fail if there is a cast in the target
-- (e1 e2) ~ (d1 d2) |> co
-- See Note [Cancel reflexive casts]: in the Cast equations for 'match'
......@@ -1358,7 +1524,7 @@ match_tmpl_var renv@(RV { rv_lcl = rn_env, rv_fltR = flt_env })
-- if the right side of the env is empty.
| anyInRnEnvR rn_env (exprFreeVars e2)
= Nothing -- Skolem-escape failure
-- e.g. match forall a. (\x-> a x) against (\y. y y)
-- e.g. match forall a. (\x -> a) against (\y -> y)
| Just e1' <- lookupVarEnv id_subst v1'
= if eqCoreExpr e1' e2'
......@@ -1378,6 +1544,7 @@ match_tmpl_var renv@(RV { rv_lcl = rn_env, rv_fltR = flt_env })
-- because no free var of e2' is in the rnEnvR of the envt
------------------------------------------
match_ty :: RuleMatchEnv
-> RuleSubst
-> Type -- Template
......@@ -1389,12 +1556,13 @@ match_ty :: RuleMatchEnv
-- newtype T = MkT Int
-- We only want to replace (f T) with f', not (f Int).
match_ty renv subst ty1 ty2
= do { tv_subst'
<- Unify.ruleMatchTyKiX (rv_tmpls renv) (rv_lcl renv) tv_subst ty1 ty2
match_ty (RV { rv_tmpls = tmpls, rv_lcl = rn_env })
subst@(RS { rs_tv_subst = tv_subst })
ty1 ty2
= do { tv_subst' <- Unify.ruleMatchTyKiX tmpls rn_env tv_subst ty1 ty2
-- NB: ruleMatchTyKiX applis tv_subst to ty1 only
-- and of course only binds 'tmpls'
; return (subst { rs_tv_subst = tv_subst' }) }
where
tv_subst = rs_tv_subst subst
{- Note [Matching variable types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -194,7 +194,7 @@ Note [Type synonym families]
* Type synonym families, also known as "type functions", map directly
onto the type functions in FC:
type family F a :: *
type family F a :: Type
type instance F Int = Bool
..etc...
......@@ -210,11 +210,11 @@ Note [Type synonym families]
type instance F (F Int) = ... -- BAD!
* Translation of type family decl:
type family F a :: *
type family F a :: Type
translates to
a FamilyTyCon 'F', whose FamTyConFlav is OpenSynFamilyTyCon
type family G a :: * where
type family G a :: Type where
G Int = Bool
G Bool = Char
G a = ()
......@@ -229,7 +229,7 @@ Note [Data type families]
See also Note [Wrappers for data instance tycons] in GHC.Types.Id.Make
* Data type families are declared thus
data family T a :: *
data family T a :: Type
data instance T Int = T1 | T2 Bool
Here T is the "family TyCon".
......@@ -321,7 +321,7 @@ See also Note [Wrappers for data instance tycons] in GHC.Types.Id.Make
should not think of a data family T as a *type function* at all, not
even an injective one! We can't allow even injective type functions
on the LHS of a type function:
type family injective G a :: *
type family injective G a :: Type
type instance F (G Int) = Bool
is no good, even if G is injective, because consider
type instance G Int = Bool
......@@ -572,21 +572,21 @@ Since they are user-callable we must get their type-argument visibility
information right; and that info is in the TyConBinders.
Here is an example:
data App a b = MkApp (a b) -- App :: forall {k}. (k->*) -> k -> *
data App a b = MkApp (a b) -- App :: forall {k}. (k->Type) -> k -> Type
The TyCon has
tyConTyBinders = [ Named (Bndr (k :: *) Inferred), Anon (k->*), Anon k ]
tyConTyBinders = [ Named (Bndr (k :: Type) Inferred), Anon (k->Type), Anon k ]
The TyConBinders for App line up with App's kind, given above.
But the DataCon MkApp has the type
MkApp :: forall {k} (a:k->*) (b:k). a b -> App k a b
MkApp :: forall {k} (a:k->Type) (b:k). a b -> App k a b
That is, its ForAllTyBinders should be
dataConUnivTyVarBinders = [ Bndr (k:*) Inferred
, Bndr (a:k->*) Specified
dataConUnivTyVarBinders = [ Bndr (k:Type) Inferred
, Bndr (a:k->Type) Specified
, Bndr (b:k) Specified ]
So tyConTyVarBinders converts TyCon's TyConBinders into TyVarBinders:
......@@ -620,8 +620,8 @@ They fit together like so:
type App a (b :: k) = a b
tyConBinders = [ Bndr (k::*) (NamedTCB Inferred)
, Bndr (a:k->*) AnonTCB
tyConBinders = [ Bndr (k::Type) (NamedTCB Inferred)
, Bndr (a:k->Type) AnonTCB
, Bndr (b:k) AnonTCB ]
Note that there are three binders here, including the
......@@ -636,13 +636,13 @@ They fit together like so:
that TyVar may scope over some other part of the TyCon's definition. Eg
type T a = a -> a
we have
tyConBinders = [ Bndr (a:*) AnonTCB ]
tyConBinders = [ Bndr (a:Type) AnonTCB ]
synTcRhs = a -> a
So the 'a' scopes over the synTcRhs
* From the tyConBinders and tyConResKind we can get the tyConKind
E.g for our App example:
App :: forall k. (k->*) -> k -> *
App :: forall k. (k->Type) -> k -> Type
We get a 'forall' in the kind for each NamedTCB, and an arrow
for each AnonTCB
......@@ -725,15 +725,15 @@ instance Binary TyConBndrVis where
-- things such as:
--
-- 1) Data declarations: @data Foo = ...@ creates the @Foo@ type constructor of
-- kind @*@
-- kind @Type@
--
-- 2) Type synonyms: @type Foo = ...@ creates the @Foo@ type constructor
--
-- 3) Newtypes: @newtype Foo a = MkFoo ...@ creates the @Foo@ type constructor
-- of kind @* -> *@
-- of kind @Type -> Type@
--
-- 4) Class declarations: @class Foo where@ creates the @Foo@ type constructor
-- of kind @*@
-- of kind @Constraint@
--
-- This data type also encodes a number of primitive, built in type constructors
-- such as those for function and tuple types.
......@@ -1252,16 +1252,16 @@ data FamTyConFlav
--
-- These are introduced by either a top level declaration:
--
-- > data family T a :: *
-- > data family T a :: Type
--
-- Or an associated data type declaration, within a class declaration:
--
-- > class C a b where
-- > data T b :: *
-- > data T b :: Type
DataFamilyTyCon
TyConRepName
-- | An open type synonym family e.g. @type family F x y :: * -> *@
-- | An open type synonym family e.g. @type family F x y :: Type -> Type@
| OpenSynFamilyTyCon
-- | A closed type synonym family e.g.
......
......@@ -2090,9 +2090,8 @@ dataConInstPat fss uniqs mult con inst_tys
arg_ids = zipWith4 mk_id_var id_uniqs id_fss arg_tys arg_strs
mk_id_var uniq fs (Scaled m ty) str
= setCaseBndrEvald str $ -- See Note [Mark evaluated arguments]
mkLocalIdOrCoVar name (mult `mkMultMul` m) (Type.substTy full_subst ty)
where
name = mkInternalName uniq (mkVarOccFS fs) noSrcSpan
mkUserLocalOrCoVar (mkVarOccFS fs) uniq
(mult `mkMultMul` m) (Type.substTy full_subst ty) noSrcSpan
{-
Note [Mark evaluated arguments]
......