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 (872)
Showing
with 1901 additions and 881 deletions
......@@ -78,6 +78,7 @@ _darcs/
/libffi/dist-install/
/libraries/*/dist-boot/
/libraries/*/dist-install/
/libraries/*/dist-newstyle/
/libraries/dist-haddock/
/rts/dist/
/utils/*/dist*/
......@@ -227,8 +228,17 @@ ghc.nix/
.gdb_history
.gdbinit
# Tooling - direnv
# -----------------------------------------------------------------------------
# Tooling
# direnv
.envrc
# Tooling - vscode
# Visual Studio Code
.vscode
# Tooling - ghcide
*.hiedb
# clangd
.clangd
......@@ -2,11 +2,11 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 6223fe0b5942f4fa35bdec92c74566cf195bfb42
DOCKER_REV: 0da9c4be73f2d73868f610d20352af856e8f2727
# Sequential version number capturing the versions of all tools fetched by
# .gitlab/ci.sh.
WINDOWS_TOOLCHAIN_VERSION: 1
# .gitlab/ci.sh. Used for invalidation of GitLab CI cache.
WINDOWS_TOOLCHAIN_VERSION: 4
# Disable shallow clones; they break our linting rules
GIT_DEPTH: 0
......@@ -17,22 +17,39 @@ variables:
GIT_SUBMODULE_STRATEGY: "recursive"
stages:
- lint # Source linting
- quick-build # A very quick smoke-test to weed out broken commits
- build # A quick smoke-test to weed out broken commits
- full-build # Build all the things
- cleanup # See Note [Cleanup after the shell executor]
- packaging # Source distribution, etc.
- testing # head.hackage correctness and compiler performance testing
- deploy # push documentation
- tool-lint # Source linting of the tools
- quick-build # A very quick smoke-test to weed out broken commits
- lint # Source linting of GHC
- build # A quick smoke-test to weed out broken commits
- full-build # Build all the things
- packaging # Source distribution, etc.
- testing # head.hackage correctness and compiler performance testing
- deploy # push documentation
# Note [The CI Story]
# ~~~~~~~~~~~~~~~~~~~
#
# There are two different types of pipelines:
#
# - marge-bot merges to `master`. Here we perform an exhaustive validation
# across all of the platforms which we support. In addition, we push
# performance metric notes upstream, providing a persistent record of the
# performance characteristics of the compiler.
#
# - merge requests. Here we perform a slightly less exhaustive battery of
# testing. Namely we omit some configurations (e.g. the unregisterised job).
# These use the merge request's base commit for performance metric
# comparisons.
#
workflow:
# N.B.Don't run on wip/ branches, instead on run on merge requests.
# N.B. Don't run on wip/ branches, instead on run on merge requests.
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
- if: '$CI_COMMIT_BRANCH == "wip/marge_bot_batch_merge_job"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/'
- if: '$CI_PIPELINE_SOURCE == "web"'
.nightly: &nightly
......@@ -45,12 +62,11 @@ workflow:
.release: &release
variables:
BUILD_FLAVOUR: "perf"
FLAVOUR: "perf"
artifacts:
when: always
expire_in: 1 year
rules:
- if: '$RELEASE == "yes"'
- if: '$RELEASE_JOB == "yes"'
############################################################
# Runner Tags
......@@ -65,11 +81,11 @@ workflow:
############################################################
# Linting
# tool linting
############################################################
ghc-linters:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
......@@ -89,7 +105,7 @@ ghc-linters:
# Run mypy Python typechecker on linter scripts.
lint-linters:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- mypy .gitlab/linters/*.py
......@@ -99,17 +115,17 @@ lint-linters:
# Check that .T files all parse by listing broken tests.
lint-testsuite:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
script:
- make -Ctestsuite list_broken TEST_HC=ghc
- make -Ctestsuite list_broken TEST_HC=$GHC
dependencies: []
tags:
- lint
# Run mypy Python typechecker on testsuite driver
typecheck-testsuite:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- mypy testsuite/driver/runtests.py
......@@ -121,7 +137,7 @@ typecheck-testsuite:
# accommodate, e.g., haddock changes not yet upstream) but not on `master` or
# Marge jobs.
.lint-submods:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
......@@ -153,7 +169,7 @@ lint-submods-branch:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
.lint-changelogs:
stage: lint
stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
dependencies: []
tags:
......@@ -173,14 +189,13 @@ lint-release-changelogs:
rules:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
############################################################
# Validation via Pipelines (hadrian)
############################################################
.validate-hadrian:
variables:
FLAVOUR: "validate"
BUILD_FLAVOUR: "validate"
script:
- .gitlab/ci.sh setup
- .gitlab/ci.sh configure
......@@ -190,12 +205,13 @@ lint-release-changelogs:
key: hadrian
paths:
- cabal-cache
dependencies: []
artifacts:
reports:
junit: junit.xml
expire_in: 2 week
paths:
- ghc.tar.xz
- "$BIN_DIST_NAME.tar.xz"
- junit.xml
.validate-linux-hadrian:
......@@ -203,6 +219,7 @@ lint-release-changelogs:
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
variables:
TEST_ENV: "x86_64-linux-deb9-hadrian"
BIN_DIST_NAME: "ghc-x86_64-deb9-linux"
before_script:
# workaround for docker permissions
- sudo chown ghc:ghc -R .
......@@ -211,23 +228,52 @@ lint-release-changelogs:
- git checkout .gitmodules
- "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
after_script:
- cp -Rf $HOME/.cabal cabal-cache
- .gitlab/ci.sh clean
tags:
- x86_64-linux
# Verify that Hadrian builds with stack. Note that we don't actually perform a
# build of GHC itself; we merely test that the Hadrian executable builds and
# works (by invoking `hadrian --version`).
stack-hadrian-build:
extends: .validate-linux-hadrian
stage: build
script:
- .gitlab/ci.sh setup
- .gitlab/ci.sh configure
- hadrian/build-stack --version
validate-x86_64-linux-deb9-hadrian:
extends: .validate-linux-hadrian
needs: [hadrian-ghc-in-ghci]
stage: build
validate-x86_64-linux-deb9-unreg-hadrian:
extends: .validate-linux-hadrian
needs: [validate-x86_64-linux-deb9-hadrian]
stage: full-build
variables:
CONFIGURE_ARGS: --enable-unregisterised
TEST_ENV: "x86_64-linux-deb9-unreg-hadrian"
nightly-x86_64-linux-deb10-hadrian-cross-aarch64:
<<: *nightly
extends: .validate-linux-hadrian
stage: full-build
variables:
CONFIGURE_ARGS: --with-intree-gmp
CROSS_TARGET: "aarch64-linux-gnu"
############################################################
# GHC-in-GHCi (Hadrian)
############################################################
hadrian-ghc-in-ghci:
stage: quick-build
needs: [lint-linters, lint-submods]
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
before_script:
# workaround for docker permissions
......@@ -240,20 +286,52 @@ hadrian-ghc-in-ghci:
tags:
- x86_64-linux
script:
- .gitlab/ci.sh setup
- cabal update
- cd hadrian; cabal new-build --project-file=ci.project; cd ..
- cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
- git clean -xdf && git submodule foreach git clean -xdf
- .gitlab/ci.sh setup
- if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
- ./boot
- ./configure $CONFIGURE_ARGS
# Load ghc-in-ghci then immediately exit and check the modules loaded
- echo ":q" | hadrian/ghci -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok,"
after_script:
- cp -Rf $HOME/.cabal cabal-cache
cache:
key: hadrian-ghci
paths:
- cabal-cache
############################################################
# GHC source code linting
############################################################
.lint-params:
stage: lint
needs: [lint-submods]
tags:
- lint
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
before_script:
- export PATH="/opt/toolchain/bin:$PATH"
# workaround for docker permissions
- sudo chown ghc:ghc -R .
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
- .gitlab/ci.sh setup
- cabal update
- cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
variables:
GHC_FLAGS: -Werror
lint-base:
extends: .lint-params
script:
- hadrian/build -c -j stage1:lib:base
- hadrian/build -j lint:base
cache:
key: lint
############################################################
# Validation via Pipelines (make)
############################################################
......@@ -282,7 +360,9 @@ hadrian-ghc-in-ghci:
#################################
.build-x86_64-freebsd:
stage: full-build
extends: .validate
needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-freebsd
allow_failure: true
......@@ -292,8 +372,8 @@ hadrian-ghc-in-ghci:
# porting guide [1].
# [1] https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html)
CONFIGURE_ARGS: "--with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib"
GHC_VERSION: 8.10.1
CABAL_INSTALL_VERSION: 3.2.0.0
GHC_VERSION: "8.10.1"
CABAL_INSTALL_VERSION: "3.2.0.0"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-portbld-freebsd.tar.xz"
TEST_ENV: "x86_64-freebsd"
BUILD_FLAVOUR: "validate"
......@@ -312,23 +392,19 @@ hadrian-ghc-in-ghci:
# Conditional due to lack of builder capacity
validate-x86_64-freebsd:
extends: .build-x86_64-freebsd
stage: full-build
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/'
nightly-x86_64-freebsd:
<<: *nightly
extends: .build-x86_64-freebsd
stage: full-build
release-x86_64-freebsd:
<<: *release
extends: .build-x86_64-freebsd
stage: full-build
.build-x86_64-freebsd-hadrian:
extends: .validate-hadrian
stage: full-build
tags:
- x86_64-freebsd
allow_failure: true
......@@ -337,9 +413,9 @@ release-x86_64-freebsd:
HADRIAN_ARGS: "--docs=no-sphinx"
GHC_VERSION: 8.6.3
CABAL_INSTALL_VERSION: 3.0.0.0
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-portbld-freebsd.tar.xz"
BIN_DIST_NAME: "ghc-x86_64-portbld-freebsd"
TEST_ENV: "x86_64-freebsd-hadrian"
FLAVOUR: "validate"
BUILD_FLAVOUR: "validate"
after_script:
- cp -Rf $HOME/.cabal cabal-cache
- .gitlab/ci.sh clean
......@@ -355,7 +431,6 @@ release-x86_64-freebsd:
# Disabled due to lack of builder capacity
.validate-x86_64-freebsd-hadrian:
extends: .build-x86_64-freebsd-hadrian
stage: full-build
#################################
# x86_64-darwin
......@@ -363,11 +438,12 @@ release-x86_64-freebsd:
validate-x86_64-darwin:
extends: .validate
needs: [validate-x86_64-linux-deb9-hadrian]
stage: full-build
tags:
- x86_64-darwin
variables:
GHC_VERSION: 8.8.3
GHC_VERSION: 8.8.4
CABAL_INSTALL_VERSION: 3.0.0.0
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-apple-darwin.tar.xz"
MACOSX_DEPLOYMENT_TARGET: "10.7"
......@@ -392,16 +468,18 @@ validate-x86_64-darwin:
# Disabled because of OS X CI capacity
.validate-x86_64-darwin-hadrian:
stage: full-build
needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-darwin
variables:
GHC_VERSION: 8.8.3
GHC_VERSION: 8.8.4
MACOSX_DEPLOYMENT_TARGET: "10.7"
ac_cv_func_clock_gettime: "no"
LANG: "en_US.UTF-8"
CONFIGURE_ARGS: --with-intree-gmp
TEST_ENV: "x86_64-darwin-hadrian"
FLAVOUR: "validate"
BIN_DIST_NAME: "ghc-x86_64-apple-darwin"
BUILD_FLAVOUR: "validate"
script:
- .gitlab/ci.sh setup
- .gitlab/ci.sh configure
......@@ -416,11 +494,12 @@ validate-x86_64-darwin:
reports:
junit: junit.xml
paths:
- ghc.tar.xz
- "$BIN_DIST_NAME.tar.xz"
- junit.xml
.validate-linux:
extends: .validate
needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-linux
variables:
......@@ -443,64 +522,66 @@ validate-x86_64-darwin:
- toolchain
#################################
# aarch64-linux-deb9
# aarch64-linux-deb10
#################################
.build-aarch64-linux-deb9:
.build-aarch64-linux-deb10:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb9:$DOCKER_REV"
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
allow_failure: true
variables:
TEST_ENV: "aarch64-linux-deb9"
BIN_DIST_PREP_TAR_COMP: "ghc-aarch64-linux-deb9.tar.xz"
TEST_ENV: "aarch64-linux-deb10"
BIN_DIST_PREP_TAR_COMP: "ghc-aarch64-linux-deb10.tar.xz"
cache:
key: linux-aarch64-deb9
key: linux-aarch64-deb10
tags:
- aarch64-linux
validate-aarch64-linux-deb9:
extends: .build-aarch64-linux-deb9
validate-aarch64-linux-deb10:
extends: .build-aarch64-linux-deb10
artifacts:
when: always
expire_in: 2 week
nightly-aarch64-linux-deb9:
nightly-aarch64-linux-deb10:
<<: *nightly
extends: .build-aarch64-linux-deb9
extends: .build-aarch64-linux-deb10
variables:
TEST_TYPE: slowtest
#################################
# armv7-linux-deb9
# armv7-linux-deb10
#################################
.build-armv7-linux-deb9:
.build-armv7-linux-deb10:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb9:$DOCKER_REV"
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
# Due to linker issues
allow_failure: true
variables:
TEST_ENV: "armv7-linux-deb9"
BIN_DIST_PREP_TAR_COMP: "ghc-armv7-linux-deb9.tar.xz"
TEST_ENV: "armv7-linux-deb10"
BIN_DIST_PREP_TAR_COMP: "ghc-armv7-linux-deb10.tar.xz"
CONFIGURE_ARGS: "--host=armv7-linux-gnueabihf --build=armv7-linux-gnueabihf --target=armv7-linux-gnueabihf"
# N.B. We disable ld.lld explicitly here because it appears to fail
# non-deterministically on ARMv7. See #18280.
LD: "ld.gold"
GccUseLdOpt: "-fuse-ld=gold"
cache:
key: linux-armv7-deb9
key: linux-armv7-deb10
tags:
- armv7-linux
validate-armv7-linux-deb9:
extends: .build-armv7-linux-deb9
validate-armv7-linux-deb10:
extends: .build-armv7-linux-deb10
artifacts:
when: always
expire_in: 2 week
nightly-armv7-linux-deb9:
nightly-armv7-linux-deb10:
<<: *nightly
extends: .build-armv7-linux-deb9
extends: .build-armv7-linux-deb10
variables:
TEST_TYPE: slowtest
......@@ -601,7 +682,7 @@ validate-x86_64-linux-deb9-integer-simple:
stage: full-build
variables:
BUILD_FLAVOUR: validate
INTEGER_LIBRARY: integer-simple
BIGNUM_BACKEND: native
TEST_ENV: "x86_64-linux-deb9-integer-simple-validate"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb9-linux-integer-simple.tar.xz"
......@@ -610,7 +691,7 @@ nightly-x86_64-linux-deb9-integer-simple:
extends: .build-x86_64-linux-deb9
stage: full-build
variables:
INTEGER_LIBRARY: integer-simple
BIGNUM_BACKEND: native
TEST_ENV: "x86_64-linux-deb9-integer-simple"
TEST_TYPE: slowtest
......@@ -652,6 +733,35 @@ release-x86_64-linux-deb10:
<<: *release
extends: .build-x86_64-linux-deb10
#################################
# x86_64-linux-ubuntu 20.04
#################################
.build-x86_64-linux-ubuntu2004:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu20_04:$DOCKER_REV"
variables:
TEST_ENV: "x86_64-linux-ubuntu2004"
BIN_DIST_PREP_TAR_COMP: "./ghc-x86_64-ubuntu2004-linux.tar.xz"
cache:
key: linux-x86_64-ubuntu2004
# Disabled to alleviate CI load
.validate-x86_64-linux-ubuntu2004:
extends: .build-x86_64-linux-ubuntu2004
stage: full-build
nightly-x86_64-linux-ubuntu2004:
<<: *nightly
extends: .build-x86_64-linux-ubuntu2004
variables:
TEST_TYPE: slowtest
release-x86_64-linux-ubuntu2004:
<<: *release
extends: .build-x86_64-linux-ubuntu2004
#################################
# x86_64-linux-deb8
#################################
......@@ -660,6 +770,7 @@ release-x86_64-linux-deb10:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
# Due to #18298.
allow_failure: true
variables:
TEST_ENV: "x86_64-linux-deb8"
......@@ -684,12 +795,12 @@ release-x86_64-linux-deb8:
.build-x86_64-linux-alpine-hadrian:
extends: .validate-linux-hadrian
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine:$DOCKER_REV"
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV"
# There are currently a few failing tests
allow_failure: true
variables:
TEST_ENV: "x86_64-linux-alpine"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-alpine-linux.tar.xz"
BIN_DIST_NAME: "ghc-x86_64-alpine-linux"
# Can't use ld.gold due to #13958.
CONFIGURE_ARGS: "--disable-ld-override"
HADRIAN_ARGS: "--docs=no-sphinx"
......@@ -742,6 +853,9 @@ validate-x86_64-linux-fedora27:
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
variables:
# LLVM 10 is not available for Fedora27
LLC: /bin/false
OPT: /bin/false
TEST_ENV: "x86_64-linux-fedora27"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux.tar.xz"
cache:
......@@ -757,8 +871,7 @@ validate-x86_64-linux-fedora27:
############################################################
.build-windows:
# For the reasons given in #17777 this build isn't reliable.
allow_failure: true
needs: [validate-x86_64-linux-deb9-hadrian]
before_script:
- git clean -xdf
......@@ -773,8 +886,8 @@ validate-x86_64-linux-fedora27:
#FORCE_SYMLINKS: 1
LANG: "en_US.UTF-8"
SPHINXBUILD: "/mingw64/bin/sphinx-build.exe"
CABAL_INSTALL_VERSION: 3.0.0.0
GHC_VERSION: "8.8.3"
CABAL_INSTALL_VERSION: "3.0.0.0"
GHC_VERSION: "8.8.4"
cache:
paths:
- cabal-cache
......@@ -785,7 +898,7 @@ validate-x86_64-linux-fedora27:
extends: .build-windows
stage: full-build
variables:
FLAVOUR: "validate"
BUILD_FLAVOUR: "validate"
# skipping perf tests for now since we build a quick-flavoured GHC,
# which might result in some broken perf tests?
HADRIAN_ARGS: "--docs=no-sphinx --skip-perf"
......@@ -803,25 +916,20 @@ validate-x86_64-linux-fedora27:
expire_in: 2 week
when: always
paths:
- ghc.tar.xz
- "$BIN_DIST_NAME.tar.xz"
- junit.xml
validate-x86_64-windows-hadrian:
.build-x86_64-windows-hadrian:
extends: .build-windows-hadrian
variables:
MSYSTEM: MINGW64
TEST_ENV: "x86_64-windows-hadrian"
TEST_ENV: "x86_64-windows"
BIN_DIST_NAME: "ghc-x86_64-unknown-mingw32"
cache:
key: "x86_64-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
nightly-i386-windows-hadrian:
<<: *nightly
extends: .build-windows-hadrian
variables:
MSYSTEM: MINGW32
TEST_ENV: "i386-windows-hadrian"
cache:
key: "i386-windows-hadrian-$WINDOWS_TOOLCHAIN_VERSION"
validate-x86_64-windows-hadrian:
extends: .build-x86_64-windows-hadrian
.build-windows-make:
extends: .build-windows
......@@ -855,9 +963,6 @@ nightly-i386-windows-hadrian:
cache:
key: "x86_64-windows-$WINDOWS_TOOLCHAIN_VERSION"
validate-x86_64-windows:
extends: .build-x86_64-windows-make
nightly-x86_64-windows:
<<: *nightly
extends: .build-x86_64-windows-make
......@@ -865,86 +970,22 @@ nightly-x86_64-windows:
variables:
BUILD_FLAVOUR: "validate"
# Normal Windows validate builds are profiled; that won't do for releases.
# Normal Windows validate builds lack profiled libraries; that won't do for
# releases.
release-x86_64-windows:
<<: *release
extends: validate-x86_64-windows
variables:
BUILD_FLAVOUR: "perf"
#
release-x86_64-windows-integer-simple:
<<: *release
extends: validate-x86_64-windows
variables:
INTEGER_LIBRARY: integer-simple
BUILD_FLAVOUR: "perf"
.build-i386-windows-make:
extends: .build-windows-make
variables:
MSYSTEM: MINGW32
# Due to #15934
BUILD_PROF_LIBS: "NO"
TEST_ENV: "i386-windows"
# Due to #17736
allow_failure: true
cache:
key: "i386-windows-$WINDOWS_TOOLCHAIN_VERSION"
validate-i386-windows:
extends: .build-i386-windows-make
extends: .build-x86_64-windows-hadrian
variables:
BUILD_FLAVOUR: "perf"
release-i386-windows:
release-x86_64-windows-integer-simple:
<<: *release
extends: .build-i386-windows-make
extends: .build-x86_64-windows-hadrian
variables:
BIGNUM_BACKEND: native
BUILD_FLAVOUR: "perf"
BIN_DIST_NAME: "ghc-x86_64-mingw32-unknown-nogmp"
nightly-i386-windows:
<<: *nightly
extends: .build-i386-windows-make
############################################################
# Cleanup
############################################################
# Note [Cleaning up after shell executor]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# As noted in [1], gitlab-runner's shell executor doesn't clean up its working
# directory after builds. Unfortunately, we are forced to use the shell executor
# on Darwin. To avoid running out of disk space we add a stage at the end of
# the build to remove the /.../GitLabRunner/builds directory. Since we only run a
# single build at a time on Darwin this should be safe.
#
# We used to have a similar cleanup job on Windows as well however it ended up
# being quite fragile as we have multiple Windows builders yet there is no
# guarantee that the cleanup job is run on the same machine as the build itself
# was run. Consequently we were forced to instead handle cleanup with a separate
# cleanup cron job on Windows.
#
# [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
# See Note [Cleanup after shell executor]
cleanup-darwin:
stage: cleanup
tags:
- x86_64-darwin
when: always
dependencies: []
before_script:
- echo "Time to clean up"
script:
- echo "Let's go"
after_script:
- BUILD_DIR=$CI_PROJECT_DIR
- echo "Cleaning $BUILD_DIR"
- cd $HOME
- rm -Rf $BUILD_DIR/*
- exit 0
############################################################
# Packaging
......@@ -952,17 +993,18 @@ cleanup-darwin:
doc-tarball:
stage: packaging
needs: [validate-x86_64-linux-deb9-debug, validate-x86_64-windows-hadrian, validate-x86_64-linux-deb9-unreg-hadrian]
# N.B. Documentation isn't correctly packaged in Hadrian bindists
allow_failure: true
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
dependencies:
- validate-x86_64-linux-deb9-debug
- validate-x86_64-windows
- validate-x86_64-windows-hadrian
variables:
LINUX_BINDIST: "ghc-x86_64-deb9-linux-debug.tar.xz"
WINDOWS_BINDIST: "ghc-x86_64-mingw32.tar.xz"
# Due to Windows allow_failure
allow_failure: true
WINDOWS_BINDIST: "ghc-x86_64-unknown-mingw32.tar.xz"
artifacts:
paths:
- haddock.html.tar.xz
......@@ -987,6 +1029,7 @@ doc-tarball:
source-tarball:
stage: packaging
needs: [validate-x86_64-linux-deb9-unreg-hadrian]
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
......@@ -1021,6 +1064,7 @@ source-tarball:
.hackage:
stage: testing
needs: [doc-tarball]
image: ghcci/x86_64-linux-deb9:0.2
tags:
- x86_64-linux
......@@ -1049,6 +1093,7 @@ nightly-hackage:
perf-nofib:
stage: testing
needs: [validate-x86_64-linux-deb9-dwarf, doc-tarball]
dependencies:
- validate-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
......@@ -1068,8 +1113,8 @@ perf-nofib:
make install
popd
rm -Rf tmp
- export BOOT_HC=$(which ghc)
- cabal update; cabal install -w $BOOT_HC regex-compat
- export BOOT_HC=$GHC
- cabal update; cabal install -w "$BOOT_HC" --lib regex-compat
- export PATH=$root/bin:$PATH
- make -C nofib boot mode=fast -j$CPUS
- "make -C nofib EXTRA_RUNTEST_OPTS='-cachegrind +RTS -V0 -RTS' NoFibRuns=1 mode=fast -j$CPUS 2>&1 | tee nofib.log"
......@@ -1079,17 +1124,52 @@ perf-nofib:
paths:
- nofib.log
############################################################
# Ad-hoc performance testing
############################################################
perf:
stage: testing
needs: [validate-x86_64-linux-deb9-dwarf, doc-tarball]
dependencies:
- validate-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
rules:
- if: $CI_MERGE_REQUEST_ID
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
tags:
- x86_64-linux-perf
script:
- root=$(pwd)/ghc
- |
mkdir tmp
tar -xf ghc-x86_64-deb9-linux-dwarf.tar.xz -C tmp
pushd tmp/ghc-*/
./configure --prefix=$root
make install
popd
rm -Rf tmp
- export BOOT_HC=$(which ghc)
- export HC=$root/bin/ghc
- .gitlab/ci.sh perf_test
artifacts:
expire_in: 12 week
when: always
paths:
- out
############################################################
# Documentation deployment via GitLab Pages
############################################################
pages:
stage: deploy
needs: [doc-tarball]
dependencies:
- doc-tarball
image: ghcci/x86_64-linux-deb9:0.2
# Due to Windows allow_failure
allow_failure: true
tags:
- x86_64-linux
script:
......
......@@ -2,72 +2,114 @@
# shellcheck disable=SC2230
# This is the primary driver of the GitLab CI infrastructure.
# Run `ci.sh usage` for usage information.
set -e -o pipefail
# Configuration:
hackage_index_state="@1579718451"
# Colors
BLACK="0;30"
GRAY="1;30"
RED="0;31"
LT_RED="1;31"
BROWN="0;33"
LT_BROWN="1;33"
GREEN="0;32"
LT_GREEN="1;32"
BLUE="0;34"
LT_BLUE="1;34"
PURPLE="0;35"
LT_PURPLE="1;35"
CYAN="0;36"
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() {
name="$1"
echo -e "section_start:$(date +%s):$name\015\033[0K"
}
hackage_index_state="2020-09-14T19:30:43Z"
MIN_HAPPY_VERSION="1.20"
MIN_ALEX_VERSION="3.2"
end_section() {
name="$1"
echo -e "section_end:$(date +%s):$name\015\033[0K"
}
TOP="$(pwd)"
if [ ! -d "$TOP/.gitlab" ]; then
echo "This script expects to be run from the root of a ghc checkout"
fi
echo_color() {
local color="$1"
local msg="$2"
echo -e "\033[${color}m${msg}\033[0m"
}
source $TOP/.gitlab/common.sh
function usage() {
cat <<EOF
$0 - GHC continuous integration driver
Modes:
usage Show this usage message.
setup Prepare environment for a build.
configure Run ./configure.
build_make Build GHC via the make build system
build_hadrian Build GHC via the Hadrian build system
test_make Test GHC via the make build system
test_hadrian Test GHC via the Hadrian build system
clean Clean the tree
shell Run an interactive shell with a configured build environment.
Environment variables:
CROSS_TARGET Triple of cross-compilation target.
MSYSTEM (Windows-only) Which platform to build form (MINGW64 or MINGW32).
Environment variables determining build configuration of Make system:
BUILD_FLAVOUR Which flavour to build.
BUILD_SPHINX_HTML Whether to build Sphinx HTML documentation.
BUILD_SPHINX_PDF Whether to build Sphinx PDF documentation.
INTEGER_LIBRARY Which integer library to use (integer-simple or integer-gmp).
HADDOCK_HYPERLINKED_SOURCES
Whether to build hyperlinked Haddock sources.
TEST_TYPE Which test rule to run.
Environment variables determining build configuration of Hadrian system:
BUILD_FLAVOUR Which flavour to build.
error() { echo_color "${RED}" "$1"; }
warn() { echo_color "${LT_BROWN}" "$1"; }
info() { echo_color "${LT_BLUE}" "$1"; }
Environment variables determining bootstrap toolchain (Linux):
fail() { error "error: $1"; exit 1; }
GHC Path of GHC executable to use for bootstrapping.
CABAL Path of cabal-install executable to use for bootstrapping.
ALEX Path of alex executable to use for bootstrapping.
HAPPY Path of alex executable to use for bootstrapping.
function run() {
info "Running $*..."
"$@" || ( error "$* failed"; return 1; )
Environment variables determining bootstrap toolchain (non-Linux):
GHC_VERSION Which GHC version to fetch for bootstrapping.
CABAL_INSTALL_VERSION
Cabal-install version to fetch for bootstrapping.
EOF
}
TOP="$(pwd)"
function setup_locale() {
# Musl doesn't provide locale support at all...
if ! which locale > /dev/null; then
info "No locale executable. Skipping locale setup..."
return
fi
# BSD grep terminates early with -q, consequently locale -a will get a
# SIGPIPE and the pipeline will fail with pipefail.
shopt -o -u pipefail
if locale -a | grep -q C.UTF-8; then
# Debian
export LANG=C.UTF-8
elif locale -a | grep -q C.utf8; then
# Fedora calls it this
export LANG=C.utf8
elif locale -a | grep -q en_US.UTF-8; then
# Centos doesn't have C.UTF-8
export LANG=en_US.UTF-8
elif locale -a | grep -q en_US.utf8; then
# Centos doesn't have C.UTF-8
export LANG=en_US.utf8
else
error "Failed to find usable locale"
info "Available locales:"
locale -a
fail "No usable locale, aborting..."
fi
info "Using locale $LANG..."
export LC_ALL=$LANG
shopt -o -s pipefail
}
function mingw_init() {
case "$MSYSTEM" in
MINGW32)
triple="i386-unknown-mingw32"
target_triple="i386-unknown-mingw32"
boot_triple="i386-unknown-mingw32" # triple of bootstrap GHC
;;
MINGW64)
triple="x86_64-unknown-mingw32"
target_triple="x86_64-unknown-mingw32"
boot_triple="x86_64-unknown-mingw32" # triple of bootstrap GHC
;;
*)
......@@ -122,22 +164,26 @@ function show_tool() {
function set_toolchain_paths() {
needs_toolchain=1
case "$(uname)" in
Linux) needs_toolchain="" ;;
Linux) needs_toolchain="0" ;;
*) ;;
esac
if [[ -n "$needs_toolchain" ]]; then
if [[ "$needs_toolchain" = 1 ]]; then
# These are populated by setup_toolchain
GHC="$toolchain/bin/ghc$exe"
CABAL="$toolchain/bin/cabal$exe"
HAPPY="$toolchain/bin/happy$exe"
ALEX="$toolchain/bin/alex$exe"
else
GHC="$(which ghc)"
CABAL="/usr/local/bin/cabal"
HAPPY="$HOME/.cabal/bin/happy"
ALEX="$HOME/.cabal/bin/alex"
# These are generally set by the Docker image but
# we provide these handy fallbacks in case the
# script isn't run from within a GHC CI docker image.
if [ -z "$GHC" ]; then GHC="$(which ghc)"; fi
if [ -z "$CABAL" ]; then GHC="$(which cabal)"; fi
if [ -z "$HAPPY" ]; then GHC="$(which happy)"; fi
if [ -z "$ALEX" ]; then GHC="$(which alex)"; fi
fi
export GHC
export CABAL
export HAPPY
......@@ -174,12 +220,12 @@ function setup() {
}
function fetch_ghc() {
local v="$GHC_VERSION"
if [[ -z "$v" ]]; then
fail "GHC_VERSION is not set"
fi
if [ ! -e "$GHC" ]; then
local v="$GHC_VERSION"
if [[ -z "$v" ]]; then
fail "neither GHC nor GHC_VERSION are not set"
fi
start_section "fetch GHC"
url="https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-${boot_triple}.tar.xz"
info "Fetching GHC binary distribution from $url..."
......@@ -203,12 +249,12 @@ function fetch_ghc() {
}
function fetch_cabal() {
local v="$CABAL_INSTALL_VERSION"
if [[ -z "$v" ]]; then
fail "CABAL_INSTALL_VERSION is not set"
fi
if [ ! -e "$CABAL" ]; then
local v="$CABAL_INSTALL_VERSION"
if [[ -z "$v" ]]; then
fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
fi
start_section "fetch GHC"
case "$(uname)" in
# N.B. Windows uses zip whereas all others use .tar.xz
......@@ -249,24 +295,26 @@ function fetch_cabal() {
function setup_toolchain() {
fetch_ghc
fetch_cabal
cabal_install="$CABAL v2-install --index-state=$hackage_index_state --installdir=$toolchain/bin"
cabal_install="$CABAL v2-install \
--with-compiler=$GHC \
--index-state=$hackage_index_state \
--installdir=$toolchain/bin \
--overwrite-policy=always"
# Avoid symlinks on Windows
case "$(uname)" in
MSYS_*|MINGW*) cabal_install="$cabal_install --install-method=copy" ;;
*) ;;
esac
if [ ! -e "$HAPPY" ]; then
info "Building happy..."
cabal update
$cabal_install happy
fi
cabal update
if [ ! -e "$ALEX" ]; then
info "Building alex..."
cabal update
$cabal_install alex
fi
info "Building happy..."
$cabal_install happy --constraint="happy>=$MIN_HAPPY_VERSION"
info "Building alex..."
$cabal_install alex --constraint="alex>=$MIN_ALEX_VERSION"
}
function cleanup_submodules() {
......@@ -285,7 +333,7 @@ function prepare_build_mk() {
if [[ -z "$BUILD_FLAVOUR" ]]; then fail "BUILD_FLAVOUR is not set"; fi
if [[ -z ${BUILD_SPHINX_HTML:-} ]]; then BUILD_SPHINX_HTML=YES; fi
if [[ -z ${BUILD_SPHINX_PDF:-} ]]; then BUILD_SPHINX_PDF=YES; fi
if [[ -z ${INTEGER_LIBRARY:-} ]]; then INTEGER_LIBRARY=integer-gmp; fi
if [[ -z ${BIGNUM_BACKEND:-} ]]; then BIGNUM_BACKEND=gmp; fi
cat > mk/build.mk <<EOF
V=1
......@@ -295,7 +343,7 @@ HSCOLOUR_SRCS=YES
BUILD_SPHINX_HTML=$BUILD_SPHINX_HTML
BUILD_SPHINX_PDF=$BUILD_SPHINX_PDF
BeConservative=YES
INTEGER_LIBRARY=$INTEGER_LIBRARY
BIGNUM_BACKEND=$BIGNUM_BACKEND
XZ_CMD=$XZ
BuildFlavour=$BUILD_FLAVOUR
......@@ -324,8 +372,8 @@ function configure() {
end_section "booting"
local target_args=""
if [[ -n "$triple" ]]; then
target_args="--target=$triple"
if [[ -n "$target_triple" ]]; then
target_args="--target=$target_triple"
fi
start_section "configuring"
......@@ -363,7 +411,19 @@ function push_perf_notes() {
"$TOP/.gitlab/test-metrics.sh" push
}
# Figure out which commit should be used by the testsuite driver as a
# performance baseline. See Note [The CI Story].
function determine_metric_baseline() {
export PERF_BASELINE_COMMIT="$(git merge-base $CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD)"
info "Using $PERF_BASELINE_COMMIT for performance metric baseline..."
}
function test_make() {
if [ -n "$CROSS_TARGET" ]; then
info "Can't test cross-compiled build."
return
fi
run "$MAKE" test_bindist TEST_PREP=YES
run "$MAKE" V=0 test \
THREADS="$cores" \
......@@ -371,16 +431,24 @@ function test_make() {
}
function build_hadrian() {
if [ -z "$FLAVOUR" ]; then
fail "FLAVOUR not set"
if [ -z "$BUILD_FLAVOUR" ]; then
fail "BUILD_FLAVOUR not set"
fi
if [ -z "$BIN_DIST_NAME" ]; then
fail "BIN_DIST_NAME not set"
fi
run_hadrian binary-dist
mv _build/bindist/ghc*.tar.xz ghc.tar.xz
mv _build/bindist/ghc*.tar.xz $BIN_DIST_NAME.tar.xz
}
function test_hadrian() {
if [ -n "$CROSS_TARGET" ]; then
info "Can't test cross-compiled build."
return
fi
cd _build/bindist/ghc-*/
run ./configure --prefix="$TOP"/_build/install
run "$MAKE" install
......@@ -392,6 +460,34 @@ function test_hadrian() {
--test-compiler="$TOP"/_build/install/bin/ghc
}
function cabal_test() {
if [ -z "$OUT" ]; then
fail "OUT not set"
fi
start_section "Cabal test: $OUT"
mkdir -p "$OUT"
run "$HC" \
-hidir tmp -odir tmp -fforce-recomp \
-ddump-to-file -dumpdir "$OUT/dumps" -ddump-timings \
+RTS --machine-readable "-t$OUT/rts.log" -RTS \
-package mtl -ilibraries/Cabal/Cabal libraries/Cabal/Cabal/Setup.hs \
$@
rm -Rf tmp
end_section "Cabal test: $OUT"
}
function run_perf_test() {
if [ -z "$HC" ]; then
fail "HC not set"
fi
mkdir -p out
OUT=out/Cabal-O0 cabal_test -O0
OUT=out/Cabal-O1 cabal_test -O1
OUT=out/Cabal-O2 cabal_test -O2
}
function clean() {
rm -R tmp
run "$MAKE" --quiet clean || true
......@@ -399,10 +495,12 @@ function clean() {
}
function run_hadrian() {
if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
run hadrian/build-cabal \
--flavour="$FLAVOUR" \
--flavour="$BUILD_FLAVOUR" \
-j"$cores" \
--broken-test="$BROKEN_TESTS" \
--bignum=$BIGNUM_BACKEND \
$HADRIAN_ARGS \
$@
}
......@@ -416,6 +514,8 @@ function shell() {
run $cmd
}
setup_locale
# Determine Cabal data directory
case "$(uname)" in
MSYS_*|MINGW*) exe=".exe"; cabal_dir="$APPDATA/cabal" ;;
......@@ -435,16 +535,36 @@ case "$(uname)" in
*) fail "uname $(uname) is not supported" ;;
esac
if [ -n "$CROSS_TARGET" ]; then
info "Cross-compiling for $CROSS_TARGET..."
target_triple="$CROSS_TARGET"
fi
set_toolchain_paths
case $1 in
usage) usage ;;
setup) setup && cleanup_submodules ;;
configure) configure ;;
build_make) build_make ;;
test_make) fetch_perf_notes; test_make; push_perf_notes ;;
test_make)
fetch_perf_notes
res=0
test_make || res=$?
push_perf_notes
exit $res ;;
build_hadrian) build_hadrian ;;
test_hadrian) fetch_perf_notes; test_hadrian; push_perf_notes ;;
# N.B. Always push notes, even if the build fails. This is okay to do as the
# testsuite driver doesn't record notes for tests that fail due to
# correctness.
test_hadrian)
fetch_perf_notes
res=0
test_hadrian || res=$?
push_perf_notes
exit $res ;;
run_hadrian) run_hadrian $@ ;;
perf_test) run_perf_test ;;
clean) clean ;;
shell) shell $@ ;;
*) fail "unknown mode $1" ;;
......
# Common bash utilities
# ----------------------
# Colors
BLACK="0;30"
GRAY="1;30"
RED="0;31"
LT_RED="1;31"
BROWN="0;33"
LT_BROWN="1;33"
GREEN="0;32"
LT_GREEN="1;32"
BLUE="0;34"
LT_BLUE="1;34"
PURPLE="0;35"
LT_PURPLE="1;35"
CYAN="0;36"
LT_CYAN="1;36"
WHITE="1;37"
LT_GRAY="0;37"
# GitLab Pipelines log section delimiters
# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
start_section() {
name="$1"
echo -e "section_start:$(date +%s):$name\015\033[0K"
}
end_section() {
name="$1"
echo -e "section_end:$(date +%s):$name\015\033[0K"
}
echo_color() {
local color="$1"
local msg="$2"
echo -e "\033[${color}m${msg}\033[0m"
}
error() { echo_color "${RED}" "$1"; }
warn() { echo_color "${LT_BROWN}" "$1"; }
info() { echo_color "${LT_BLUE}" "$1"; }
fail() { error "error: $1"; exit 1; }
function run() {
info "Running $*..."
"$@" || ( error "$* failed"; return 1; )
}
......@@ -29,6 +29,9 @@ for l in linters:
# Don't lint font files
l.add_path_filter(lambda path: not path.parent == Path('docs','users_guide',
'rtd-theme', 'static', 'fonts'))
# Don't lint image files
l.add_path_filter(lambda path: not path.parent == Path('docs','users_guide',
'images'))
# Don't lint core spec
l.add_path_filter(lambda path: not path.name == 'core-spec.pdf')
......
......@@ -24,9 +24,10 @@ function pull() {
function setup_ssh() {
# Add gitlab as a known host.
# This can be generated with `ssh-keyscan -H gitlab.haskell.org`
mkdir -p ~/.ssh
echo "|1|+AUrMGS1elvPeLNt+NHGa5+c6pU=|4XvfRsQftO1OgZD4c0JJ7oNaii8= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXilA5l4kOZPx0nM6xDATF+t4fS6te0eYPDwBI/jLWD9cJVtCnsrwMl5ar+/NfmcD0jnCYztUiVHuXyTaWPJYSQpwltfpTeqpo9/z/0MxkPtSl1uMP2cLbDiqA01OWveChktOXwU6hRQ+7MmO+dNRS/iXrRmYrGv/p1W811QgLBLS9fefEdF25n+0dP71L7Ov7riOawlDmd0C11FraE/R8HX6gs6lbXta1kisdxGyKojYSiCtobUaJxRoatMfUP0a9rwTAyl8tf56LgB+igjMky879VAbL7eQ/AmfHYPrSGJ/YlWP6Jj23Dnos5nOVlWL/rVTs9Y/NakLpPwMs75KTC0Pd74hdf2e3folDdAi2kLrQgO2SI6so7rOYZ+mFkCM751QdDVy4DzjmDvSgSIVf9SV7RQf7e7unE7pSZ/ILupZqz9KhR1MOwVO+ePa5qJMNSdC204PIsRWkIO5KP0QLl507NI9Ri84+aODoHD7gDIWNhU08J2P8/E6r0wcC8uWaxh+HaOjI9BkHjqRYsrgfn54BAuO9kw1cDvyi3c8n7VFlNtvQP15lANwim3gr9upV+r95KEPJCgZMYWJBDPIVtp4GdYxCfXxWj5oMXbA5pf0tNixwNJjAsY7I6RN2htHbuySH36JybOZk+gCj6mQkxpCT/tKaUn14hBJWLq7Q+Q==" >> ~/.ssh/known_hosts
echo "|1|JZkdAPJmpX6SzGeqhmQLfMWLGQA=|4vTELroOlbFxbCr0WX+PK9EcpD0= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJknufU+I6A5Nm58lmse4/o11Ai2UzYbYe7782J1+kRk" >> ~/.ssh/known_hosts
echo "|1|cta91z3DoAGdpX2Epe9WF+sr+Rk=|1qlsbqiTTa8YsDyQBjVnzANFQ3Y= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDSzzl8mwY6ohtW6MftKaQfta8yTL8cTxtA7lcueo2mkPpwBBQ7FA6z3nFATx25QwdV7fa7DuNRDX57f/a/W7+wMhXZ6yyQr+gwr0h4vdZ8Nt4XNfNdkdGw4fZKRApWxyvfSkxjs/E9+G0o3eQLspxjVohBkmkcsowpFUI5Aazv/K6QIf1gKt+4iPvYcB/dBJ1yF1qmpayz4htrKyUC5l3GCBEwvMdAjIQ2bX8pyjTtqcJDLosAVzQ5wprkdgkL29MgJXEbM+B1d1log0hnX4AsbOlL7tWhTO1Je2hSuEeiVaDDPFUyCoGQRFDrisQU5lb8NrzuN3jpNc+PxOHbXHfaTppAoED/++UepvgtLF1zUM13cRk56YmpmABOa48W72VJuzLLm8DF+KBWBs6TDuVk3y9z/SS6zDS0VGkHotldopW2kpsjErJIdWVKIL3RP/Flay7mzl3l/izIMTHXXKMxV3/+XaBjG/gDOCld3JjORQXah2hvJfvXeNaePE1RKAMS63cj3XTE77fsYH7VmEdE34RTBDtsZR5WhEjdf29hjEcQDPf0vDphxRHr6IqUSwVcd7ps6nVoccTfaepJm62IIXDgOsc2piWl2xXNZJVtph6U+MzsPDSSbu1MTwalwgqpApcYK7ZzUjGHA7+NBhjjSuUZO6eHzwxjAn0FXZyrpQ==" >> ~/.ssh/known_hosts
echo "|1|uZkjsBS2bmdh7L/8zBquxJd/F20=|by/tpuDAPT6BpEXrDOiOv1/Zx/A= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA7ltOZyaULDgxE3Vw6RgQVp+OPKQi79ssUenbhdWy36" >> ~/.ssh/known_hosts
# Setup ssh keys.
eval `ssh-agent`
......@@ -80,6 +81,10 @@ function push() {
echo ""
echo "Failed to push git notes. Fetching, appending, and retrying... $MAX_RETRY retries left."
done
# Be sure to kill agent before we terminate since otherwise the Windows CI
# job won't finish.
ssh-agent -k
}
case $1 in
......@@ -87,3 +92,4 @@ case $1 in
pull) pull ;;
*) fail "Invalid mode $1" ;;
esac
......@@ -105,7 +105,7 @@
url = https://gitlab.haskell.org/ghc/libffi-tarballs.git
ignore = untracked
[submodule "gmp-tarballs"]
path = libraries/integer-gmp/gmp/gmp-tarballs
path = libraries/ghc-bignum/gmp/gmp-tarballs
url = https://gitlab.haskell.org/ghc/gmp-tarballs.git
[submodule "libraries/exceptions"]
path = libraries/exceptions
......
......@@ -49,3 +49,18 @@
/utils/gen-dll/ @Phyx
/utils/fs/ @Phyx
# WinIO related code
/libraries/base/GHC/Event/Windows/ @Phyx
/libraries/base/GHC/IO/Windows/ @Phyx
/rts/win32/ @Phyx
/libraries/base/GHC/IO/Handle/Lock/Windows.hsc @Phyx
/libraries/base/GHC/Event/Windows.hsc @Phyx
/libraries/base/GHC/Conc/WinIO.hs @Phyx
/libraries/base/GHC/Conc/Windows.hs @Phyx
/libraries/base/GHC/IO/Handle/Windows.hs @Phyx
/libraries/base/GHC/IO/StdHandles.hs @Phyx
/libraries/base/GHC/Windows.hs @Phyx
/libraries/base/cbits/IOutils.c @Phyx
/libraries/base/cbits/Win32Utils.c @Phyx
/libraries/base/cbits/consUtils.c @Phyx
/libraries/base/include/winio_structs.h @Phyx
......@@ -217,15 +217,15 @@ endif
# test`, runs each test at least once.
.PHONY: fasttest
fasttest:
$(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt fast
$(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt fast
.PHONY: test
test:
$(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
$(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt
.PHONY: slowtest fulltest
slowtest fulltest:
$(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt slow
$(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt slow
.PHONY: fast
fast:
......
......@@ -26,7 +26,7 @@ There are two ways to get a source tree:
2. *Check out the source code from git*
$ git clone --recursive git@gitlab.haskell.org:ghc/ghc.git
$ git clone --recurse-submodules git@gitlab.haskell.org:ghc/ghc.git
Note: cloning GHC from Github requires a special setup. See [Getting a GHC
repository from Github][7].
......
......@@ -3,6 +3,15 @@
# To be a good autoconf citizen, names of local macros have prefixed with FP_ to
# ensure we don't clash with any pre-supplied autoconf ones.
# FPTOOLS_WRITE_FILE
# ------------------
# Write $2 to the file named $1.
AC_DEFUN([FPTOOLS_WRITE_FILE],
[
cat >$1 <<ACEOF
$2
ACEOF
])
AC_DEFUN([GHC_SELECT_FILE_EXTENSIONS],
[
......@@ -190,10 +199,10 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
test -z "[$]2" || eval "[$]2=ArchPPC"
;;
powerpc64)
test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\""
test -z "[$]2" || eval "[$]2=\"ArchPPC_64 ELF_V1\""
;;
powerpc64le)
test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\""
test -z "[$]2" || eval "[$]2=\"ArchPPC_64 ELF_V2\""
;;
s390x)
test -z "[$]2" || eval "[$]2=ArchS390X"
......@@ -206,7 +215,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
;;
arm)
GET_ARM_ISA()
test -z "[$]2" || eval "[$]2=\"ArchARM {armISA = \$ARM_ISA, armISAExt = \$ARM_ISA_EXT, armABI = \$ARM_ABI}\""
test -z "[$]2" || eval "[$]2=\"ArchARM \$ARM_ISA \$ARM_ISA_EXT \$ARM_ABI\""
;;
aarch64)
test -z "[$]2" || eval "[$]2=ArchARM64"
......@@ -438,25 +447,40 @@ AC_DEFUN([GET_ARM_ISA],
#endif]
)],
[AC_DEFINE(arm_HOST_ARCH_PRE_ARMv7, 1, [ARM pre v7])
ARM_ISA=ARMv6
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[],
[#if defined(__VFP_FP__)
return 0;
#else
no vfp
#endif]
)],
[changequote(, )dnl
ARM_ISA_EXT="[VFPv2]"
changequote([, ])dnl
],
[changequote(, )dnl
ARM_ISA_EXT="[]"
changequote([, ])dnl
]
)],
if grep -q Raspbian /etc/issue && uname -m | grep -q armv7; then
# Raspbian unfortunately makes some extremely questionable
# packaging decisions, configuring gcc to compile for ARMv6
# despite the fact that the RPi4 is ARMv8. As ARMv8 doesn't
# support all instructions supported by ARMv6 this can
# break. Work around this by checking uname to verify
# that we aren't running on armv7.
# See #17856.
AC_MSG_NOTICE([Found compiler which claims to target ARMv6 running on ARMv7, assuming this is ARMv7 on Raspbian (see T17856)])
ARM_ISA=ARMv7
changequote(, )dnl
ARM_ISA_EXT="[VFPv2]"
changequote([, ])dnl
else
ARM_ISA=ARMv6
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[],
[#if defined(__VFP_FP__)
return 0;
#else
no vfp
#endif]
)],
[changequote(, )dnl
ARM_ISA_EXT="[VFPv2]"
changequote([, ])dnl
],
[changequote(, )dnl
ARM_ISA_EXT="[]"
changequote([, ])dnl
]
)
fi],
[changequote(, )dnl
ARM_ISA=ARMv7
ARM_ISA_EXT="[VFPv3,NEON]"
......@@ -498,6 +522,7 @@ AC_DEFUN([GET_ARM_ISA],
# FP_SETTINGS
# ----------------------------------
# Set the variables used in the settings file
# See Note [tooldir: How GHC finds mingw on Windows]
AC_DEFUN([FP_SETTINGS],
[
if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"
......@@ -507,6 +532,10 @@ AC_DEFUN([FP_SETTINGS],
SettingsHaskellCPPCommand="${mingw_bin_prefix}gcc.exe"
SettingsHaskellCPPFlags="$HaskellCPPArgs"
SettingsLdCommand="${mingw_bin_prefix}ld.exe"
# Overrides FIND_MERGE_OBJECTS in order to avoid hard-coding linker
# path on Windows (#18550).
SettingsMergeObjectsCommand="${SettingsLdCommand}"
SettingsMergeObjectsFlags="-r --oformat=pe-bigobj-x86-64"
SettingsArCommand="${mingw_bin_prefix}ar.exe"
SettingsRanlibCommand="${mingw_bin_prefix}ranlib.exe"
SettingsDllWrapCommand="${mingw_bin_prefix}dllwrap.exe"
......@@ -520,6 +549,8 @@ AC_DEFUN([FP_SETTINGS],
SettingsHaskellCPPCommand="$(basename $HaskellCPPCmd)"
SettingsHaskellCPPFlags="$HaskellCPPArgs"
SettingsLdCommand="$(basename $LdCmd)"
SettingsMergeObjectsCommand="$(basename $MergeObjsCmd)"
SettingsMergeObjectsFlags="$MergeObjsArgs"
SettingsArCommand="$(basename $ArCmd)"
SettingsDllWrapCommand="$(basename $DllWrapCmd)"
SettingsWindresCommand="$(basename $WindresCmd)"
......@@ -529,6 +560,8 @@ AC_DEFUN([FP_SETTINGS],
SettingsHaskellCPPCommand="$HaskellCPPCmd"
SettingsHaskellCPPFlags="$HaskellCPPArgs"
SettingsLdCommand="$LdCmd"
SettingsMergeObjectsCommand="$MergeObjsCmd"
SettingsMergeObjectsFlags="$MergeObjsArgs"
SettingsArCommand="$ArCmd"
SettingsRanlibCommand="$RanlibCmd"
if test -z "$DllWrapCmd"
......@@ -569,11 +602,24 @@ AC_DEFUN([FP_SETTINGS],
else
SettingsOptCommand="$OptCmd"
fi
if test -z "$OtoolCmd"
then
SettingsOtoolCommand="otool"
else
SettingsOtoolCommand="$OtoolCmd"
fi
if test -z "$InstallNameToolCmd"
then
SettingsInstallNameToolCommand="install_name_tool"
else
SettingsInstallNameToolCommand="$InstallNameToolCmd"
fi
SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
SettingsCxxCompilerFlags="$CONF_CXX_OPTS_STAGE2"
SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE"
SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
SettingsUseDistroMINGW="$EnableDistroToolchain"
AC_SUBST(SettingsCCompilerCommand)
AC_SUBST(SettingsHaskellCPPCommand)
AC_SUBST(SettingsHaskellCPPFlags)
......@@ -583,8 +629,12 @@ AC_DEFUN([FP_SETTINGS],
AC_SUBST(SettingsCCompilerSupportsNoPie)
AC_SUBST(SettingsLdCommand)
AC_SUBST(SettingsLdFlags)
AC_SUBST(SettingsMergeObjectsCommand)
AC_SUBST(SettingsMergeObjectsFlags)
AC_SUBST(SettingsArCommand)
AC_SUBST(SettingsRanlibCommand)
AC_SUBST(SettingsOtoolCommand)
AC_SUBST(SettingsInstallNameToolCommand)
AC_SUBST(SettingsDllWrapCommand)
AC_SUBST(SettingsWindresCommand)
AC_SUBST(SettingsLibtoolCommand)
......@@ -592,6 +642,7 @@ AC_DEFUN([FP_SETTINGS],
AC_SUBST(SettingsClangCommand)
AC_SUBST(SettingsLlcCommand)
AC_SUBST(SettingsOptCommand)
AC_SUBST(SettingsUseDistroMINGW)
])
# Helper for cloning a shell variable's state
......@@ -1012,8 +1063,10 @@ changequote([, ])dnl
])
if test ! -f compiler/GHC/Parser.hs || test ! -f compiler/GHC/Cmm/Parser.hs
then
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.10],
[AC_MSG_ERROR([Happy version 1.19.10 or later is required to compile GHC.])])[]
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.20.0],
[AC_MSG_ERROR([Happy version 1.20 or later is required to compile GHC.])])[]
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-ge],[1.21.0],
[AC_MSG_ERROR([Happy version 1.20 or earlier is required to compile GHC.])])[]
fi
HappyVersion=$fptools_cv_happy_version;
AC_SUBST(HappyVersion)
......@@ -1333,7 +1386,7 @@ AC_DEFUN([FP_GCC_VERSION], [
AC_MSG_ERROR([C compiler is required])
fi
if $CC --version | grep --quiet gcc; then
if $CC --version | grep -q gcc; then
AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version],
[
# Be sure only to look at the first occurrence of the "version " string;
......@@ -1341,8 +1394,9 @@ AC_DEFUN([FP_GCC_VERSION], [
AC_MSG_CHECKING([version of gcc])
fp_cv_gcc_version="`$CC -v 2>&1 | sed -n -e '1,/version /s/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/p'`"
AC_MSG_RESULT([$fp_cv_gcc_version])
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.6],
[AC_MSG_ERROR([Need at least gcc version 4.6 (4.7+ recommended)])])
# 4.7 is needed for __atomic_ builtins.
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.7],
[AC_MSG_ERROR([Need at least gcc version 4.7 (newer recommended)])])
])
AC_SUBST([GccVersion], [$fp_cv_gcc_version])
else
......@@ -1587,37 +1641,37 @@ AC_SUBST([GccExtraViaCOpts],$fp_cv_gcc_extra_opts)
# ---------------------
AC_DEFUN([FP_SETUP_PROJECT_VERSION],
[
if test "$RELEASE" = "NO"; then
AC_MSG_CHECKING([for GHC version date])
if test -f VERSION_DATE; then
PACKAGE_VERSION=${PACKAGE_VERSION}.`cat VERSION_DATE`
AC_MSG_RESULT(given $PACKAGE_VERSION)
elif test -e .git; then
changequote(, )dnl
ver_posixtime=`git log -1 --pretty=format:%ct`
ver_date=`perl -MPOSIX -e "print strftime('%Y%m%d', gmtime($ver_posixtime));"`
if echo $ver_date | grep '^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' 2>&1 >/dev/null; then true; else
changequote([, ])dnl
AC_MSG_ERROR([failed to detect version date: check that git and perl are in your path])
if test "$RELEASE" = "NO"; then
AC_MSG_CHECKING([for GHC version date])
if test -f VERSION_DATE; then
PACKAGE_VERSION=${PACKAGE_VERSION}.`cat VERSION_DATE`
AC_MSG_RESULT(given $PACKAGE_VERSION)
elif test -e .git; then
changequote(, )dnl
ver_posixtime=`git log -1 --pretty=format:%ct`
ver_date=`perl -MPOSIX -e "print strftime('%Y%m%d', gmtime($ver_posixtime));"`
if echo $ver_date | grep '^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' 2>&1 >/dev/null; then true; else
changequote([, ])dnl
AC_MSG_ERROR([failed to detect version date: check that git and perl are in your path])
fi
PACKAGE_VERSION=${PACKAGE_VERSION}.$ver_date
AC_MSG_RESULT(inferred $PACKAGE_VERSION)
elif test -f VERSION; then
PACKAGE_VERSION=`cat VERSION`
AC_MSG_RESULT(given $PACKAGE_VERSION)
else
AC_MSG_WARN([cannot determine snapshot version: no .git directory and no VERSION file])
dnl We'd really rather this case didn't happen, but it might
dnl do (in particular, people using lndir trees may find that
dnl the build system can't find any other date). If it does
dnl happen, then we use the current date.
dnl This way we get some idea about how recent a build is.
dnl It also means that packages built for 2 different builds
dnl will probably use different version numbers, so things are
dnl less likely to go wrong.
PACKAGE_VERSION=${PACKAGE_VERSION}.`date +%Y%m%d`
fi
PACKAGE_VERSION=${PACKAGE_VERSION}.$ver_date
AC_MSG_RESULT(inferred $PACKAGE_VERSION)
elif test -f VERSION; then
PACKAGE_VERSION=`cat VERSION`
AC_MSG_RESULT(given $PACKAGE_VERSION)
else
AC_MSG_WARN([cannot determine snapshot version: no .git directory and no VERSION file])
dnl We'd really rather this case didn't happen, but it might
dnl do (in particular, people using lndir trees may find that
dnl the build system can't find any other date). If it does
dnl happen, then we use the current date.
dnl This way we get some idea about how recent a build is.
dnl It also means that packages built for 2 different builds
dnl will probably use different version numbers, so things are
dnl less likely to go wrong.
PACKAGE_VERSION=${PACKAGE_VERSION}.`date +%Y%m%d`
fi
fi
AC_MSG_CHECKING([for GHC Git commit id])
if test -e .git; then
......@@ -1636,54 +1690,54 @@ fi
fi
# Some renamings
AC_SUBST([ProjectName], [$PACKAGE_NAME])
AC_SUBST([ProjectVersion], [$PACKAGE_VERSION])
AC_SUBST([ProjectGitCommitId], [$PACKAGE_GIT_COMMIT_ID])
# Some renamings
AC_SUBST([ProjectName], [$PACKAGE_NAME])
AC_SUBST([ProjectVersion], [$PACKAGE_VERSION])
AC_SUBST([ProjectGitCommitId], [$PACKAGE_GIT_COMMIT_ID])
# Split PACKAGE_VERSION into (possibly empty) parts
VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
VERSION_TMP=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
VERSION_MINOR=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
ProjectPatchLevel=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
# Split PACKAGE_VERSION into (possibly empty) parts
VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
VERSION_TMP=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
VERSION_MINOR=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
ProjectPatchLevel=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
# Calculate project version as an integer, using 2 digits for minor version
case $VERSION_MINOR in
?) ProjectVersionInt=${VERSION_MAJOR}0${VERSION_MINOR} ;;
??) ProjectVersionInt=${VERSION_MAJOR}${VERSION_MINOR} ;;
*) AC_MSG_ERROR([bad minor version in $PACKAGE_VERSION]) ;;
esac
AC_SUBST([ProjectVersionInt])
# Calculate project version as an integer, using 2 digits for minor version
case $VERSION_MINOR in
?) ProjectVersionInt=${VERSION_MAJOR}0${VERSION_MINOR} ;;
??) ProjectVersionInt=${VERSION_MAJOR}${VERSION_MINOR} ;;
*) AC_MSG_ERROR([bad minor version in $PACKAGE_VERSION]) ;;
esac
AC_SUBST([ProjectVersionInt])
# The project patchlevel is zero unless stated otherwise
test -z "$ProjectPatchLevel" && ProjectPatchLevel=0
# The project patchlevel is zero unless stated otherwise
test -z "$ProjectPatchLevel" && ProjectPatchLevel=0
# Save split version of ProjectPatchLevel
ProjectPatchLevel1=`echo $ProjectPatchLevel | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1/'`
ProjectPatchLevel2=`echo $ProjectPatchLevel | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3/'`
# Save split version of ProjectPatchLevel
ProjectPatchLevel1=`echo $ProjectPatchLevel | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1/'`
ProjectPatchLevel2=`echo $ProjectPatchLevel | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3/'`
AC_SUBST([ProjectPatchLevel1])
AC_SUBST([ProjectPatchLevel2])
AC_SUBST([ProjectPatchLevel1])
AC_SUBST([ProjectPatchLevel2])
# Remove dots from the patch level; this allows us to have versions like 6.4.1.20050508
ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'`
# Remove dots from the patch level; this allows us to have versions like 6.4.1.20050508
ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'`
AC_SUBST([ProjectPatchLevel])
AC_SUBST([ProjectPatchLevel])
# The version of the GHC package changes every day, since the
# patchlevel is the current date. We don't want to force
# recompilation of the entire compiler when this happens, so for
# GHC HEAD we omit the patchlevel from the package version number.
#
# The ProjectPatchLevel1 > 20000000 iff GHC HEAD. If it's for a stable
# release like 7.10.1 or for a release candidate such as 7.10.1.20141224
# then we don't omit the patchlevel components.
# The version of the GHC package changes every day, since the
# patchlevel is the current date. We don't want to force
# recompilation of the entire compiler when this happens, so for
# GHC HEAD we omit the patchlevel from the package version number.
#
# The ProjectPatchLevel1 > 20000000 iff GHC HEAD. If it's for a stable
# release like 7.10.1 or for a release candidate such as 7.10.1.20141224
# then we don't omit the patchlevel components.
ProjectVersionMunged="$ProjectVersion"
if test "$ProjectPatchLevel1" -gt 20000000; then
ProjectVersionMunged="${VERSION_MAJOR}.${VERSION_MINOR}"
fi
AC_SUBST([ProjectVersionMunged])
ProjectVersionMunged="$ProjectVersion"
if test "$ProjectPatchLevel1" -gt 20000000; then
ProjectVersionMunged="${VERSION_MAJOR}.${VERSION_MINOR}"
fi
AC_SUBST([ProjectVersionMunged])
])# FP_SETUP_PROJECT_VERSION
# Check for a working timer_create(). We need a pretty detailed check
......@@ -1874,7 +1928,6 @@ AC_DEFUN([FP_CURSES],
[directory containing curses libraries])],
[CURSES_LIB_DIRS=$withval])
AC_SUBST(CURSES_INCLUDE_DIRS)
AC_SUBST(CURSES_LIB_DIRS)
])# FP_CURSES
......@@ -1918,7 +1971,9 @@ AC_MSG_CHECKING(for path to top of build tree)
# GHC_CONVERT_CPU(cpu, target_var)
# --------------------------------
# converts cpu from gnu to ghc naming, and assigns the result to $target_var
# Converts cpu from gnu to ghc naming, and assigns the result to $target_var.
# Should you modify this list, you are invited to reflect the changes in
# `libraries/base/System/Info.hs`'s documentation.
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
aarch64*)
......@@ -2469,7 +2524,6 @@ AC_DEFUN([FIND_LD],[
# Make sure the user didn't specify LD manually.
if test "z$LD" != "z"; then
AC_CHECK_TARGET_TOOL([LD], [ld])
LD_NO_GOLD=$LD
return
fi
......@@ -2482,7 +2536,6 @@ AC_DEFUN([FIND_LD],[
if test "x$TmpLd" = "x"; then continue; fi
out=`$TmpLd --version`
LD_NO_GOLD=$TmpLd
case $out in
"GNU ld"*)
FP_CC_LINKER_FLAG_TRY(bfd, $2) ;;
......@@ -2490,8 +2543,6 @@ AC_DEFUN([FIND_LD],[
FP_CC_LINKER_FLAG_TRY(gold, $2)
if test "$cross_compiling" = "yes"; then
AC_MSG_NOTICE([Using ld.gold and assuming that it is not affected by binutils issue 22266]);
else
LD_NO_GOLD=ld;
fi
;;
"LLD"*)
......@@ -2512,21 +2563,138 @@ AC_DEFUN([FIND_LD],[
# Fallback
AC_CHECK_TARGET_TOOL([LD], [ld])
# This isn't entirely safe since $LD may have been discovered to be
# ld.gold, but what else can we do?
if test "x$LD_NO_GOLD" = "x"; then LD_NO_GOLD=$LD; fi
}
if test "x$enable_ld_override" = "xyes"; then
find_ld
else
AC_CHECK_TARGET_TOOL([LD], [ld])
if test "x$LD_NO_GOLD" = "x"; then LD_NO_GOLD=$LD; fi
fi
CHECK_LD_COPY_BUG([$1])
])
# CHECK_FOR_GOLD_T22266
# ----------------------
#
# Test for binutils #22266. This bug manifested as GHC bug #14328 (see also:
# #14675, #14291).
# Uses test from
# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bfb739b525703bfe23f151d09e9beee3a2afe
#
# $1 = linker to test
# Sets $result to 0 if not affected, 1 otherwise
AC_DEFUN([CHECK_FOR_GOLD_T22266],[
AC_MSG_CHECKING([for ld.gold object merging bug (binutils 22266)])
if ! $1 --version | grep -q "GNU gold"; then
# Not gold
result=0
elif test "$cross_compiling" = "yes"; then
AC_MSG_RESULT([cross-compiling, assuming LD can merge objects correctly.])
result=0
else
FPTOOLS_WRITE_FILE([conftest.a.c], [
__attribute__((section(".data.a")))
static int int_from_a_1 = 0x11223344;
__attribute__((section(".data.rel.ro.a")))
int *p_int_from_a_2 = &int_from_a_1;
const char *hello (void);
const char *
hello (void)
{
return "XXXHello, world!" + 3;
}
])
FPTOOLS_WRITE_FILE([conftest.main.c], [
#include <stdlib.h>
#include <string.h>
extern int *p_int_from_a_2;
extern const char *hello (void);
int main (void) {
if (*p_int_from_a_2 != 0x11223344)
abort ();
if (strcmp(hello(), "Hello, world!") != 0)
abort ();
return 0;
}
])
FPTOOLS_WRITE_FILE([conftest.t], [
SECTIONS
{
.text : {
*(.text*)
}
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
}
.data.rel.ro : {
*(.data.rel.ro*)
}
.data : {
*(.data*)
}
.bss : {
*(.bss*)
}
}
])
$CC -c -o conftest.a.o conftest.a.c || AC_MSG_ERROR([Failed to compile test])
$MergeObjsCmd $MergeObjsArgs -T conftest.t conftest.a.o -o conftest.ar.o || AC_MSG_ERROR([Failed to merge test object])
$CC -c -o conftest.main.o conftest.main.c || AC_MSG_ERROR([Failed to compile test driver])
$CC conftest.ar.o conftest.main.o -o conftest || AC_MSG_ERROR([Failed to link test driver])
if ./conftest; then
AC_MSG_RESULT([not affected])
result=0
else
AC_MSG_RESULT([affected])
result=1
fi
rm -f conftest.a.o conftest.a.c conttest.ar.o conftest.main.c conftest.main.o conftest
fi
])
# FIND_MERGE_OBJECTS
# ------------------
# Find which linker to use to merge object files.
#
# See Note [Merging object files for GHCi] in GHC.Driver.Pipeline.
AC_DEFUN([FIND_MERGE_OBJECTS],[
AC_REQUIRE([FIND_LD])
if test -z "$MergeObjsCmd"; then
MergeObjsCmd="$LD"
fi
if test -z "$MergeObjsArgs"; then
MergeObjsArgs="-r"
fi
CHECK_FOR_GOLD_T22266($MergeObjsCmd)
if test "$result" = "1"; then
AC_MSG_NOTICE([$MergeObjsCmd is broken due to binutils 22266, looking for another linker...])
MergeObjsCmd=""
AC_CHECK_TARGET_TOOL([MergeObjsCmd], [ld])
CHECK_FOR_GOLD_T22266($MergeObjsCmd)
if test "$result" = "1"; then
AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the MergeObjsCmd variable to a functional linker.])
fi
fi
AC_SUBST([MergeObjsCmd])
AC_SUBST([MergeObjsArgs])
])
# FIND_PYTHON
# -----------
# Find the version of `python` to use (for the testsuite driver)
......
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
- ignore: {}
- warn: {name: Unused LANGUAGE pragma}
- warn: {name: Use fewer LANGUAGE pragmas}
......@@ -27,9 +27,9 @@ module GHC (
needsTemplateHaskellOrQQ,
-- * Flags and settings
DynFlags(..), GeneralFlag(..), Severity(..), HscTarget(..), gopt,
GhcMode(..), GhcLink(..), defaultObjectTarget,
parseDynamicFlags,
DynFlags(..), GeneralFlag(..), Severity(..), Backend(..), gopt,
GhcMode(..), GhcLink(..),
parseDynamicFlags, parseTargetFiles,
getSessionDynFlags, setSessionDynFlags,
getProgramDynFlags, setProgramDynFlags, setLogAction,
getInteractiveDynFlags, setInteractiveDynFlags,
......@@ -197,7 +197,7 @@ module GHC (
-- ** Data constructors
DataCon,
dataConType, dataConTyCon, dataConFieldLabels,
dataConIsInfix, isVanillaDataCon, dataConUserType,
dataConIsInfix, isVanillaDataCon, dataConWrapperType,
dataConSrcBangs,
StrictnessMark(..), isMarkedStrict,
......@@ -248,7 +248,7 @@ module GHC (
srcSpanStartCol, srcSpanEndCol,
-- ** Located
GenLocated(..), Located,
GenLocated(..), Located, RealLocated,
-- *** Constructing Located
noLoc, mkGeneralLocated,
......@@ -264,6 +264,7 @@ module GHC (
-- * Exceptions
GhcException(..), showGhcException,
GhcApiError(..),
-- * Token stream manipulations
Token,
......@@ -274,7 +275,7 @@ module GHC (
parser,
-- * API Annotations
ApiAnns(..),AnnKeywordId(..),AnnotationComment(..),
ApiAnns(..),AnnKeywordId(..),AnnotationComment(..), ApiAnnKey,
getAnnotation, getAndRemoveAnnotation,
getAnnotationComments, getAndRemoveAnnotationComments,
unicodeAnn,
......@@ -294,31 +295,64 @@ module GHC (
import GHC.Prelude hiding (init)
import GHC.Platform
import GHC.Platform.Ways
import GHC.Driver.Phases ( Phase(..), isHaskellSrcFilename
, isSourceFilename, startPhase )
import GHC.Driver.Env
import GHC.Driver.CmdLine
import GHC.Driver.Session hiding (WarnReason(..))
import GHC.Driver.Backend
import GHC.Driver.Config
import GHC.Driver.Main
import GHC.Driver.Make
import GHC.Driver.Hooks
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
import GHC.Driver.Ppr
import GHC.ByteCode.Types
import GHC.Runtime.Eval
import GHC.Runtime.Eval.Types
import GHC.Runtime.Interpreter
import GHC.Runtime.Interpreter.Types
import GHC.Runtime.Context
import GHCi.RemoteTypes
import GHC.Core.Ppr.TyThing ( pprFamInst )
import GHC.Driver.Main
import GHC.Driver.Make
import GHC.Driver.Hooks
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import qualified GHC.Parser as Parser
import GHC.Parser.Lexer
import GHC.Parser.Annotation
import GHC.Parser.Errors.Ppr
import GHC.Iface.Load ( loadSysInterface )
import GHC.Hs
import GHC.Builtin.Types.Prim ( alphaTyVars )
import GHC.Iface.Tidy
import GHC.Data.Bag ( listToBag )
import GHC.Data.StringBuffer
import GHC.Data.FastString
import qualified GHC.LanguageExtensions as LangExt
import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Tc.Types
import GHC.Tc.Utils.TcType
import GHC.Tc.Module
import GHC.Tc.Utils.Instantiate
import GHC.Tc.Instance.Family
import GHC.SysTools.FileCleanup
import GHC.SysTools
import GHC.SysTools.BaseDir
import GHC.Utils.Error
import GHC.Utils.Monad
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Core.Predicate
import GHC.Unit.State
import GHC.Types.Name.Set
import GHC.Types.Name.Reader
import GHC.Hs
import GHC.Core.Type hiding( typeKind )
import GHC.Tc.Utils.TcType
import GHC.Types.Id
import GHC.Builtin.Types.Prim ( alphaTyVars )
import GHC.Core.TyCon
import GHC.Core.TyCo.Ppr ( pprForAll )
import GHC.Core.Class
......@@ -326,40 +360,37 @@ import GHC.Core.DataCon
import GHC.Core.FVs ( orphNamesOfFamInst )
import GHC.Core.FamInstEnv ( FamInst, famInstEnvElts )
import GHC.Core.InstEnv
import GHC.Core
import GHC.Types.Id
import GHC.Types.Name hiding ( varName )
import GHC.Types.Avail
import GHC.Types.SrcLoc
import GHC.Core
import GHC.Iface.Tidy
import GHC.Driver.Phases ( Phase(..), isHaskellSrcFilename )
import GHC.Driver.Finder
import GHC.Driver.Types
import GHC.Driver.CmdLine
import GHC.Driver.Session hiding (WarnReason(..))
import GHC.Driver.Ways
import GHC.SysTools
import GHC.SysTools.BaseDir
import GHC.Types.TyThing.Ppr ( pprFamInst )
import GHC.Types.Annotations
import GHC.Unit.Module
import GHC.Utils.Panic
import GHC.Platform
import GHC.Data.Bag ( listToBag )
import GHC.Utils.Error
import GHC.Utils.Monad
import GHC.Utils.Misc
import GHC.Data.StringBuffer
import GHC.Utils.Outputable
import GHC.Types.Name.Set
import GHC.Types.Name.Reader
import GHC.Types.SourceError
import GHC.Types.SafeHaskell
import GHC.Types.Fixity
import GHC.Types.Target
import GHC.Types.Basic
import GHC.Data.FastString
import qualified GHC.Parser as Parser
import GHC.Parser.Lexer
import GHC.Parser.Annotation
import qualified GHC.LanguageExtensions as LangExt
import GHC.Types.TyThing
import GHC.Types.Name.Env
import GHC.Tc.Module
import GHC.Tc.Utils.Instantiate
import GHC.Tc.Instance.Family
import GHC.SysTools.FileCleanup
import GHC.Types.Name.Ppr
import GHC.Types.TypeEnv
import GHC.Types.SourceFile
import GHC.Unit
import GHC.Unit.External
import GHC.Unit.State
import GHC.Unit.Finder
import GHC.Unit.Module.ModIface
import GHC.Unit.Module.ModGuts
import GHC.Unit.Module.ModDetails
import GHC.Unit.Module.ModSummary
import GHC.Unit.Module.Graph
import GHC.Unit.Home.ModInfo
import Data.Foldable
import qualified Data.Map.Strict as Map
......@@ -383,6 +414,7 @@ import GHC.Data.Maybe
import System.IO.Error ( isDoesNotExistError )
import System.Environment ( getEnv )
import System.Directory
import Data.List (isPrefixOf)
-- %************************************************************************
......@@ -545,7 +577,7 @@ checkBrokenTablesNextToCode' :: MonadIO m => DynFlags -> m Bool
checkBrokenTablesNextToCode' dflags
| not (isARM arch) = return False
| WayDyn `S.notMember` ways dflags = return False
| not (tablesNextToCode dflags) = return False
| not tablesNextToCode = return False
| otherwise = do
linkerInfo <- liftIO $ getLinkerInfo dflags
case linkerInfo of
......@@ -553,6 +585,7 @@ checkBrokenTablesNextToCode' dflags
_ -> return False
where platform = targetPlatform dflags
arch = platformArch platform
tablesNextToCode = platformTablesNextToCode platform
-- %************************************************************************
......@@ -594,20 +627,22 @@ checkBrokenTablesNextToCode' dflags
-- flags. If you are not doing linking or doing static linking, you
-- can ignore the list of packages returned.
--
setSessionDynFlags :: GhcMonad m => DynFlags -> m [UnitId]
setSessionDynFlags dflags = do
dflags' <- checkNewDynFlags dflags
(dflags''', preload) <- liftIO $ initPackages dflags'
setSessionDynFlags :: GhcMonad m => DynFlags -> m ()
setSessionDynFlags dflags0 = do
dflags1 <- checkNewDynFlags dflags0
dflags <- liftIO $ initUnits dflags1
-- Interpreter
interp <- if gopt Opt_ExternalInterpreter dflags
then do
let
prog = pgm_i dflags ++ flavour
profiled = ways dflags `hasWay` WayProf
dynamic = ways dflags `hasWay` WayDyn
flavour
| WayProf `S.member` ways dflags = "-prof"
| WayDyn `S.member` ways dflags = "-dyn"
| otherwise = ""
| profiled = "-prof" -- FIXME: can't we have both?
| dynamic = "-dyn"
| otherwise = ""
msg = text "Starting " <> text prog
tr <- if verbosity dflags >= 3
then return (logInfo dflags $ withPprStyle defaultDumpStyle msg)
......@@ -616,8 +651,8 @@ setSessionDynFlags dflags = do
conf = IServConfig
{ iservConfProgram = prog
, iservConfOpts = getOpts dflags opt_i
, iservConfProfiled = gopt Opt_SccProfilingOn dflags
, iservConfDynamic = WayDyn `S.member` ways dflags
, iservConfProfiled = profiled
, iservConfDynamic = dynamic
, iservConfHook = createIservProcessHook (hooks dflags)
, iservConfTrace = tr
}
......@@ -630,19 +665,22 @@ setSessionDynFlags dflags = do
return Nothing
#endif
modifySession $ \h -> h{ hsc_dflags = dflags'''
, hsc_IC = (hsc_IC h){ ic_dflags = dflags''' }
modifySession $ \h -> h{ hsc_dflags = dflags
, hsc_IC = (hsc_IC h){ ic_dflags = dflags }
, hsc_interp = hsc_interp h <|> interp
-- we only update the interpreter if there wasn't
-- already one set up
, hsc_home_unit = mkHomeUnitFromFlags dflags
}
invalidateModSummaryCache
return preload
-- | Sets the program 'DynFlags'. Note: this invalidates the internal
-- cached module graph, causing more work to be done the next time
-- 'load' is called.
setProgramDynFlags :: GhcMonad m => DynFlags -> m [UnitId]
--
-- Returns a boolean indicating if preload units have changed and need to be
-- reloaded.
setProgramDynFlags :: GhcMonad m => DynFlags -> m Bool
setProgramDynFlags dflags = setProgramDynFlags_ True dflags
-- | Set the action taken when the compiler produces a message. This
......@@ -654,17 +692,17 @@ setLogAction action = do
void $ setProgramDynFlags_ False $
dflags' { log_action = action }
setProgramDynFlags_ :: GhcMonad m => Bool -> DynFlags -> m [UnitId]
setProgramDynFlags_ :: GhcMonad m => Bool -> DynFlags -> m Bool
setProgramDynFlags_ invalidate_needed dflags = do
dflags' <- checkNewDynFlags dflags
dflags_prev <- getProgramDynFlags
(dflags'', preload) <-
if (packageFlagsChanged dflags_prev dflags')
then liftIO $ initPackages dflags'
else return (dflags', [])
let changed = packageFlagsChanged dflags_prev dflags'
dflags'' <- if changed
then liftIO $ initUnits dflags'
else return dflags'
modifySession $ \h -> h{ hsc_dflags = dflags'' }
when invalidate_needed $ invalidateModSummaryCache
return preload
return changed
-- When changing the DynFlags, we want the changes to apply to future
......@@ -699,7 +737,7 @@ getProgramDynFlags = getSessionDynFlags
-- | Set the 'DynFlags' used to evaluate interactive expressions.
-- Note: this cannot be used for changes to packages. Use
-- 'setSessionDynFlags', or 'setProgramDynFlags' and then copy the
-- 'pkgState' into the interactive @DynFlags@.
-- 'unitState' into the interactive @DynFlags@.
setInteractiveDynFlags :: GhcMonad m => DynFlags -> m ()
setInteractiveDynFlags dflags = do
dflags' <- checkNewDynFlags dflags
......@@ -719,6 +757,88 @@ parseDynamicFlags dflags cmdline = do
dflags2 <- liftIO $ interpretPackageEnv dflags1
return (dflags2, leftovers, warns)
-- | Parse command line arguments that look like files.
-- First normalises its arguments and then splits them into source files
-- and object files.
-- A source file can be turned into a 'Target' via 'guessTarget'
parseTargetFiles :: DynFlags -> [String] -> (DynFlags, [(String, Maybe Phase)], [String])
parseTargetFiles dflags0 fileish_args =
let
normal_fileish_paths = map normalise_hyp fileish_args
(srcs, objs) = partition_args normal_fileish_paths [] []
dflags1 = dflags0 { ldInputs = map (FileOption "") objs
++ ldInputs dflags0 }
{-
We split out the object files (.o, .dll) and add them
to ldInputs for use by the linker.
The following things should be considered compilation manager inputs:
- haskell source files (strings ending in .hs, .lhs or other
haskellish extension),
- module names (not forgetting hierarchical module names),
- things beginning with '-' are flags that were not recognised by
the flag parser, and we want them to generate errors later in
checkOptions, so we class them as source files (#5921)
- and finally we consider everything without an extension to be
a comp manager input, as shorthand for a .hs or .lhs filename.
Everything else is considered to be a linker object, and passed
straight through to the linker.
-}
in (dflags1, srcs, objs)
-- -----------------------------------------------------------------------------
-- | Splitting arguments into source files and object files. This is where we
-- interpret the -x <suffix> option, and attach a (Maybe Phase) to each source
-- file indicating the phase specified by the -x option in force, if any.
partition_args :: [String] -> [(String, Maybe Phase)] -> [String]
-> ([(String, Maybe Phase)], [String])
partition_args [] srcs objs = (reverse srcs, reverse objs)
partition_args ("-x":suff:args) srcs objs
| "none" <- suff = partition_args args srcs objs
| StopLn <- phase = partition_args args srcs (slurp ++ objs)
| otherwise = partition_args rest (these_srcs ++ srcs) objs
where phase = startPhase suff
(slurp,rest) = break (== "-x") args
these_srcs = zip slurp (repeat (Just phase))
partition_args (arg:args) srcs objs
| looks_like_an_input arg = partition_args args ((arg,Nothing):srcs) objs
| otherwise = partition_args args srcs (arg:objs)
looks_like_an_input :: String -> Bool
looks_like_an_input m = isSourceFilename m
|| looksLikeModuleName m
|| "-" `isPrefixOf` m
|| not (hasExtension m)
-- | To simplify the handling of filepaths, we normalise all filepaths right
-- away. Note the asymmetry of FilePath.normalise:
-- Linux: p\/q -> p\/q; p\\q -> p\\q
-- Windows: p\/q -> p\\q; p\\q -> p\\q
-- #12674: Filenames starting with a hypen get normalised from ./-foo.hs
-- to -foo.hs. We have to re-prepend the current directory.
normalise_hyp :: FilePath -> FilePath
normalise_hyp fp
| strt_dot_sl && "-" `isPrefixOf` nfp = cur_dir ++ nfp
| otherwise = nfp
where
#if defined(mingw32_HOST_OS)
strt_dot_sl = "./" `isPrefixOf` fp || ".\\" `isPrefixOf` fp
#else
strt_dot_sl = "./" `isPrefixOf` fp
#endif
cur_dir = '.' : [pathSeparator]
nfp = normalise fp
-----------------------------------------------------------------------------
-- | Checks the set of new DynFlags for possibly erroneous option
-- combinations when invoking 'setSessionDynFlags' and friends, and if
......@@ -936,7 +1056,7 @@ getModSummary mod = do
mg <- liftM hsc_mod_graph getSession
let mods_by_name = [ ms | ms <- mgModSummaries mg
, ms_mod_name ms == mod
, not (isBootSummary ms) ]
, isBootSummary ms == NotBoot ]
case mods_by_name of
[] -> do dflags <- getDynFlags
liftIO $ throwIO $ mkApiErr dflags (text "Module not part of module graph")
......@@ -1007,7 +1127,7 @@ desugarModule tcm = do
--
-- A module must be loaded before dependent modules can be typechecked. This
-- always includes generating a 'ModIface' and, depending on the
-- 'DynFlags.hscTarget', may also include code generation.
-- @DynFlags@\'s 'GHC.Driver.Session.backend', may also include code generation.
--
-- This function will always cause recompilation and will always overwrite
-- previous compilation results (potentially files on disk).
......@@ -1142,7 +1262,7 @@ compileCore simplify fn = do
getModuleGraph :: GhcMonad m => m ModuleGraph -- ToDo: DiGraph ModSummary
getModuleGraph = liftM hsc_mod_graph getSession
-- | Return @True@ <==> module is loaded.
-- | Return @True@ \<==> module is loaded.
isLoaded :: GhcMonad m => ModuleName -> m Bool
isLoaded m = withSession $ \hsc_env ->
return $! isJust (lookupHpt (hsc_HPT hsc_env) m)
......@@ -1158,8 +1278,12 @@ getInsts = withSession $ \hsc_env ->
return $ ic_instances (hsc_IC hsc_env)
getPrintUnqual :: GhcMonad m => m PrintUnqualified
getPrintUnqual = withSession $ \hsc_env ->
return (icPrintUnqual (hsc_dflags hsc_env) (hsc_IC hsc_env))
getPrintUnqual = withSession $ \hsc_env -> do
let dflags = hsc_dflags hsc_env
return $ icPrintUnqual
(unitState dflags)
(hsc_home_unit hsc_env)
(hsc_IC hsc_env)
-- | Container for information about a 'Module'.
data ModuleInfo = ModuleInfo {
......@@ -1254,7 +1378,11 @@ mkPrintUnqualifiedForModule :: GhcMonad m =>
ModuleInfo
-> m (Maybe PrintUnqualified) -- XXX: returns a Maybe X
mkPrintUnqualifiedForModule minf = withSession $ \hsc_env -> do
return (fmap (mkPrintUnqualified (hsc_dflags hsc_env)) (minf_rdr_env minf))
let dflags = hsc_dflags hsc_env
mk_print_unqual = mkPrintUnqualified
(unitState dflags)
(hsc_home_unit hsc_env)
return (fmap mk_print_unqual (minf_rdr_env minf))
modInfoLookupName :: GhcMonad m =>
ModuleInfo -> Name
......@@ -1262,10 +1390,7 @@ modInfoLookupName :: GhcMonad m =>
modInfoLookupName minf name = withSession $ \hsc_env -> do
case lookupTypeEnv (minf_type_env minf) name of
Just tyThing -> return (Just tyThing)
Nothing -> do
eps <- liftIO $ readIORef (hsc_EPS hsc_env)
return $! lookupType (hsc_dflags hsc_env)
(hsc_HPT hsc_env) (eps_PTE eps) name
Nothing -> liftIO (lookupType hsc_env name)
modInfoIface :: ModuleInfo -> Maybe ModIface
modInfoIface = minf_iface
......@@ -1291,7 +1416,7 @@ isDictonaryId id
-- 'setContext'.
lookupGlobalName :: GhcMonad m => Name -> m (Maybe TyThing)
lookupGlobalName name = withSession $ \hsc_env -> do
liftIO $ lookupTypeHscEnv hsc_env name
liftIO $ lookupType hsc_env name
findGlobalAnns :: (GhcMonad m, Typeable a) => ([Word8] -> a) -> AnnTarget Name -> m [a]
findGlobalAnns deserialize target = withSession $ \hsc_env -> do
......@@ -1355,7 +1480,7 @@ packageDbModules :: GhcMonad m =>
-> m [Module]
packageDbModules only_exposed = do
dflags <- getSessionDynFlags
let pkgs = eltsUFM (unitInfoMap (pkgState dflags))
let pkgs = eltsUFM (unitInfoMap (unitState dflags))
return $
[ mkModule pid modname
| p <- pkgs
......@@ -1408,29 +1533,25 @@ getModuleSourceAndFlags mod = do
-- | Return module source as token stream, including comments.
--
-- The module must be in the module graph and its source must be available.
-- Throws a 'GHC.Driver.Types.SourceError' on parse error.
-- Throws a 'GHC.Driver.Env.SourceError' on parse error.
getTokenStream :: GhcMonad m => Module -> m [Located Token]
getTokenStream mod = do
(sourceFile, source, flags) <- getModuleSourceAndFlags mod
(sourceFile, source, dflags) <- getModuleSourceAndFlags mod
let startLoc = mkRealSrcLoc (mkFastString sourceFile) 1 1
case lexTokenStream source startLoc flags of
POk _ ts -> return ts
PFailed pst ->
do dflags <- getDynFlags
throwErrors (getErrorMessages pst dflags)
case lexTokenStream (initParserOpts dflags) source startLoc of
POk _ ts -> return ts
PFailed pst -> throwErrors (fmap pprError (getErrorMessages pst))
-- | Give even more information on the source than 'getTokenStream'
-- This function allows reconstructing the source completely with
-- 'showRichTokenStream'.
getRichTokenStream :: GhcMonad m => Module -> m [(Located Token, String)]
getRichTokenStream mod = do
(sourceFile, source, flags) <- getModuleSourceAndFlags mod
(sourceFile, source, dflags) <- getModuleSourceAndFlags mod
let startLoc = mkRealSrcLoc (mkFastString sourceFile) 1 1
case lexTokenStream source startLoc flags of
POk _ ts -> return $ addSourceToTokens startLoc source ts
PFailed pst ->
do dflags <- getDynFlags
throwErrors (getErrorMessages pst dflags)
case lexTokenStream (initParserOpts dflags) source startLoc of
POk _ ts -> return $ addSourceToTokens startLoc source ts
PFailed pst -> throwErrors (fmap pprError (getErrorMessages pst))
-- | Given a source location and a StringBuffer corresponding to this
-- location, return a rich token stream with the source associated to the
......@@ -1487,12 +1608,10 @@ showRichTokenStream ts = go startLoc ts ""
-- using the algorithm that is used for an @import@ declaration.
findModule :: GhcMonad m => ModuleName -> Maybe FastString -> m Module
findModule mod_name maybe_pkg = withSession $ \hsc_env -> do
let
dflags = hsc_dflags hsc_env
this_pkg = thisPackage dflags
--
let dflags = hsc_dflags hsc_env
home_unit = hsc_home_unit hsc_env
case maybe_pkg of
Just pkg | fsToUnit pkg /= this_pkg && pkg /= fsLit "this" -> liftIO $ do
Just pkg | not (isHomeUnit home_unit (fsToUnit pkg)) && pkg /= fsLit "this" -> liftIO $ do
res <- findImportedModule hsc_env mod_name maybe_pkg
case res of
Found _ m -> return m
......@@ -1504,7 +1623,7 @@ findModule mod_name maybe_pkg = withSession $ \hsc_env -> do
Nothing -> liftIO $ do
res <- findImportedModule hsc_env mod_name maybe_pkg
case res of
Found loc m | moduleUnit m /= this_pkg -> return m
Found loc m | not (isHomeModule home_unit m) -> return m
| otherwise -> modNotLoadedError dflags m loc
err -> throwOneError $ noModError dflags noSrcSpan mod_name err
......@@ -1603,15 +1722,15 @@ parser str dflags filename =
loc = mkRealSrcLoc (mkFastString filename) 1 1
buf = stringToStringBuffer str
in
case unP Parser.parseModule (mkPState dflags buf loc) of
case unP Parser.parseModule (initParserState (initParserOpts dflags) buf loc) of
PFailed pst ->
let (warns,errs) = getMessages pst dflags in
(warns, Left errs)
let (warns,errs) = getMessages pst in
(fmap pprWarning warns, Left (fmap pprError errs))
POk pst rdr_module ->
let (warns,_) = getMessages pst dflags in
(warns, Right rdr_module)
let (warns,_) = getMessages pst in
(fmap pprWarning warns, Right rdr_module)
-- -----------------------------------------------------------------------------
-- | Find the package environment (if one exists)
......@@ -1670,16 +1789,18 @@ interpretPackageEnv dflags = do
return dflags
Just envfile -> do
content <- readFile envfile
compilationProgressMsg dflags ("Loaded package environment from " ++ envfile)
compilationProgressMsg dflags (text "Loaded package environment from " <> text envfile)
let (_, dflags') = runCmdLine (runEwM (setFlagsFromEnvFile envfile content)) dflags
return dflags'
where
-- Loading environments (by name or by location)
archOS = platformArchOS (targetPlatform dflags)
namedEnvPath :: String -> MaybeT IO FilePath
namedEnvPath name = do
appdir <- versionedAppDir dflags
appdir <- versionedAppDir (programName dflags) archOS
return $ appdir </> "environments" </> name
probeEnvName :: String -> MaybeT IO FilePath
......@@ -1716,7 +1837,7 @@ interpretPackageEnv dflags = do
-- e.g. .ghc.environment.x86_64-linux-7.6.3
localEnvFileName :: FilePath
localEnvFileName = ".ghc.environment" <.> versionedFilePath dflags
localEnvFileName = ".ghc.environment" <.> versionedFilePath archOS
-- Search for an env file, starting in the current dir and looking upwards.
-- Fail if we get to the users home dir or the filesystem root. That is,
......@@ -1747,3 +1868,15 @@ interpretPackageEnv dflags = do
"Package environment "
++ show env
++ " (specified in GHC_ENVIRONMENT) not found"
-- | An error thrown if the GHC API is used in an incorrect fashion.
newtype GhcApiError = GhcApiError String
instance Show GhcApiError where
show (GhcApiError msg) = msg
instance Exception GhcApiError
mkApiErr :: DynFlags -> SDoc -> GhcApiError
mkApiErr dflags msg = GhcApiError (showSDoc dflags msg)
......@@ -116,35 +116,6 @@ known keys. See
Note [One-tuples] (Wrinkle: Make boxed one-tuple names have known keys)
in GHC.Builtin.Types.
Note [The integer library]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Clearly, we need to know the names of various definitions of the integer
library, e.g. the type itself, `mkInteger` etc. But there are two possible
implementations of the integer library:
* integer-gmp (fast, but uses libgmp, which may not be available on all
targets and is GPL licensed)
* integer-simple (slow, but pure Haskell and BSD-licensed)
We want the compiler to work with either one. The way we achieve this is:
* When compiling the integer-{gmp,simple} library, we pass
-this-unit-id integer-wired-in
to GHC (see the cabal file libraries/integer-{gmp,simple}.
* This way, GHC can use just this UnitID (see Module.integerUnitId) when
generating code, and the linker will succeed.
Unfortuately, the abstraction is not complete: When using integer-gmp, we
really want to use the S# constructor directly. This is controlled by
the `integerLibrary` field of `DynFlags`: If it is IntegerGMP, we use
this constructor directly (see CorePrep.lookupIntegerSDataConName)
When GHC reads the package data base, it (internally only) pretends it has UnitId
`integer-wired-in` instead of the actual UnitId (which includes the version
number); just like for `base` and other packages, as described in
Note [Wired-in units] in GHC.Unit.Module. This is done in
GHC.Unit.State.findWiredInPackages.
-}
{-# LANGUAGE CPP #-}
......@@ -171,6 +142,7 @@ import GHC.Unit.Module.Name
import GHC.Types.Name.Occurrence
import GHC.Types.Name.Reader
import GHC.Types.Unique
import GHC.Builtin.Uniques
import GHC.Types.Name
import GHC.Types.SrcLoc
import GHC.Data.FastString
......@@ -374,32 +346,56 @@ basicKnownKeyNames
printName, fstName, sndName,
dollarName,
-- Integer
integerTyConName, mkIntegerName,
integerToWord64Name, integerToInt64Name,
word64ToIntegerName, int64ToIntegerName,
plusIntegerName, timesIntegerName, smallIntegerName,
wordToIntegerName,
integerToWordName, integerToIntName, minusIntegerName,
negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
absIntegerName, signumIntegerName,
leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
compareIntegerName, quotRemIntegerName, divModIntegerName,
quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
floatFromIntegerName, doubleFromIntegerName,
encodeFloatIntegerName, encodeDoubleIntegerName,
decodeDoubleIntegerName,
gcdIntegerName, lcmIntegerName,
andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
shiftLIntegerName, shiftRIntegerName, bitIntegerName,
integerSDataConName,naturalSDataConName,
-- Natural
naturalTyConName,
naturalFromIntegerName, naturalToIntegerName,
plusNaturalName, minusNaturalName, timesNaturalName, mkNaturalName,
wordToNaturalName,
-- ghc-bignum
integerFromNaturalName,
integerToNaturalClampName,
integerToWordName,
integerToIntName,
integerToWord64Name,
integerToInt64Name,
integerFromWordName,
integerFromWord64Name,
integerFromInt64Name,
integerAddName,
integerMulName,
integerSubName,
integerNegateName,
integerEqPrimName,
integerNePrimName,
integerLePrimName,
integerGtPrimName,
integerLtPrimName,
integerGePrimName,
integerAbsName,
integerSignumName,
integerCompareName,
integerQuotName,
integerRemName,
integerDivName,
integerModName,
integerDivModName,
integerQuotRemName,
integerToFloatName,
integerToDoubleName,
integerEncodeFloatName,
integerEncodeDoubleName,
integerGcdName,
integerLcmName,
integerAndName,
integerOrName,
integerXorName,
integerComplementName,
integerBitName,
integerShiftLName,
integerShiftRName,
naturalToWordName,
naturalAddName,
naturalSubName,
naturalMulName,
naturalQuotName,
naturalRemName,
naturalQuotRemName,
bignatFromWordListName,
-- Float/Double
rationalToFloatName,
rationalToDoubleName,
......@@ -472,7 +468,6 @@ basicKnownKeyNames
, unsafeEqualityTyConName
, unsafeReflDataConName
, unsafeCoercePrimName
, unsafeCoerceName
]
genericTyConNames :: [Name]
......@@ -508,10 +503,12 @@ genericTyConNames = [
pRELUDE :: Module
pRELUDE = mkBaseModule_ pRELUDE_NAME
gHC_PRIM, gHC_PRIM_PANIC, gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
gHC_PRIM, gHC_PRIM_PANIC, gHC_PRIM_EXCEPTION,
gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
gHC_CLASSES, gHC_PRIMOPWRAPPERS, gHC_BASE, gHC_ENUM,
gHC_GHCI, gHC_GHCI_HELPERS, gHC_CSTRING,
gHC_SHOW, gHC_READ, gHC_NUM, gHC_MAYBE, gHC_INTEGER_TYPE, gHC_NATURAL,
gHC_SHOW, gHC_READ, gHC_NUM, gHC_MAYBE,
gHC_NUM_INTEGER, gHC_NUM_NATURAL, gHC_NUM_BIGNAT,
gHC_LIST, gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_LIST, dATA_STRING,
dATA_FOLDABLE, dATA_TRAVERSABLE,
gHC_CONC, gHC_IO, gHC_IO_Exception,
......@@ -525,6 +522,7 @@ gHC_PRIM, gHC_PRIM_PANIC, gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
gHC_PRIM = mkPrimModule (fsLit "GHC.Prim") -- Primitive types and values
gHC_PRIM_PANIC = mkPrimModule (fsLit "GHC.Prim.Panic")
gHC_PRIM_EXCEPTION = mkPrimModule (fsLit "GHC.Prim.Exception")
gHC_TYPES = mkPrimModule (fsLit "GHC.Types")
gHC_MAGIC = mkPrimModule (fsLit "GHC.Magic")
gHC_CSTRING = mkPrimModule (fsLit "GHC.CString")
......@@ -539,8 +537,9 @@ gHC_SHOW = mkBaseModule (fsLit "GHC.Show")
gHC_READ = mkBaseModule (fsLit "GHC.Read")
gHC_NUM = mkBaseModule (fsLit "GHC.Num")
gHC_MAYBE = mkBaseModule (fsLit "GHC.Maybe")
gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type")
gHC_NATURAL = mkBaseModule (fsLit "GHC.Natural")
gHC_NUM_INTEGER = mkBignumModule (fsLit "GHC.Num.Integer")
gHC_NUM_NATURAL = mkBignumModule (fsLit "GHC.Num.Natural")
gHC_NUM_BIGNAT = mkBignumModule (fsLit "GHC.Num.BigNat")
gHC_LIST = mkBaseModule (fsLit "GHC.List")
gHC_TUPLE = mkPrimModule (fsLit "GHC.Tuple")
dATA_TUPLE = mkBaseModule (fsLit "Data.Tuple")
......@@ -609,13 +608,12 @@ gHC_OVER_LABELS = mkBaseModule (fsLit "GHC.OverloadedLabels")
gHC_RECORDS :: Module
gHC_RECORDS = mkBaseModule (fsLit "GHC.Records")
mAIN, rOOT_MAIN :: Module
mAIN = mkMainModule_ mAIN_NAME
rOOT_MAIN :: Module
rOOT_MAIN = mkMainModule (fsLit ":Main") -- Root module for initialisation
mkInteractiveModule :: Int -> Module
-- (mkInteractiveMoudule 9) makes module 'interactive:M9'
mkInteractiveModule n = mkModule interactiveUnitId (mkModuleName ("Ghci" ++ show n))
mkInteractiveModule n = mkModule interactiveUnit (mkModuleName ("Ghci" ++ show n))
pRELUDE_NAME, mAIN_NAME :: ModuleName
pRELUDE_NAME = mkModuleNameFS (fsLit "Prelude")
......@@ -626,28 +624,28 @@ dATA_ARRAY_PARALLEL_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel")
dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")
mkPrimModule :: FastString -> Module
mkPrimModule m = mkModule primUnitId (mkModuleNameFS m)
mkPrimModule m = mkModule primUnit (mkModuleNameFS m)
mkIntegerModule :: FastString -> Module
mkIntegerModule m = mkModule integerUnitId (mkModuleNameFS m)
mkBignumModule :: FastString -> Module
mkBignumModule m = mkModule bignumUnit (mkModuleNameFS m)
mkBaseModule :: FastString -> Module
mkBaseModule m = mkModule baseUnitId (mkModuleNameFS m)
mkBaseModule m = mkBaseModule_ (mkModuleNameFS m)
mkBaseModule_ :: ModuleName -> Module
mkBaseModule_ m = mkModule baseUnitId m
mkBaseModule_ m = mkModule baseUnit m
mkThisGhcModule :: FastString -> Module
mkThisGhcModule m = mkModule thisGhcUnitId (mkModuleNameFS m)
mkThisGhcModule m = mkThisGhcModule_ (mkModuleNameFS m)
mkThisGhcModule_ :: ModuleName -> Module
mkThisGhcModule_ m = mkModule thisGhcUnitId m
mkThisGhcModule_ m = mkModule thisGhcUnit m
mkMainModule :: FastString -> Module
mkMainModule m = mkModule mainUnitId (mkModuleNameFS m)
mkMainModule m = mkModule mainUnit (mkModuleNameFS m)
mkMainModule_ :: ModuleName -> Module
mkMainModule_ m = mkModule mainUnitId m
mkMainModule_ m = mkModule mainUnit m
{-
************************************************************************
......@@ -708,10 +706,10 @@ enumFromTo_RDR = nameRdrName enumFromToName
enumFromThen_RDR = nameRdrName enumFromThenName
enumFromThenTo_RDR = nameRdrName enumFromThenToName
ratioDataCon_RDR, plusInteger_RDR, timesInteger_RDR :: RdrName
ratioDataCon_RDR, integerAdd_RDR, integerMul_RDR :: RdrName
ratioDataCon_RDR = nameRdrName ratioDataConName
plusInteger_RDR = nameRdrName plusIntegerName
timesInteger_RDR = nameRdrName timesIntegerName
integerAdd_RDR = nameRdrName integerAddName
integerMul_RDR = nameRdrName integerMulName
ioDataCon_RDR :: RdrName
ioDataCon_RDR = nameRdrName ioDataConName
......@@ -743,8 +741,7 @@ toInteger_RDR = nameRdrName toIntegerName
toRational_RDR = nameRdrName toRationalName
fromIntegral_RDR = nameRdrName fromIntegralName
stringTy_RDR, fromString_RDR :: RdrName
stringTy_RDR = tcQual_RDR gHC_BASE (fsLit "String")
fromString_RDR :: RdrName
fromString_RDR = nameRdrName fromStringName
fromList_RDR, fromListN_RDR, toList_RDR :: RdrName
......@@ -1120,84 +1117,123 @@ fromIntegerName = varQual gHC_NUM (fsLit "fromInteger") fromIntegerClassOpKey
minusName = varQual gHC_NUM (fsLit "-") minusClassOpKey
negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey
integerTyConName, mkIntegerName, integerSDataConName,
integerToWord64Name, integerToInt64Name,
word64ToIntegerName, int64ToIntegerName,
plusIntegerName, timesIntegerName, smallIntegerName,
wordToIntegerName,
integerToWordName, integerToIntName, minusIntegerName,
negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
absIntegerName, signumIntegerName,
leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
compareIntegerName, quotRemIntegerName, divModIntegerName,
quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
floatFromIntegerName, doubleFromIntegerName,
encodeFloatIntegerName, encodeDoubleIntegerName,
decodeDoubleIntegerName,
gcdIntegerName, lcmIntegerName,
andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
shiftLIntegerName, shiftRIntegerName, bitIntegerName :: Name
integerTyConName = tcQual gHC_INTEGER_TYPE (fsLit "Integer") integerTyConKey
integerSDataConName = dcQual gHC_INTEGER_TYPE (fsLit "S#") integerSDataConKey
mkIntegerName = varQual gHC_INTEGER_TYPE (fsLit "mkInteger") mkIntegerIdKey
integerToWord64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToWord64") integerToWord64IdKey
integerToInt64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToInt64") integerToInt64IdKey
word64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger") word64ToIntegerIdKey
int64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "int64ToInteger") int64ToIntegerIdKey
plusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "plusInteger") plusIntegerIdKey
timesIntegerName = varQual gHC_INTEGER_TYPE (fsLit "timesInteger") timesIntegerIdKey
smallIntegerName = varQual gHC_INTEGER_TYPE (fsLit "smallInteger") smallIntegerIdKey
wordToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "wordToInteger") wordToIntegerIdKey
integerToWordName = varQual gHC_INTEGER_TYPE (fsLit "integerToWord") integerToWordIdKey
integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey
minusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "minusInteger") minusIntegerIdKey
negateIntegerName = varQual gHC_INTEGER_TYPE (fsLit "negateInteger") negateIntegerIdKey
eqIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "eqInteger#") eqIntegerPrimIdKey
neqIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "neqInteger#") neqIntegerPrimIdKey
absIntegerName = varQual gHC_INTEGER_TYPE (fsLit "absInteger") absIntegerIdKey
signumIntegerName = varQual gHC_INTEGER_TYPE (fsLit "signumInteger") signumIntegerIdKey
leIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "leInteger#") leIntegerPrimIdKey
gtIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "gtInteger#") gtIntegerPrimIdKey
ltIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "ltInteger#") ltIntegerPrimIdKey
geIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "geInteger#") geIntegerPrimIdKey
compareIntegerName = varQual gHC_INTEGER_TYPE (fsLit "compareInteger") compareIntegerIdKey
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
divModIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divModInteger") divModIntegerIdKey
quotIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotInteger") quotIntegerIdKey
remIntegerName = varQual gHC_INTEGER_TYPE (fsLit "remInteger") remIntegerIdKey
divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey
modIntegerName = varQual gHC_INTEGER_TYPE (fsLit "modInteger") modIntegerIdKey
floatFromIntegerName = varQual gHC_INTEGER_TYPE (fsLit "floatFromInteger") floatFromIntegerIdKey
doubleFromIntegerName = varQual gHC_INTEGER_TYPE (fsLit "doubleFromInteger") doubleFromIntegerIdKey
encodeFloatIntegerName = varQual gHC_INTEGER_TYPE (fsLit "encodeFloatInteger") encodeFloatIntegerIdKey
encodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "encodeDoubleInteger") encodeDoubleIntegerIdKey
decodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "decodeDoubleInteger") decodeDoubleIntegerIdKey
gcdIntegerName = varQual gHC_INTEGER_TYPE (fsLit "gcdInteger") gcdIntegerIdKey
lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey
andIntegerName = varQual gHC_INTEGER_TYPE (fsLit "andInteger") andIntegerIdKey
orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey
xorIntegerName = varQual gHC_INTEGER_TYPE (fsLit "xorInteger") xorIntegerIdKey
complementIntegerName = varQual gHC_INTEGER_TYPE (fsLit "complementInteger") complementIntegerIdKey
shiftLIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftLInteger") shiftLIntegerIdKey
shiftRIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftRInteger") shiftRIntegerIdKey
bitIntegerName = varQual gHC_INTEGER_TYPE (fsLit "bitInteger") bitIntegerIdKey
-- GHC.Natural types
naturalTyConName, naturalSDataConName :: Name
naturalTyConName = tcQual gHC_NATURAL (fsLit "Natural") naturalTyConKey
naturalSDataConName = dcQual gHC_NATURAL (fsLit "NatS#") naturalSDataConKey
naturalFromIntegerName :: Name
naturalFromIntegerName = varQual gHC_NATURAL (fsLit "naturalFromInteger") naturalFromIntegerIdKey
naturalToIntegerName, plusNaturalName, minusNaturalName, timesNaturalName,
mkNaturalName, wordToNaturalName :: Name
naturalToIntegerName = varQual gHC_NATURAL (fsLit "naturalToInteger") naturalToIntegerIdKey
plusNaturalName = varQual gHC_NATURAL (fsLit "plusNatural") plusNaturalIdKey
minusNaturalName = varQual gHC_NATURAL (fsLit "minusNatural") minusNaturalIdKey
timesNaturalName = varQual gHC_NATURAL (fsLit "timesNatural") timesNaturalIdKey
mkNaturalName = varQual gHC_NATURAL (fsLit "mkNatural") mkNaturalIdKey
wordToNaturalName = varQual gHC_NATURAL (fsLit "wordToNatural#") wordToNaturalIdKey
---------------------------------
-- ghc-bignum
---------------------------------
integerFromNaturalName
, integerToNaturalClampName
, integerToWordName
, integerToIntName
, integerToWord64Name
, integerToInt64Name
, integerFromWordName
, integerFromWord64Name
, integerFromInt64Name
, integerAddName
, integerMulName
, integerSubName
, integerNegateName
, integerEqPrimName
, integerNePrimName
, integerLePrimName
, integerGtPrimName
, integerLtPrimName
, integerGePrimName
, integerAbsName
, integerSignumName
, integerCompareName
, integerQuotName
, integerRemName
, integerDivName
, integerModName
, integerDivModName
, integerQuotRemName
, integerToFloatName
, integerToDoubleName
, integerEncodeFloatName
, integerEncodeDoubleName
, integerGcdName
, integerLcmName
, integerAndName
, integerOrName
, integerXorName
, integerComplementName
, integerBitName
, integerShiftLName
, integerShiftRName
, naturalToWordName
, naturalAddName
, naturalSubName
, naturalMulName
, naturalQuotName
, naturalRemName
, naturalQuotRemName
, bignatFromWordListName
:: Name
bnbVarQual, bnnVarQual, bniVarQual :: String -> Unique -> Name
bnbVarQual str key = varQual gHC_NUM_BIGNAT (fsLit str) key
bnnVarQual str key = varQual gHC_NUM_NATURAL (fsLit str) key
bniVarQual str key = varQual gHC_NUM_INTEGER (fsLit str) key
-- Types and DataCons
bignatFromWordListName = bnbVarQual "bigNatFromWordList#" bignatFromWordListIdKey
naturalToWordName = bnnVarQual "naturalToWord#" naturalToWordIdKey
naturalAddName = bnnVarQual "naturalAdd" naturalAddIdKey
naturalSubName = bnnVarQual "naturalSubUnsafe" naturalSubIdKey
naturalMulName = bnnVarQual "naturalMul" naturalMulIdKey
naturalQuotName = bnnVarQual "naturalQuot" naturalQuotIdKey
naturalRemName = bnnVarQual "naturalRem" naturalRemIdKey
naturalQuotRemName = bnnVarQual "naturalQuotRem" naturalQuotRemIdKey
integerFromNaturalName = bniVarQual "integerFromNatural" integerFromNaturalIdKey
integerToNaturalClampName = bniVarQual "integerToNaturalClamp" integerToNaturalClampIdKey
integerToWordName = bniVarQual "integerToWord#" integerToWordIdKey
integerToIntName = bniVarQual "integerToInt#" integerToIntIdKey
integerToWord64Name = bniVarQual "integerToWord64#" integerToWord64IdKey
integerToInt64Name = bniVarQual "integerToInt64#" integerToInt64IdKey
integerFromWordName = bniVarQual "integerFromWord#" integerFromWordIdKey
integerFromWord64Name = bniVarQual "integerFromWord64#" integerFromWord64IdKey
integerFromInt64Name = bniVarQual "integerFromInt64#" integerFromInt64IdKey
integerAddName = bniVarQual "integerAdd" integerAddIdKey
integerMulName = bniVarQual "integerMul" integerMulIdKey
integerSubName = bniVarQual "integerSub" integerSubIdKey
integerNegateName = bniVarQual "integerNegate" integerNegateIdKey
integerEqPrimName = bniVarQual "integerEq#" integerEqPrimIdKey
integerNePrimName = bniVarQual "integerNe#" integerNePrimIdKey
integerLePrimName = bniVarQual "integerLe#" integerLePrimIdKey
integerGtPrimName = bniVarQual "integerGt#" integerGtPrimIdKey
integerLtPrimName = bniVarQual "integerLt#" integerLtPrimIdKey
integerGePrimName = bniVarQual "integerGe#" integerGePrimIdKey
integerAbsName = bniVarQual "integerAbs" integerAbsIdKey
integerSignumName = bniVarQual "integerSignum" integerSignumIdKey
integerCompareName = bniVarQual "integerCompare" integerCompareIdKey
integerQuotName = bniVarQual "integerQuot" integerQuotIdKey
integerRemName = bniVarQual "integerRem" integerRemIdKey
integerDivName = bniVarQual "integerDiv" integerDivIdKey
integerModName = bniVarQual "integerMod" integerModIdKey
integerDivModName = bniVarQual "integerDivMod#" integerDivModIdKey
integerQuotRemName = bniVarQual "integerQuotRem#" integerQuotRemIdKey
integerToFloatName = bniVarQual "integerToFloat#" integerToFloatIdKey
integerToDoubleName = bniVarQual "integerToDouble#" integerToDoubleIdKey
integerEncodeFloatName = bniVarQual "integerEncodeFloat#" integerEncodeFloatIdKey
integerEncodeDoubleName = bniVarQual "integerEncodeDouble#" integerEncodeDoubleIdKey
integerGcdName = bniVarQual "integerGcd" integerGcdIdKey
integerLcmName = bniVarQual "integerLcm" integerLcmIdKey
integerAndName = bniVarQual "integerAnd" integerAndIdKey
integerOrName = bniVarQual "integerOr" integerOrIdKey
integerXorName = bniVarQual "integerXor" integerXorIdKey
integerComplementName = bniVarQual "integerComplement" integerComplementIdKey
integerBitName = bniVarQual "integerBit#" integerBitIdKey
integerShiftLName = bniVarQual "integerShiftL#" integerShiftLIdKey
integerShiftRName = bniVarQual "integerShiftR#" integerShiftRIdKey
---------------------------------
-- End of ghc-bignum
---------------------------------
-- GHC.Real types and classes
rationalTyConName, ratioTyConName, ratioDataConName, realClassName,
......@@ -1334,12 +1370,11 @@ typeErrorShowTypeDataConName =
-- Unsafe coercion proofs
unsafeEqualityProofName, unsafeEqualityTyConName, unsafeCoercePrimName,
unsafeCoerceName, unsafeReflDataConName :: Name
unsafeReflDataConName :: Name
unsafeEqualityProofName = varQual uNSAFE_COERCE (fsLit "unsafeEqualityProof") unsafeEqualityProofIdKey
unsafeEqualityTyConName = tcQual uNSAFE_COERCE (fsLit "UnsafeEquality") unsafeEqualityTyConKey
unsafeReflDataConName = dcQual uNSAFE_COERCE (fsLit "UnsafeRefl") unsafeReflDataConKey
unsafeCoercePrimName = varQual uNSAFE_COERCE (fsLit "unsafeCoerce#") unsafeCoercePrimIdKey
unsafeCoerceName = varQual uNSAFE_COERCE (fsLit "unsafeCoerce") unsafeCoerceIdKey
-- Dynamic
toDynName :: Name
......@@ -1629,7 +1664,7 @@ datatypeClassKey = mkPreludeClassUnique 39
constructorClassKey = mkPreludeClassUnique 40
selectorClassKey = mkPreludeClassUnique 41
-- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
-- KnownNat: see Note [KnownNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
knownNatClassNameKey :: Unique
knownNatClassNameKey = mkPreludeClassUnique 42
......@@ -1679,12 +1714,14 @@ addrPrimTyConKey, arrayPrimTyConKey, arrayArrayPrimTyConKey, boolTyConKey,
weakPrimTyConKey, mutableArrayPrimTyConKey, mutableArrayArrayPrimTyConKey,
mutableByteArrayPrimTyConKey, orderingTyConKey, mVarPrimTyConKey,
ratioTyConKey, rationalTyConKey, realWorldTyConKey, stablePtrPrimTyConKey,
stablePtrTyConKey, eqTyConKey, heqTyConKey,
smallArrayPrimTyConKey, smallMutableArrayPrimTyConKey :: Unique
stablePtrTyConKey, eqTyConKey, heqTyConKey, ioPortPrimTyConKey,
smallArrayPrimTyConKey, smallMutableArrayPrimTyConKey,
stringTyConKey :: Unique
addrPrimTyConKey = mkPreludeTyConUnique 1
arrayPrimTyConKey = mkPreludeTyConUnique 3
boolTyConKey = mkPreludeTyConUnique 4
byteArrayPrimTyConKey = mkPreludeTyConUnique 5
stringTyConKey = mkPreludeTyConUnique 6
charPrimTyConKey = mkPreludeTyConUnique 7
charTyConKey = mkPreludeTyConUnique 8
doublePrimTyConKey = mkPreludeTyConUnique 9
......@@ -1713,11 +1750,12 @@ mutableArrayPrimTyConKey = mkPreludeTyConUnique 30
mutableByteArrayPrimTyConKey = mkPreludeTyConUnique 31
orderingTyConKey = mkPreludeTyConUnique 32
mVarPrimTyConKey = mkPreludeTyConUnique 33
ratioTyConKey = mkPreludeTyConUnique 34
rationalTyConKey = mkPreludeTyConUnique 35
realWorldTyConKey = mkPreludeTyConUnique 36
stablePtrPrimTyConKey = mkPreludeTyConUnique 37
stablePtrTyConKey = mkPreludeTyConUnique 38
ioPortPrimTyConKey = mkPreludeTyConUnique 34
ratioTyConKey = mkPreludeTyConUnique 35
rationalTyConKey = mkPreludeTyConUnique 36
realWorldTyConKey = mkPreludeTyConUnique 37
stablePtrPrimTyConKey = mkPreludeTyConUnique 38
stablePtrTyConKey = mkPreludeTyConUnique 39
eqTyConKey = mkPreludeTyConUnique 40
heqTyConKey = mkPreludeTyConUnique 41
arrayArrayPrimTyConKey = mkPreludeTyConUnique 42
......@@ -1731,7 +1769,7 @@ statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey,
liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey,
typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey,
funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey,
eqReprPrimTyConKey, eqPhantPrimTyConKey, voidPrimTyConKey,
eqReprPrimTyConKey, eqPhantPrimTyConKey,
compactPrimTyConKey :: Unique
statePrimTyConKey = mkPreludeTyConUnique 50
stableNamePrimTyConKey = mkPreludeTyConUnique 51
......@@ -1741,7 +1779,6 @@ eqReprPrimTyConKey = mkPreludeTyConUnique 54
eqPhantPrimTyConKey = mkPreludeTyConUnique 55
mutVarPrimTyConKey = mkPreludeTyConUnique 56
ioTyConKey = mkPreludeTyConUnique 57
voidPrimTyConKey = mkPreludeTyConUnique 58
wordPrimTyConKey = mkPreludeTyConUnique 59
wordTyConKey = mkPreludeTyConUnique 60
word8PrimTyConKey = mkPreludeTyConUnique 61
......@@ -1835,7 +1872,7 @@ uIntTyConKey = mkPreludeTyConUnique 162
uWordTyConKey = mkPreludeTyConUnique 163
-- Type-level naturals
typeNatKindConNameKey, typeSymbolKindConNameKey,
typeSymbolKindConNameKey,
typeNatAddTyFamNameKey, typeNatMulTyFamNameKey, typeNatExpTyFamNameKey,
typeNatLeqTyFamNameKey, typeNatSubTyFamNameKey
, typeSymbolCmpTyFamNameKey, typeNatCmpTyFamNameKey
......@@ -1843,7 +1880,6 @@ typeNatKindConNameKey, typeSymbolKindConNameKey,
, typeNatModTyFamNameKey
, typeNatLogTyFamNameKey
:: Unique
typeNatKindConNameKey = mkPreludeTyConUnique 164
typeSymbolKindConNameKey = mkPreludeTyConUnique 165
typeNatAddTyFamNameKey = mkPreludeTyConUnique 166
typeNatMulTyFamNameKey = mkPreludeTyConUnique 167
......@@ -1902,6 +1938,15 @@ typeSymbolAppendFamNameKey = mkPreludeTyConUnique 190
unsafeEqualityTyConKey :: Unique
unsafeEqualityTyConKey = mkPreludeTyConUnique 191
-- Linear types
multiplicityTyConKey :: Unique
multiplicityTyConKey = mkPreludeTyConUnique 192
unrestrictedFunTyConKey :: Unique
unrestrictedFunTyConKey = mkPreludeTyConUnique 193
multMulTyConKey :: Unique
multMulTyConKey = mkPreludeTyConUnique 194
---------------- Template Haskell -------------------
-- GHC.Builtin.Names.TH: USES TyConUniques 200-299
......@@ -1922,9 +1967,9 @@ unsafeEqualityTyConKey = mkPreludeTyConUnique 191
-}
charDataConKey, consDataConKey, doubleDataConKey, falseDataConKey,
floatDataConKey, intDataConKey, integerSDataConKey, nilDataConKey,
floatDataConKey, intDataConKey, nilDataConKey,
ratioDataConKey, stableNameDataConKey, trueDataConKey, wordDataConKey,
word8DataConKey, ioDataConKey, integerDataConKey, heqDataConKey,
word8DataConKey, ioDataConKey, heqDataConKey,
coercibleDataConKey, eqDataConKey, nothingDataConKey, justDataConKey :: Unique
charDataConKey = mkPreludeDataConUnique 1
......@@ -1933,19 +1978,17 @@ doubleDataConKey = mkPreludeDataConUnique 3
falseDataConKey = mkPreludeDataConUnique 4
floatDataConKey = mkPreludeDataConUnique 5
intDataConKey = mkPreludeDataConUnique 6
integerSDataConKey = mkPreludeDataConUnique 7
nothingDataConKey = mkPreludeDataConUnique 8
justDataConKey = mkPreludeDataConUnique 9
eqDataConKey = mkPreludeDataConUnique 10
nilDataConKey = mkPreludeDataConUnique 11
ratioDataConKey = mkPreludeDataConUnique 12
word8DataConKey = mkPreludeDataConUnique 13
stableNameDataConKey = mkPreludeDataConUnique 14
trueDataConKey = mkPreludeDataConUnique 15
wordDataConKey = mkPreludeDataConUnique 16
ioDataConKey = mkPreludeDataConUnique 17
integerDataConKey = mkPreludeDataConUnique 18
heqDataConKey = mkPreludeDataConUnique 19
nothingDataConKey = mkPreludeDataConUnique 7
justDataConKey = mkPreludeDataConUnique 8
eqDataConKey = mkPreludeDataConUnique 9
nilDataConKey = mkPreludeDataConUnique 10
ratioDataConKey = mkPreludeDataConUnique 11
word8DataConKey = mkPreludeDataConUnique 12
stableNameDataConKey = mkPreludeDataConUnique 13
trueDataConKey = mkPreludeDataConUnique 14
wordDataConKey = mkPreludeDataConUnique 15
ioDataConKey = mkPreludeDataConUnique 16
heqDataConKey = mkPreludeDataConUnique 18
-- Generic data constructors
crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique
......@@ -2076,6 +2119,22 @@ typeLitNatDataConKey = mkPreludeDataConUnique 113
unsafeReflDataConKey :: Unique
unsafeReflDataConKey = mkPreludeDataConUnique 114
-- Multiplicity
oneDataConKey, manyDataConKey :: Unique
oneDataConKey = mkPreludeDataConUnique 115
manyDataConKey = mkPreludeDataConUnique 116
-- ghc-bignum
integerISDataConKey, integerINDataConKey, integerIPDataConKey,
naturalNSDataConKey, naturalNBDataConKey :: Unique
integerISDataConKey = mkPreludeDataConUnique 120
integerINDataConKey = mkPreludeDataConUnique 121
integerIPDataConKey = mkPreludeDataConUnique 122
naturalNSDataConKey = mkPreludeDataConUnique 123
naturalNBDataConKey = mkPreludeDataConUnique 124
---------------- Template Haskell -------------------
-- GHC.Builtin.Names.TH: USES DataUniques 200-250
-----------------------------------------------------
......@@ -2099,7 +2158,9 @@ wildCardKey, absentErrorIdKey, augmentIdKey, appendIdKey,
unpackCStringFoldrIdKey, unpackCStringFoldrUtf8IdKey,
unpackCStringIdKey,
typeErrorIdKey, divIntIdKey, modIntIdKey,
absentSumFieldErrorIdKey, cstringLengthIdKey :: Unique
absentSumFieldErrorIdKey, cstringLengthIdKey,
raiseOverflowIdKey, raiseUnderflowIdKey, raiseDivZeroIdKey
:: Unique
wildCardKey = mkPreludeMiscIdUnique 0 -- See Note [WildCard binders]
absentErrorIdKey = mkPreludeMiscIdUnique 1
......@@ -2129,6 +2190,9 @@ typeErrorIdKey = mkPreludeMiscIdUnique 23
divIntIdKey = mkPreludeMiscIdUnique 24
modIntIdKey = mkPreludeMiscIdUnique 25
cstringLengthIdKey = mkPreludeMiscIdUnique 26
raiseOverflowIdKey = mkPreludeMiscIdUnique 27
raiseUnderflowIdKey = mkPreludeMiscIdUnique 28
raiseDivZeroIdKey = mkPreludeMiscIdUnique 29
concatIdKey, filterIdKey, zipIdKey,
bindIOIdKey, returnIOIdKey, newStablePtrIdKey,
......@@ -2149,63 +2213,6 @@ sndIdKey = mkPreludeMiscIdUnique 42
otherwiseIdKey = mkPreludeMiscIdUnique 43
assertIdKey = mkPreludeMiscIdUnique 44
mkIntegerIdKey, smallIntegerIdKey, wordToIntegerIdKey,
integerToWordIdKey, integerToIntIdKey,
integerToWord64IdKey, integerToInt64IdKey,
word64ToIntegerIdKey, int64ToIntegerIdKey,
plusIntegerIdKey, timesIntegerIdKey, minusIntegerIdKey,
negateIntegerIdKey,
eqIntegerPrimIdKey, neqIntegerPrimIdKey, absIntegerIdKey, signumIntegerIdKey,
leIntegerPrimIdKey, gtIntegerPrimIdKey, ltIntegerPrimIdKey, geIntegerPrimIdKey,
compareIntegerIdKey, quotRemIntegerIdKey, divModIntegerIdKey,
quotIntegerIdKey, remIntegerIdKey, divIntegerIdKey, modIntegerIdKey,
floatFromIntegerIdKey, doubleFromIntegerIdKey,
encodeFloatIntegerIdKey, encodeDoubleIntegerIdKey,
decodeDoubleIntegerIdKey,
gcdIntegerIdKey, lcmIntegerIdKey,
andIntegerIdKey, orIntegerIdKey, xorIntegerIdKey, complementIntegerIdKey,
shiftLIntegerIdKey, shiftRIntegerIdKey :: Unique
mkIntegerIdKey = mkPreludeMiscIdUnique 60
smallIntegerIdKey = mkPreludeMiscIdUnique 61
integerToWordIdKey = mkPreludeMiscIdUnique 62
integerToIntIdKey = mkPreludeMiscIdUnique 63
integerToWord64IdKey = mkPreludeMiscIdUnique 64
integerToInt64IdKey = mkPreludeMiscIdUnique 65
plusIntegerIdKey = mkPreludeMiscIdUnique 66
timesIntegerIdKey = mkPreludeMiscIdUnique 67
minusIntegerIdKey = mkPreludeMiscIdUnique 68
negateIntegerIdKey = mkPreludeMiscIdUnique 69
eqIntegerPrimIdKey = mkPreludeMiscIdUnique 70
neqIntegerPrimIdKey = mkPreludeMiscIdUnique 71
absIntegerIdKey = mkPreludeMiscIdUnique 72
signumIntegerIdKey = mkPreludeMiscIdUnique 73
leIntegerPrimIdKey = mkPreludeMiscIdUnique 74
gtIntegerPrimIdKey = mkPreludeMiscIdUnique 75
ltIntegerPrimIdKey = mkPreludeMiscIdUnique 76
geIntegerPrimIdKey = mkPreludeMiscIdUnique 77
compareIntegerIdKey = mkPreludeMiscIdUnique 78
quotIntegerIdKey = mkPreludeMiscIdUnique 79
remIntegerIdKey = mkPreludeMiscIdUnique 80
divIntegerIdKey = mkPreludeMiscIdUnique 81
modIntegerIdKey = mkPreludeMiscIdUnique 82
divModIntegerIdKey = mkPreludeMiscIdUnique 83
quotRemIntegerIdKey = mkPreludeMiscIdUnique 84
floatFromIntegerIdKey = mkPreludeMiscIdUnique 85
doubleFromIntegerIdKey = mkPreludeMiscIdUnique 86
encodeFloatIntegerIdKey = mkPreludeMiscIdUnique 87
encodeDoubleIntegerIdKey = mkPreludeMiscIdUnique 88
gcdIntegerIdKey = mkPreludeMiscIdUnique 89
lcmIntegerIdKey = mkPreludeMiscIdUnique 90
andIntegerIdKey = mkPreludeMiscIdUnique 91
orIntegerIdKey = mkPreludeMiscIdUnique 92
xorIntegerIdKey = mkPreludeMiscIdUnique 93
complementIntegerIdKey = mkPreludeMiscIdUnique 94
shiftLIntegerIdKey = mkPreludeMiscIdUnique 95
shiftRIntegerIdKey = mkPreludeMiscIdUnique 96
wordToIntegerIdKey = mkPreludeMiscIdUnique 97
word64ToIntegerIdKey = mkPreludeMiscIdUnique 98
int64ToIntegerIdKey = mkPreludeMiscIdUnique 99
decodeDoubleIntegerIdKey = mkPreludeMiscIdUnique 100
rootMainKey, runMainKey :: Unique
rootMainKey = mkPreludeMiscIdUnique 101
......@@ -2402,24 +2409,118 @@ fromStaticPtrClassOpKey = mkPreludeMiscIdUnique 560
makeStaticKey :: Unique
makeStaticKey = mkPreludeMiscIdUnique 561
-- Natural
naturalFromIntegerIdKey, naturalToIntegerIdKey, plusNaturalIdKey,
minusNaturalIdKey, timesNaturalIdKey, mkNaturalIdKey,
naturalSDataConKey, wordToNaturalIdKey :: Unique
naturalFromIntegerIdKey = mkPreludeMiscIdUnique 562
naturalToIntegerIdKey = mkPreludeMiscIdUnique 563
plusNaturalIdKey = mkPreludeMiscIdUnique 564
minusNaturalIdKey = mkPreludeMiscIdUnique 565
timesNaturalIdKey = mkPreludeMiscIdUnique 566
mkNaturalIdKey = mkPreludeMiscIdUnique 567
naturalSDataConKey = mkPreludeMiscIdUnique 568
wordToNaturalIdKey = mkPreludeMiscIdUnique 569
-- Unsafe coercion proofs
unsafeEqualityProofIdKey, unsafeCoercePrimIdKey, unsafeCoerceIdKey :: Unique
unsafeEqualityProofIdKey, unsafeCoercePrimIdKey :: Unique
unsafeEqualityProofIdKey = mkPreludeMiscIdUnique 570
unsafeCoercePrimIdKey = mkPreludeMiscIdUnique 571
unsafeCoerceIdKey = mkPreludeMiscIdUnique 572
------------------------------------------------------
-- ghc-bignum uses 600-699 uniques
------------------------------------------------------
integerFromNaturalIdKey
, integerToNaturalClampIdKey
, integerToWordIdKey
, integerToIntIdKey
, integerToWord64IdKey
, integerToInt64IdKey
, integerAddIdKey
, integerMulIdKey
, integerSubIdKey
, integerNegateIdKey
, integerEqPrimIdKey
, integerNePrimIdKey
, integerLePrimIdKey
, integerGtPrimIdKey
, integerLtPrimIdKey
, integerGePrimIdKey
, integerAbsIdKey
, integerSignumIdKey
, integerCompareIdKey
, integerQuotIdKey
, integerRemIdKey
, integerDivIdKey
, integerModIdKey
, integerDivModIdKey
, integerQuotRemIdKey
, integerToFloatIdKey
, integerToDoubleIdKey
, integerEncodeFloatIdKey
, integerEncodeDoubleIdKey
, integerGcdIdKey
, integerLcmIdKey
, integerAndIdKey
, integerOrIdKey
, integerXorIdKey
, integerComplementIdKey
, integerBitIdKey
, integerShiftLIdKey
, integerShiftRIdKey
, integerFromWordIdKey
, integerFromWord64IdKey
, integerFromInt64IdKey
, naturalToWordIdKey
, naturalAddIdKey
, naturalSubIdKey
, naturalMulIdKey
, naturalQuotIdKey
, naturalRemIdKey
, naturalQuotRemIdKey
, bignatFromWordListIdKey
:: Unique
integerFromNaturalIdKey = mkPreludeMiscIdUnique 600
integerToNaturalClampIdKey = mkPreludeMiscIdUnique 601
integerToWordIdKey = mkPreludeMiscIdUnique 602
integerToIntIdKey = mkPreludeMiscIdUnique 603
integerToWord64IdKey = mkPreludeMiscIdUnique 604
integerToInt64IdKey = mkPreludeMiscIdUnique 605
integerAddIdKey = mkPreludeMiscIdUnique 606
integerMulIdKey = mkPreludeMiscIdUnique 607
integerSubIdKey = mkPreludeMiscIdUnique 608
integerNegateIdKey = mkPreludeMiscIdUnique 609
integerEqPrimIdKey = mkPreludeMiscIdUnique 610
integerNePrimIdKey = mkPreludeMiscIdUnique 611
integerLePrimIdKey = mkPreludeMiscIdUnique 612
integerGtPrimIdKey = mkPreludeMiscIdUnique 613
integerLtPrimIdKey = mkPreludeMiscIdUnique 614
integerGePrimIdKey = mkPreludeMiscIdUnique 615
integerAbsIdKey = mkPreludeMiscIdUnique 616
integerSignumIdKey = mkPreludeMiscIdUnique 617
integerCompareIdKey = mkPreludeMiscIdUnique 618
integerQuotIdKey = mkPreludeMiscIdUnique 619
integerRemIdKey = mkPreludeMiscIdUnique 620
integerDivIdKey = mkPreludeMiscIdUnique 621
integerModIdKey = mkPreludeMiscIdUnique 622
integerDivModIdKey = mkPreludeMiscIdUnique 623
integerQuotRemIdKey = mkPreludeMiscIdUnique 624
integerToFloatIdKey = mkPreludeMiscIdUnique 625
integerToDoubleIdKey = mkPreludeMiscIdUnique 626
integerEncodeFloatIdKey = mkPreludeMiscIdUnique 627
integerEncodeDoubleIdKey = mkPreludeMiscIdUnique 628
integerGcdIdKey = mkPreludeMiscIdUnique 629
integerLcmIdKey = mkPreludeMiscIdUnique 630
integerAndIdKey = mkPreludeMiscIdUnique 631
integerOrIdKey = mkPreludeMiscIdUnique 632
integerXorIdKey = mkPreludeMiscIdUnique 633
integerComplementIdKey = mkPreludeMiscIdUnique 634
integerBitIdKey = mkPreludeMiscIdUnique 635
integerShiftLIdKey = mkPreludeMiscIdUnique 636
integerShiftRIdKey = mkPreludeMiscIdUnique 637
integerFromWordIdKey = mkPreludeMiscIdUnique 638
integerFromWord64IdKey = mkPreludeMiscIdUnique 639
integerFromInt64IdKey = mkPreludeMiscIdUnique 640
naturalToWordIdKey = mkPreludeMiscIdUnique 650
naturalAddIdKey = mkPreludeMiscIdUnique 651
naturalSubIdKey = mkPreludeMiscIdUnique 652
naturalMulIdKey = mkPreludeMiscIdUnique 653
naturalQuotIdKey = mkPreludeMiscIdUnique 654
naturalRemIdKey = mkPreludeMiscIdUnique 655
naturalQuotRemIdKey = mkPreludeMiscIdUnique 656
bignatFromWordListIdKey = mkPreludeMiscIdUnique 670
{-
************************************************************************
......
......@@ -9,11 +9,13 @@ module GHC.Builtin.Names.TH where
import GHC.Prelude ()
import GHC.Builtin.Names( mk_known_key_name )
import GHC.Unit
import GHC.Unit.Types
import GHC.Unit.Module.Name
import GHC.Types.Name( Name )
import GHC.Types.Name.Occurrence( tcName, clsName, dataName, varName )
import GHC.Types.Name.Reader( RdrName, nameRdrName )
import GHC.Types.Unique
import GHC.Builtin.Uniques
import GHC.Data.FastString
-- To add a name, do three things
......@@ -30,10 +32,10 @@ templateHaskellNames = [
returnQName, bindQName, sequenceQName, newNameName, liftName, liftTypedName,
mkNameName, mkNameG_vName, mkNameG_dName, mkNameG_tcName, mkNameLName,
mkNameSName,
mkModNameName,
liftStringName,
unTypeName,
unTypeQName,
unsafeTExpCoerceName,
unTypeName, unTypeCodeName,
unsafeCodeCoerceName,
-- Lit
charLName, stringLName, integerLName, intPrimLName, wordPrimLName,
......@@ -98,7 +100,7 @@ templateHaskellNames = [
-- Type
forallTName, forallVisTName, varTName, conTName, infixTName, appTName,
appKindTName, equalityTName, tupleTName, unboxedTupleTName,
unboxedSumTName, arrowTName, listTName, sigTName, litTName,
unboxedSumTName, arrowTName, mulArrowTName, listTName, sigTName, litTName,
promotedTName, promotedTupleTName, promotedNilTName, promotedConsTName,
wildCardTName, implicitParamTName,
-- TyLit
......@@ -134,8 +136,6 @@ templateHaskellNames = [
-- DerivStrategy
stockStrategyName, anyclassStrategyName,
newtypeStrategyName, viaStrategyName,
-- TExp
tExpDataConName,
-- RuleBndr
ruleVarName, typedRuleVarName,
-- FunDep
......@@ -158,8 +158,9 @@ templateHaskellNames = [
typeTyConName, tyVarBndrUnitTyConName, tyVarBndrSpecTyConName, clauseTyConName,
patQTyConName, funDepTyConName, decsQTyConName,
ruleBndrTyConName, tySynEqnTyConName,
roleTyConName, tExpTyConName, injAnnTyConName, kindTyConName,
roleTyConName, codeTyConName, injAnnTyConName, kindTyConName,
overlapTyConName, derivClauseTyConName, derivStrategyTyConName,
modNameTyConName,
-- Quasiquoting
quoteDecName, quoteTypeName, quoteExpName, quotePatName]
......@@ -170,7 +171,7 @@ thLib = mkTHModule (fsLit "Language.Haskell.TH.Lib.Internal")
qqLib = mkTHModule (fsLit "Language.Haskell.TH.Quote")
mkTHModule :: FastString -> Module
mkTHModule m = mkModule thUnitId (mkModuleNameFS m)
mkTHModule m = mkModule thUnit (mkModuleNameFS m)
libFun, libTc, thFun, thTc, thCls, thCon, qqFun :: FastString -> Unique -> Name
libFun = mk_known_key_name varName thLib
......@@ -191,7 +192,8 @@ quoteClassName = thCls (fsLit "Quote") quoteClassKey
qTyConName, nameTyConName, fieldExpTyConName, patTyConName,
fieldPatTyConName, expTyConName, decTyConName, typeTyConName,
matchTyConName, clauseTyConName, funDepTyConName, predTyConName,
tExpTyConName, injAnnTyConName, overlapTyConName, decsTyConName :: Name
codeTyConName, injAnnTyConName, overlapTyConName, decsTyConName,
modNameTyConName :: Name
qTyConName = thTc (fsLit "Q") qTyConKey
nameTyConName = thTc (fsLit "Name") nameTyConKey
fieldExpTyConName = thTc (fsLit "FieldExp") fieldExpTyConKey
......@@ -205,14 +207,15 @@ matchTyConName = thTc (fsLit "Match") matchTyConKey
clauseTyConName = thTc (fsLit "Clause") clauseTyConKey
funDepTyConName = thTc (fsLit "FunDep") funDepTyConKey
predTyConName = thTc (fsLit "Pred") predTyConKey
tExpTyConName = thTc (fsLit "TExp") tExpTyConKey
codeTyConName = thTc (fsLit "Code") codeTyConKey
injAnnTyConName = thTc (fsLit "InjectivityAnn") injAnnTyConKey
overlapTyConName = thTc (fsLit "Overlap") overlapTyConKey
modNameTyConName = thTc (fsLit "ModName") modNameTyConKey
returnQName, bindQName, sequenceQName, newNameName, liftName,
mkNameName, mkNameG_vName, mkNameG_dName, mkNameG_tcName,
mkNameLName, mkNameSName, liftStringName, unTypeName, unTypeQName,
unsafeTExpCoerceName, liftTypedName :: Name
mkNameLName, mkNameSName, liftStringName, unTypeName, unTypeCodeName,
unsafeCodeCoerceName, liftTypedName, mkModNameName :: Name
returnQName = thFun (fsLit "returnQ") returnQIdKey
bindQName = thFun (fsLit "bindQ") bindQIdKey
sequenceQName = thFun (fsLit "sequenceQ") sequenceQIdKey
......@@ -225,9 +228,10 @@ mkNameG_dName = thFun (fsLit "mkNameG_d") mkNameG_dIdKey
mkNameG_tcName = thFun (fsLit "mkNameG_tc") mkNameG_tcIdKey
mkNameLName = thFun (fsLit "mkNameL") mkNameLIdKey
mkNameSName = thFun (fsLit "mkNameS") mkNameSIdKey
mkModNameName = thFun (fsLit "mkModName") mkModNameIdKey
unTypeName = thFun (fsLit "unType") unTypeIdKey
unTypeQName = thFun (fsLit "unTypeQ") unTypeQIdKey
unsafeTExpCoerceName = thFun (fsLit "unsafeTExpCoerce") unsafeTExpCoerceIdKey
unTypeCodeName = thFun (fsLit "unTypeCode") unTypeCodeIdKey
unsafeCodeCoerceName = thFun (fsLit "unsafeCodeCoerce") unsafeCodeCoerceIdKey
liftTypedName = thFun (fsLit "liftTyped") liftTypedIdKey
......@@ -438,8 +442,8 @@ recordPatSynName = libFun (fsLit "recordPatSyn") recordPatSynIdKey
-- data Type = ...
forallTName, forallVisTName, varTName, conTName, infixTName, tupleTName,
unboxedTupleTName, unboxedSumTName, arrowTName, listTName, appTName,
appKindTName, sigTName, equalityTName, litTName, promotedTName,
unboxedTupleTName, unboxedSumTName, arrowTName, mulArrowTName, listTName,
appTName, appKindTName, sigTName, equalityTName, litTName, promotedTName,
promotedTupleTName, promotedNilTName, promotedConsTName,
wildCardTName, implicitParamTName :: Name
forallTName = libFun (fsLit "forallT") forallTIdKey
......@@ -450,6 +454,7 @@ tupleTName = libFun (fsLit "tupleT") tupleTIdKey
unboxedTupleTName = libFun (fsLit "unboxedTupleT") unboxedTupleTIdKey
unboxedSumTName = libFun (fsLit "unboxedSumT") unboxedSumTIdKey
arrowTName = libFun (fsLit "arrowT") arrowTIdKey
mulArrowTName = libFun (fsLit "mulArrowT") mulArrowTIdKey
listTName = libFun (fsLit "listT") listTIdKey
appTName = libFun (fsLit "appT") appTIdKey
appKindTName = libFun (fsLit "appKindT") appKindTIdKey
......@@ -519,10 +524,6 @@ unsafeName = libFun (fsLit "unsafe") unsafeIdKey
safeName = libFun (fsLit "safe") safeIdKey
interruptibleName = libFun (fsLit "interruptible") interruptibleIdKey
-- newtype TExp a = ...
tExpDataConName :: Name
tExpDataConName = thCon (fsLit "TExp") tExpDataConKey
-- data RuleBndr = ...
ruleVarName, typedRuleVarName :: Name
ruleVarName = libFun (fsLit ("ruleVar")) ruleVarIdKey
......@@ -647,9 +648,9 @@ expTyConKey, matchTyConKey, clauseTyConKey, qTyConKey, expQTyConKey,
fieldExpTyConKey, fieldPatTyConKey, nameTyConKey, patQTyConKey,
funDepTyConKey, predTyConKey,
predQTyConKey, decsQTyConKey, ruleBndrTyConKey, tySynEqnTyConKey,
roleTyConKey, tExpTyConKey, injAnnTyConKey, kindTyConKey,
overlapTyConKey, derivClauseTyConKey, derivStrategyTyConKey, decsTyConKey
:: Unique
roleTyConKey, codeTyConKey, injAnnTyConKey, kindTyConKey,
overlapTyConKey, derivClauseTyConKey, derivStrategyTyConKey, decsTyConKey,
modNameTyConKey :: Unique
expTyConKey = mkPreludeTyConUnique 200
matchTyConKey = mkPreludeTyConUnique 201
clauseTyConKey = mkPreludeTyConUnique 202
......@@ -661,7 +662,7 @@ conTyConKey = mkPreludeTyConUnique 210
typeQTyConKey = mkPreludeTyConUnique 211
typeTyConKey = mkPreludeTyConUnique 212
decTyConKey = mkPreludeTyConUnique 213
bangTypeTyConKey = mkPreludeTyConUnique 214
bangTypeTyConKey = mkPreludeTyConUnique 214
varBangTypeTyConKey = mkPreludeTyConUnique 215
fieldExpTyConKey = mkPreludeTyConUnique 216
fieldPatTyConKey = mkPreludeTyConUnique 217
......@@ -671,18 +672,19 @@ funDepTyConKey = mkPreludeTyConUnique 222
predTyConKey = mkPreludeTyConUnique 223
predQTyConKey = mkPreludeTyConUnique 224
tyVarBndrUnitTyConKey = mkPreludeTyConUnique 225
tyVarBndrSpecTyConKey = mkPreludeTyConUnique 237
decsQTyConKey = mkPreludeTyConUnique 226
ruleBndrTyConKey = mkPreludeTyConUnique 227
ruleBndrTyConKey = mkPreludeTyConUnique 227
tySynEqnTyConKey = mkPreludeTyConUnique 228
roleTyConKey = mkPreludeTyConUnique 229
tExpTyConKey = mkPreludeTyConUnique 230
injAnnTyConKey = mkPreludeTyConUnique 231
kindTyConKey = mkPreludeTyConUnique 232
kindTyConKey = mkPreludeTyConUnique 232
overlapTyConKey = mkPreludeTyConUnique 233
derivClauseTyConKey = mkPreludeTyConUnique 234
derivStrategyTyConKey = mkPreludeTyConUnique 235
derivClauseTyConKey = mkPreludeTyConUnique 234
derivStrategyTyConKey = mkPreludeTyConUnique 235
decsTyConKey = mkPreludeTyConUnique 236
tyVarBndrSpecTyConKey = mkPreludeTyConUnique 237
codeTyConKey = mkPreludeTyConUnique 238
modNameTyConKey = mkPreludeTyConUnique 239
{- *********************************************************************
* *
......@@ -710,10 +712,6 @@ allPhasesDataConKey = mkPreludeDataConUnique 205
fromPhaseDataConKey = mkPreludeDataConUnique 206
beforePhaseDataConKey = mkPreludeDataConUnique 207
-- newtype TExp a = ...
tExpDataConKey :: Unique
tExpDataConKey = mkPreludeDataConUnique 208
-- data Overlap = ..
overlappableDataConKey,
overlappingDataConKey,
......@@ -735,8 +733,8 @@ incoherentDataConKey = mkPreludeDataConUnique 212
returnQIdKey, bindQIdKey, sequenceQIdKey, liftIdKey, newNameIdKey,
mkNameIdKey, mkNameG_vIdKey, mkNameG_dIdKey, mkNameG_tcIdKey,
mkNameLIdKey, mkNameSIdKey, unTypeIdKey, unTypeQIdKey,
unsafeTExpCoerceIdKey, liftTypedIdKey :: Unique
mkNameLIdKey, mkNameSIdKey, unTypeIdKey, unTypeCodeIdKey,
unsafeCodeCoerceIdKey, liftTypedIdKey, mkModNameIdKey :: Unique
returnQIdKey = mkPreludeMiscIdUnique 200
bindQIdKey = mkPreludeMiscIdUnique 201
sequenceQIdKey = mkPreludeMiscIdUnique 202
......@@ -749,9 +747,10 @@ mkNameG_tcIdKey = mkPreludeMiscIdUnique 208
mkNameLIdKey = mkPreludeMiscIdUnique 209
mkNameSIdKey = mkPreludeMiscIdUnique 210
unTypeIdKey = mkPreludeMiscIdUnique 211
unTypeQIdKey = mkPreludeMiscIdUnique 212
unsafeTExpCoerceIdKey = mkPreludeMiscIdUnique 213
unTypeCodeIdKey = mkPreludeMiscIdUnique 212
liftTypedIdKey = mkPreludeMiscIdUnique 214
mkModNameIdKey = mkPreludeMiscIdUnique 215
unsafeCodeCoerceIdKey = mkPreludeMiscIdUnique 216
-- data Lit = ...
......@@ -1046,6 +1045,10 @@ interruptibleIdKey = mkPreludeMiscIdUnique 442
funDepIdKey :: Unique
funDepIdKey = mkPreludeMiscIdUnique 445
-- mulArrow
mulArrowTIdKey :: Unique
mulArrowTIdKey = mkPreludeMiscIdUnique 446
-- data TySynEqn = ...
tySynEqnIdKey :: Unique
tySynEqnIdKey = mkPreludeMiscIdUnique 460
......@@ -1093,9 +1096,10 @@ inferredSpecKey = mkPreludeMiscIdUnique 499
************************************************************************
-}
lift_RDR, liftTyped_RDR, mkNameG_dRDR, mkNameG_vRDR :: RdrName
lift_RDR, liftTyped_RDR, mkNameG_dRDR, mkNameG_vRDR, unsafeCodeCoerce_RDR :: RdrName
lift_RDR = nameRdrName liftName
liftTyped_RDR = nameRdrName liftTypedName
unsafeCodeCoerce_RDR = nameRdrName unsafeCodeCoerceName
mkNameG_dRDR = nameRdrName mkNameG_dName
mkNameG_vRDR = nameRdrName mkNameG_vName
......
......@@ -8,7 +8,7 @@
module GHC.Builtin.PrimOps (
PrimOp(..), PrimOpVecCat(..), allThePrimOps,
primOpType, primOpSig,
primOpType, primOpSig, primOpResultType,
primOpTag, maxPrimOpTag, primOpOcc,
primOpWrapperId,
......@@ -38,13 +38,15 @@ import GHC.Types.Name
import GHC.Builtin.Names ( gHC_PRIMOPWRAPPERS )
import GHC.Core.TyCon ( TyCon, isPrimTyCon, PrimRep(..) )
import GHC.Core.Type
import GHC.Types.RepType ( typePrimRep1, tyConPrimRep1 )
import GHC.Types.Basic ( Arity, Fixity(..), FixityDirection(..), Boxity(..),
SourceText(..) )
import GHC.Types.RepType ( tyConPrimRep1 )
import GHC.Types.Basic ( Arity, Boxity(..) )
import GHC.Types.Fixity ( Fixity(..), FixityDirection(..) )
import GHC.Types.SrcLoc ( wiredInSrcSpan )
import GHC.Types.ForeignCall ( CLabelString )
import GHC.Types.Unique ( Unique, mkPrimOpIdUnique, mkPrimOpWrapperUnique )
import GHC.Unit ( Unit )
import GHC.Types.SourceText ( SourceText(..) )
import GHC.Types.Unique ( Unique)
import GHC.Builtin.Uniques (mkPrimOpIdUnique, mkPrimOpWrapperUnique )
import GHC.Unit.Types ( Unit )
import GHC.Utils.Outputable
import GHC.Data.FastString
......@@ -102,33 +104,17 @@ tagToEnumKey = mkPrimOpIdUnique (primOpTag TagToEnumOp)
\subsection[PrimOp-info]{The essential info about each @PrimOp@}
* *
************************************************************************
The @String@ in the @PrimOpInfos@ is the ``base name'' by which the user may
refer to the primitive operation. The conventional \tr{#}-for-
unboxed ops is added on later.
The reason for the funny characters in the names is so we do not
interfere with the programmer's Haskell name spaces.
We use @PrimKinds@ for the ``type'' information, because they're
(slightly) more convenient to use than @TyCons@.
-}
data PrimOpInfo
= Dyadic OccName -- string :: T -> T -> T
Type
| Monadic OccName -- string :: T -> T
Type
| Compare OccName -- string :: T -> T -> Int#
= Compare OccName -- string :: T -> T -> Int#
Type
| GenPrimOp OccName -- string :: \/a1..an . T1 -> .. -> Tk -> T
[TyVar]
[Type]
Type
mkDyadic, mkMonadic, mkCompare :: FastString -> Type -> PrimOpInfo
mkDyadic str ty = Dyadic (mkVarOccFS str) ty
mkMonadic str ty = Monadic (mkVarOccFS str) ty
mkCompare :: FastString -> Type -> PrimOpInfo
mkCompare str ty = Compare (mkVarOccFS str) ty
mkGenPrimOp :: FastString -> [TyVar] -> [Type] -> Type -> PrimOpInfo
......@@ -453,7 +439,7 @@ Duplicate YES NO
just look at Control.Monad.ST.Lazy.Imp.strictToLazy! We get
something like this
p = case readMutVar# s v of
(# s', r #) -> (S# s', r)
(# s', r #) -> (State# s', r)
s' = case p of (s', r) -> s'
r = case p of (s', r) -> r
......@@ -467,7 +453,7 @@ Duplicate YES NO
Note [Implementation: how can_fail/has_side_effects affect transformations]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How do we ensure that that floating/duplication/discarding are done right
How do we ensure that floating/duplication/discarding are done right
in the simplifier?
Two main predicates on primpops test these flags:
......@@ -574,17 +560,19 @@ primOpCodeSizeForeignCall = 4
primOpType :: PrimOp -> Type -- you may want to use primOpSig instead
primOpType op
= case primOpInfo op of
Dyadic _occ ty -> dyadic_fun_ty ty
Monadic _occ ty -> monadic_fun_ty ty
Compare _occ ty -> compare_fun_ty ty
GenPrimOp _occ tyvars arg_tys res_ty ->
mkSpecForAllTys tyvars (mkVisFunTys arg_tys res_ty)
mkSpecForAllTys tyvars (mkVisFunTysMany arg_tys res_ty)
primOpResultType :: PrimOp -> Type
primOpResultType op
= case primOpInfo op of
Compare _occ _ty -> intPrimTy
GenPrimOp _occ _tyvars _arg_tys res_ty -> res_ty
primOpOcc :: PrimOp -> OccName
primOpOcc op = case primOpInfo op of
Dyadic occ _ -> occ
Monadic occ _ -> occ
Compare occ _ -> occ
GenPrimOp occ _ _ _ -> occ
......@@ -683,8 +671,8 @@ primOpWrapperId op = mkVanillaGlobalWithInfo name ty info
isComparisonPrimOp :: PrimOp -> Bool
isComparisonPrimOp op = case primOpInfo op of
Compare {} -> True
_ -> False
Compare {} -> True
GenPrimOp {} -> False
-- primOpSig is like primOpType but gives the result split apart:
-- (type variables, argument types, result type)
......@@ -697,8 +685,6 @@ primOpSig op
arity = length arg_tys
(tyvars, arg_tys, res_ty)
= case (primOpInfo op) of
Monadic _occ ty -> ([], [ty], ty )
Dyadic _occ ty -> ([], [ty,ty], ty )
Compare _occ ty -> ([], [ty,ty], intPrimTy)
GenPrimOp _occ tyvars arg_tys res_ty -> (tyvars, arg_tys, res_ty )
......@@ -713,8 +699,6 @@ data PrimOpResultInfo
getPrimOpResultInfo :: PrimOp -> PrimOpResultInfo
getPrimOpResultInfo op
= case (primOpInfo op) of
Dyadic _ ty -> ReturnsPrim (typePrimRep1 ty)
Monadic _ ty -> ReturnsPrim (typePrimRep1 ty)
Compare _ _ -> ReturnsPrim (tyConPrimRep1 intPrimTyCon)
GenPrimOp _ _ _ ty | isPrimTyCon tc -> ReturnsPrim (tyConPrimRep1 tc)
| otherwise -> ReturnsAlg tc
......@@ -738,10 +722,8 @@ commutableOp :: PrimOp -> Bool
-- Utils:
dyadic_fun_ty, monadic_fun_ty, compare_fun_ty :: Type -> Type
dyadic_fun_ty ty = mkVisFunTys [ty, ty] ty
monadic_fun_ty ty = mkVisFunTy ty ty
compare_fun_ty ty = mkVisFunTys [ty, ty] intPrimTy
compare_fun_ty :: Type -> Type
compare_fun_ty ty = mkVisFunTysMany [ty, ty] intPrimTy
-- Output stuff:
......
module GHC.Builtin.RebindableNames where
import GHC.Data.FastString
reboundIfSymbol :: FastString
reboundIfSymbol = fsLit "ifThenElse"
......@@ -10,7 +10,7 @@ Wired-in knowledge about {\em non-primitive} types
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
-- | This module is about types that can be defined in Haskell, but which
-- must be wired into the compiler nonetheless. C.f module GHC.Builtin.Types.Prim
-- must be wired into the compiler nonetheless. C.f module "GHC.Builtin.Types.Prim"
module GHC.Builtin.Types (
-- * Helper functions defined here
mkWiredInTyConName, -- This is used in GHC.Builtin.Types.Literals to define the
......@@ -39,7 +39,7 @@ module GHC.Builtin.Types (
-- * Char
charTyCon, charDataCon, charTyCon_RDR,
charTy, stringTy, charTyConName,
charTy, stringTy, charTyConName, stringTyCon_RDR,
-- * Double
doubleTyCon, doubleDataCon, doubleTy, doubleTyConName,
......@@ -75,13 +75,16 @@ module GHC.Builtin.Types (
promotedTupleDataCon,
unitTyCon, unitDataCon, unitDataConId, unitTy, unitTyConKey,
pairTyCon,
unboxedUnitTy,
unboxedUnitTyCon, unboxedUnitDataCon,
unboxedTupleKind, unboxedSumKind,
filterCTuple,
-- ** Constraint tuples
cTupleTyConName, cTupleTyConNames, isCTupleTyConName,
cTupleTyCon, cTupleTyConName, cTupleTyConNames, isCTupleTyConName,
cTupleTyConNameArity_maybe,
cTupleDataConName, cTupleDataConNames,
cTupleDataCon, cTupleDataConName, cTupleDataConNames,
cTupleSelId, cTupleSelIdName,
-- * Any
anyTyCon, anyTy, anyTypeOfKind,
......@@ -93,7 +96,7 @@ module GHC.Builtin.Types (
mkSumTy, sumTyCon, sumDataCon,
-- * Kinds
typeNatKindCon, typeNatKind, typeSymbolKindCon, typeSymbolKind,
typeSymbolKindCon, typeSymbolKind,
isLiftedTypeKindTyConName, liftedTypeKind,
typeToTypeKind, constraintKind,
liftedTypeKindTyCon, constraintKindTyCon, constraintKindTyConName,
......@@ -125,7 +128,26 @@ module GHC.Builtin.Types (
int8ElemRepDataConTy, int16ElemRepDataConTy, int32ElemRepDataConTy,
int64ElemRepDataConTy, word8ElemRepDataConTy, word16ElemRepDataConTy,
word32ElemRepDataConTy, word64ElemRepDataConTy, floatElemRepDataConTy,
doubleElemRepDataConTy
doubleElemRepDataConTy,
-- * Multiplicity and friends
multiplicityTyConName, oneDataConName, manyDataConName, multiplicityTy,
multiplicityTyCon, oneDataCon, manyDataCon, oneDataConTy, manyDataConTy,
oneDataConTyCon, manyDataConTyCon,
multMulTyCon,
unrestrictedFunTyCon, unrestrictedFunTyConName,
-- * Bignum
integerTy, integerTyCon, integerTyConName,
integerISDataCon, integerISDataConName,
integerIPDataCon, integerIPDataConName,
integerINDataCon, integerINDataConName,
naturalTy, naturalTyCon, naturalTyConName,
naturalNSDataCon, naturalNSDataConName,
naturalNBDataCon, naturalNBDataConName
) where
#include "HsVersions.h"
......@@ -137,32 +159,35 @@ import {-# SOURCE #-} GHC.Types.Id.Make ( mkDataConWorkId, mkDictSelId )
-- friends:
import GHC.Builtin.Names
import GHC.Builtin.Types.Prim
import {-# SOURCE #-} GHC.Builtin.Uniques
import GHC.Builtin.Uniques
-- others:
import GHC.Core.Coercion.Axiom
import GHC.Types.Id
import GHC.Types.TyThing
import GHC.Types.SourceText
import GHC.Types.Var (VarBndr (Bndr))
import GHC.Settings.Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE, mAX_SUM_SIZE )
import GHC.Unit.Module ( Module )
import GHC.Core.Type
import GHC.Types.RepType
import GHC.Core.DataCon
import {-# SOURCE #-} GHC.Core.ConLike
import GHC.Core.ConLike
import GHC.Core.TyCon
import GHC.Core.Class ( Class, mkClass )
import GHC.Types.Name.Reader
import GHC.Types.Name as Name
import GHC.Types.Name.Env ( NameEnv, mkNameEnv, lookupNameEnv, lookupNameEnv_NF )
import GHC.Types.Name.Set ( NameSet, mkNameSet, elemNameSet )
import GHC.Types.Basic
import GHC.Types.ForeignCall
import GHC.Types.SrcLoc ( noSrcSpan )
import GHC.Types.Unique
import GHC.Types.Unique.Set
import Data.Array
import GHC.Data.FastString
import GHC.Data.BooleanFormula ( mkAnd )
import GHC.Utils.Outputable
import GHC.Utils.Misc
import GHC.Data.BooleanFormula ( mkAnd )
import GHC.Utils.Panic
import qualified Data.ByteString.Char8 as BS
......@@ -221,6 +246,7 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they
, anyTyCon
, boolTyCon
, charTyCon
, stringTyCon
, doubleTyCon
, floatTyCon
, intTyCon
......@@ -232,13 +258,15 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they
, heqTyCon
, eqTyCon
, coercibleTyCon
, typeNatKindCon
, typeSymbolKindCon
, runtimeRepTyCon
, vecCountTyCon
, vecElemTyCon
, constraintKindTyCon
, liftedTypeKindTyCon
, multiplicityTyCon
, naturalTyCon
, integerTyCon
]
mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
......@@ -277,7 +305,7 @@ syntax. This has a few consequences:
* Writing (a ~ b) does not require enabling -XTypeOperators. It does, however,
require -XGADTs or -XTypeFamilies.
* The (~) type operator is always in scope. It doesn't need to be be imported,
* The (~) type operator is always in scope. It doesn't need to be imported,
and it cannot be hidden.
* We have a bunch of special cases in the compiler to arrange all of the above.
......@@ -301,11 +329,12 @@ coercibleTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Coercib
coercibleDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "MkCoercible") coercibleDataConKey coercibleDataCon
coercibleSCSelIdName = mkWiredInIdName gHC_TYPES (fsLit "coercible_sel") coercibleSCSelIdKey coercibleSCSelId
charTyConName, charDataConName, intTyConName, intDataConName :: Name
charTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Char") charTyConKey charTyCon
charDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "C#") charDataConKey charDataCon
intTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Int") intTyConKey intTyCon
intDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "I#") intDataConKey intDataCon
charTyConName, charDataConName, intTyConName, intDataConName, stringTyConName :: Name
charTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Char") charTyConKey charTyCon
charDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "C#") charDataConKey charDataCon
stringTyConName = mkWiredInTyConName UserSyntax gHC_BASE (fsLit "String") stringTyConKey stringTyCon
intTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Int") intTyConKey intTyCon
intDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "I#") intDataConKey intDataCon
boolTyConName, falseDataConName, trueDataConName :: Name
boolTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Bool") boolTyConKey boolTyCon
......@@ -449,8 +478,7 @@ makeRecoveryTyCon tc
-- at (promoted) use-sites of MkT.
-- Kinds
typeNatKindConName, typeSymbolKindConName :: Name
typeNatKindConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Nat") typeNatKindConNameKey typeNatKindCon
typeSymbolKindConName :: Name
typeSymbolKindConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Symbol") typeSymbolKindConNameKey typeSymbolKindCon
constraintKindTyConName :: Name
......@@ -459,6 +487,20 @@ constraintKindTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Constr
liftedTypeKindTyConName :: Name
liftedTypeKindTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Type") liftedTypeKindTyConKey liftedTypeKindTyCon
multiplicityTyConName :: Name
multiplicityTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Multiplicity")
multiplicityTyConKey multiplicityTyCon
oneDataConName, manyDataConName :: Name
oneDataConName = mkWiredInDataConName BuiltInSyntax gHC_TYPES (fsLit "One") oneDataConKey oneDataCon
manyDataConName = mkWiredInDataConName BuiltInSyntax gHC_TYPES (fsLit "Many") manyDataConKey manyDataCon
-- It feels wrong to have One and Many be BuiltInSyntax. But otherwise,
-- `Many`, in particular, is considered out of scope unless an appropriate
-- file is open. The problem with this is that `Many` appears implicitly in
-- types every time there is an `(->)`, hence out-of-scope errors get
-- reported. Making them built-in make it so that they are always considered in
-- scope.
runtimeRepTyConName, vecRepDataConName, tupleRepDataConName, sumRepDataConName :: Name
runtimeRepTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "RuntimeRep") runtimeRepTyConKey runtimeRepTyCon
vecRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "VecRep") vecRepDataConKey vecRepDataCon
......@@ -507,13 +549,14 @@ vecElemDataConNames = zipWith3Lazy mk_special_dc_name
mk_special_dc_name :: FastString -> Unique -> DataCon -> Name
mk_special_dc_name fs u dc = mkWiredInDataConName UserSyntax gHC_TYPES fs u dc
boolTyCon_RDR, false_RDR, true_RDR, intTyCon_RDR, charTyCon_RDR,
boolTyCon_RDR, false_RDR, true_RDR, intTyCon_RDR, charTyCon_RDR, stringTyCon_RDR,
intDataCon_RDR, listTyCon_RDR, consDataCon_RDR :: RdrName
boolTyCon_RDR = nameRdrName boolTyConName
false_RDR = nameRdrName falseDataConName
true_RDR = nameRdrName trueDataConName
intTyCon_RDR = nameRdrName intTyConName
charTyCon_RDR = nameRdrName charTyConName
stringTyCon_RDR = nameRdrName stringTyConName
intDataCon_RDR = nameRdrName intDataConName
listTyCon_RDR = nameRdrName listTyConName
consDataCon_RDR = nameRdrName consDataConName
......@@ -541,16 +584,20 @@ pcTyCon name cType tyvars cons
False -- Not in GADT syntax
pcDataCon :: Name -> [TyVar] -> [Type] -> TyCon -> DataCon
pcDataCon n univs = pcDataConWithFixity False n univs
pcDataCon n univs tys = pcDataConW n univs (map linear tys)
pcDataConW :: Name -> [TyVar] -> [Scaled Type] -> TyCon -> DataCon
pcDataConW n univs tys = pcDataConWithFixity False n univs
[] -- no ex_tvs
univs -- the univs are precisely the user-written tyvars
tys
pcDataConWithFixity :: Bool -- ^ declared infix?
-> Name -- ^ datacon name
-> [TyVar] -- ^ univ tyvars
-> [TyCoVar] -- ^ ex tycovars
-> [TyCoVar] -- ^ user-written tycovars
-> [Type] -- ^ args
-> [Scaled Type] -- ^ args
-> TyCon
-> DataCon
pcDataConWithFixity infx n = pcDataConWithFixity' infx n (dataConWorkerUnique (nameUnique n))
......@@ -564,7 +611,7 @@ pcDataConWithFixity infx n = pcDataConWithFixity' infx n (dataConWorkerUnique (n
pcDataConWithFixity' :: Bool -> Name -> Unique -> RuntimeRepInfo
-> [TyVar] -> [TyCoVar] -> [TyCoVar]
-> [Type] -> TyCon -> DataCon
-> [Scaled Type] -> TyCon -> DataCon
-- The Name should be in the DataName name space; it's the name
-- of the DataCon itself.
--
......@@ -622,7 +669,7 @@ mkDataConWorkerName data_con wrk_key =
pcSpecialDataCon :: Name -> [Type] -> TyCon -> RuntimeRepInfo -> DataCon
pcSpecialDataCon dc_name arg_tys tycon rri
= pcDataConWithFixity' False dc_name (dataConWorkerUnique (nameUnique dc_name)) rri
[] [] [] arg_tys tycon
[] [] [] (map linear arg_tys) tycon
{-
************************************************************************
......@@ -632,14 +679,11 @@ pcSpecialDataCon dc_name arg_tys tycon rri
************************************************************************
-}
typeNatKindCon, typeSymbolKindCon :: TyCon
-- data Nat
typeSymbolKindCon :: TyCon
-- data Symbol
typeNatKindCon = pcTyCon typeNatKindConName Nothing [] []
typeSymbolKindCon = pcTyCon typeSymbolKindConName Nothing [] []
typeNatKind, typeSymbolKind :: Kind
typeNatKind = mkTyConTy typeNatKindCon
typeSymbolKind :: Kind
typeSymbolKind = mkTyConTy typeSymbolKindCon
constraintKindTyCon :: TyCon
......@@ -648,7 +692,7 @@ constraintKindTyCon = pcTyCon constraintKindTyConName Nothing [] []
liftedTypeKind, typeToTypeKind, constraintKind :: Kind
liftedTypeKind = tYPE liftedRepTy
typeToTypeKind = liftedTypeKind `mkVisFunTy` liftedTypeKind
typeToTypeKind = liftedTypeKind `mkVisFunTyMany` liftedTypeKind
constraintKind = mkTyConApp constraintKindTyCon []
{-
......@@ -677,20 +721,23 @@ Note [How tuples work] See also Note [Known-key names] in GHC.Builtin.Names
but no actual declaration and no info table
* ConstraintTuples
- Are known-key rather than wired-in. Reason: it's awkward to
have all the superclass selectors wired-in.
- A wired-in type.
- Declared as classes in GHC.Classes, e.g.
class (c1,c2) => (c1,c2)
- Given constraints: the superclasses automatically become available
- Wanted constraints: there is a built-in instance
instance (c1,c2) => (c1,c2)
See GHC.Tc.Solver.Interact.matchCTuple
- Currently just go up to 62; beyond that
See GHC.Tc.Instance.Class.matchCTuple
- Currently just go up to 64; beyond that
you have to use manual nesting
- Their OccNames look like (%,,,%), so they can easily be
distinguished from term tuples. But (following Haskell) we
pretty-print saturated constraint tuples with round parens;
see BasicTypes.tupleParens.
- Unlike BoxedTuples and UnboxedTuples, which only wire
in type constructors and data constructors, ConstraintTuples also wire in
superclass selector functions. For instance, $p1(%,%) and $p2(%,%) are
the selectors for the binary constraint tuple.
* In quite a lot of places things are restricted just to
BoxedTuple/UnboxedTuple, and then we used BasicTypes.Boxity to distinguish
......@@ -788,7 +835,8 @@ isBuiltInOcc_maybe occ =
"~" -> Just eqTyConName
-- function tycon
"->" -> Just funTyConName
"FUN" -> Just funTyConName
"->" -> Just unrestrictedFunTyConName
-- boxed tuple data/tycon
-- We deliberately exclude Solo (the boxed 1-tuple).
......@@ -867,26 +915,26 @@ mkConstraintTupleStr ar = "(%" ++ commas ar ++ "%)"
commas :: Arity -> String
commas ar = take (ar-1) (repeat ',')
cTupleTyCon :: Arity -> TyCon
cTupleTyCon i
| i > mAX_CTUPLE_SIZE = fstOf3 (mk_ctuple i) -- Build one specially
| otherwise = fstOf3 (cTupleArr ! i)
cTupleTyConName :: Arity -> Name
cTupleTyConName arity
= mkExternalName (mkCTupleTyConUnique arity) gHC_CLASSES
(mkCTupleOcc tcName arity) noSrcSpan
cTupleTyConName a = tyConName (cTupleTyCon a)
cTupleTyConNames :: [Name]
cTupleTyConNames = map cTupleTyConName (0 : [2..mAX_CTUPLE_SIZE])
cTupleTyConNameSet :: NameSet
cTupleTyConNameSet = mkNameSet cTupleTyConNames
cTupleTyConKeys :: UniqSet Unique
cTupleTyConKeys = mkUniqSet $ map getUnique cTupleTyConNames
isCTupleTyConName :: Name -> Bool
-- Use Type.isCTupleClass where possible
isCTupleTyConName n
= ASSERT2( isExternalName n, ppr n )
nameModule n == gHC_CLASSES
&& n `elemNameSet` cTupleTyConNameSet
getUnique n `elementOfUniqSet` cTupleTyConKeys
-- | If the given name is that of a constraint tuple, return its arity.
-- Note that this is inefficient.
cTupleTyConNameArity_maybe :: Name -> Maybe Arity
cTupleTyConNameArity_maybe n
| not (isCTupleTyConName n) = Nothing
......@@ -896,14 +944,46 @@ cTupleTyConNameArity_maybe n
-- case, we have to adjust accordingly our calculated arity.
adjustArity a = if a > 0 then a + 1 else a
cTupleDataCon :: Arity -> DataCon
cTupleDataCon i
| i > mAX_CTUPLE_SIZE = sndOf3 (mk_ctuple i) -- Build one specially
| otherwise = sndOf3 (cTupleArr ! i)
cTupleDataConName :: Arity -> Name
cTupleDataConName arity
= mkExternalName (mkCTupleDataConUnique arity) gHC_CLASSES
(mkCTupleOcc dataName arity) noSrcSpan
cTupleDataConName i = dataConName (cTupleDataCon i)
cTupleDataConNames :: [Name]
cTupleDataConNames = map cTupleDataConName (0 : [2..mAX_CTUPLE_SIZE])
cTupleSelId :: ConTag -- Superclass position
-> Arity -- Arity
-> Id
cTupleSelId sc_pos arity
| sc_pos > arity
= panic ("cTupleSelId: index out of bounds: superclass position: "
++ show sc_pos ++ " > arity " ++ show arity)
| sc_pos <= 0
= panic ("cTupleSelId: Superclass positions start from 1. "
++ "(superclass position: " ++ show sc_pos
++ ", arity: " ++ show arity ++ ")")
| arity < 2
= panic ("cTupleSelId: Arity starts from 2. "
++ "(superclass position: " ++ show sc_pos
++ ", arity: " ++ show arity ++ ")")
| arity > mAX_CTUPLE_SIZE
= thdOf3 (mk_ctuple arity) ! (sc_pos - 1) -- Build one specially
| otherwise
= thdOf3 (cTupleArr ! arity) ! (sc_pos - 1)
cTupleSelIdName :: ConTag -- Superclass position
-> Arity -- Arity
-> Name
cTupleSelIdName sc_pos arity = idName (cTupleSelId sc_pos arity)
tupleTyCon :: Boxity -> Arity -> TyCon
tupleTyCon sort i | i > mAX_TUPLE_SIZE = fst (mk_tuple sort i) -- Build one specially
tupleTyCon Boxed i = fst (boxedTupleArr ! i)
......@@ -929,6 +1009,20 @@ boxedTupleArr, unboxedTupleArr :: Array Int (TyCon,DataCon)
boxedTupleArr = listArray (0,mAX_TUPLE_SIZE) [mk_tuple Boxed i | i <- [0..mAX_TUPLE_SIZE]]
unboxedTupleArr = listArray (0,mAX_TUPLE_SIZE) [mk_tuple Unboxed i | i <- [0..mAX_TUPLE_SIZE]]
-- | Cached type constructors, data constructors, and superclass selectors for
-- constraint tuples. The outer array is indexed by the arity of the constraint
-- tuple and the inner array is indexed by the superclass position.
cTupleArr :: Array Int (TyCon, DataCon, Array Int Id)
cTupleArr = listArray (0,mAX_CTUPLE_SIZE) [mk_ctuple i | i <- [0..mAX_CTUPLE_SIZE]]
-- Although GHC does not make use of unary constraint tuples
-- (see Note [Ignore unary constraint tuples] in GHC.Tc.Gen.HsType),
-- this array creates one anyway. This is primarily motivated by the fact
-- that (1) the indices of an Array must be contiguous, and (2) we would like
-- the index of a constraint tuple in this Array to correspond to its Arity.
-- We could envision skipping over the unary constraint tuple and having index
-- 1 correspond to a 2-constraint tuple (and so on), but that's more
-- complicated than it's worth.
-- | Given the TupleRep/SumRep tycon and list of RuntimeReps of the unboxed
-- tuple/sum arguments, produces the return kind of an unboxed tuple/sum type
-- constructor. @unboxedTupleSumKind [IntRep, LiftedRep] --> TYPE (TupleRep/SumRep
......@@ -993,6 +1087,45 @@ mk_tuple Unboxed arity = (tycon, tuple_con)
tc_uniq = mkTupleTyConUnique boxity arity
dc_uniq = mkTupleDataConUnique boxity arity
mk_ctuple :: Arity -> (TyCon, DataCon, Array ConTagZ Id)
mk_ctuple arity = (tycon, tuple_con, sc_sel_ids_arr)
where
tycon = mkClassTyCon tc_name binders roles
rhs klass
(mkPrelTyConRepName tc_name)
klass = mk_ctuple_class tycon sc_theta sc_sel_ids
tuple_con = pcDataConW dc_name tvs (map unrestricted sc_theta) tycon
binders = mkTemplateAnonTyConBinders (replicate arity constraintKind)
roles = replicate arity Nominal
rhs = TupleTyCon{data_con = tuple_con, tup_sort = ConstraintTuple}
modu = gHC_CLASSES
tc_name = mkWiredInName modu (mkCTupleOcc tcName arity) tc_uniq
(ATyCon tycon) BuiltInSyntax
dc_name = mkWiredInName modu (mkCTupleOcc dataName arity) dc_uniq
(AConLike (RealDataCon tuple_con)) BuiltInSyntax
tc_uniq = mkCTupleTyConUnique arity
dc_uniq = mkCTupleDataConUnique arity
tvs = binderVars binders
sc_theta = map mkTyVarTy tvs
sc_sel_ids = [mk_sc_sel_id sc_pos | sc_pos <- [0..arity-1]]
sc_sel_ids_arr = listArray (0,arity-1) sc_sel_ids
mk_sc_sel_id sc_pos =
let sc_sel_id_uniq = mkCTupleSelIdUnique sc_pos arity
sc_sel_id_occ = mkCTupleOcc tcName arity
sc_sel_id_name = mkWiredInIdName
gHC_CLASSES
(occNameFS (mkSuperDictSelOcc sc_pos sc_sel_id_occ))
sc_sel_id_uniq
sc_sel_id
sc_sel_id = mkDictSelId sc_sel_id_name klass
in sc_sel_id
unitTyCon :: TyCon
unitTyCon = tupleTyCon Boxed 0
......@@ -1008,6 +1141,9 @@ unitDataConId = dataConWorkId unitDataCon
pairTyCon :: TyCon
pairTyCon = tupleTyCon Boxed 2
unboxedUnitTy :: Type
unboxedUnitTy = mkTyConApp unboxedUnitTyCon []
unboxedUnitTyCon :: TyCon
unboxedUnitTyCon = tupleTyCon Unboxed 0
......@@ -1146,7 +1282,7 @@ eqSCSelId, heqSCSelId, coercibleSCSelId :: Id
rhs klass
(mkPrelTyConRepName eqTyConName)
klass = mk_class tycon sc_pred sc_sel_id
datacon = pcDataCon eqDataConName tvs [sc_pred] tycon
datacon = pcDataConW eqDataConName tvs [unrestricted sc_pred] tycon
-- Kind: forall k. k -> k -> Constraint
binders = mkTemplateTyConBinders [liftedTypeKind] (\[k] -> [k,k])
......@@ -1164,7 +1300,7 @@ eqSCSelId, heqSCSelId, coercibleSCSelId :: Id
rhs klass
(mkPrelTyConRepName heqTyConName)
klass = mk_class tycon sc_pred sc_sel_id
datacon = pcDataCon heqDataConName tvs [sc_pred] tycon
datacon = pcDataConW heqDataConName tvs [unrestricted sc_pred] tycon
-- Kind: forall k1 k2. k1 -> k2 -> Constraint
binders = mkTemplateTyConBinders [liftedTypeKind, liftedTypeKind] id
......@@ -1182,7 +1318,7 @@ eqSCSelId, heqSCSelId, coercibleSCSelId :: Id
rhs klass
(mkPrelTyConRepName coercibleTyConName)
klass = mk_class tycon sc_pred sc_sel_id
datacon = pcDataCon coercibleDataConName tvs [sc_pred] tycon
datacon = pcDataConW coercibleDataConName tvs [unrestricted sc_pred] tycon
-- Kind: forall k. k -> k -> Constraint
binders = mkTemplateTyConBinders [liftedTypeKind] (\[k] -> [k,k])
......@@ -1198,7 +1334,71 @@ mk_class tycon sc_pred sc_sel_id
= mkClass (tyConName tycon) (tyConTyVars tycon) [] [sc_pred] [sc_sel_id]
[] [] (mkAnd []) tycon
mk_ctuple_class :: TyCon -> ThetaType -> [Id] -> Class
mk_ctuple_class tycon sc_theta sc_sel_ids
= mkClass (tyConName tycon) (tyConTyVars tycon) [] sc_theta sc_sel_ids
[] [] (mkAnd []) tycon
{- *********************************************************************
* *
Multiplicity Polymorphism
* *
********************************************************************* -}
{- Multiplicity polymorphism is implemented very similarly to levity
polymorphism. We write in the multiplicity kind and the One and Many
types which can appear in user programs. These are defined properly in GHC.Types.
data Multiplicity = One | Many
-}
multiplicityTy :: Type
multiplicityTy = mkTyConTy multiplicityTyCon
multiplicityTyCon :: TyCon
multiplicityTyCon = pcTyCon multiplicityTyConName Nothing []
[oneDataCon, manyDataCon]
oneDataCon, manyDataCon :: DataCon
oneDataCon = pcDataCon oneDataConName [] [] multiplicityTyCon
manyDataCon = pcDataCon manyDataConName [] [] multiplicityTyCon
oneDataConTy, manyDataConTy :: Type
oneDataConTy = mkTyConTy oneDataConTyCon
manyDataConTy = mkTyConTy manyDataConTyCon
oneDataConTyCon, manyDataConTyCon :: TyCon
oneDataConTyCon = promoteDataCon oneDataCon
manyDataConTyCon = promoteDataCon manyDataCon
multMulTyConName :: Name
multMulTyConName =
mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "MultMul") multMulTyConKey multMulTyCon
multMulTyCon :: TyCon
multMulTyCon = mkFamilyTyCon multMulTyConName binders multiplicityTy Nothing
(BuiltInSynFamTyCon trivialBuiltInFamily)
Nothing
NotInjective
where
binders = mkTemplateAnonTyConBinders [multiplicityTy, multiplicityTy]
unrestrictedFunTy :: Type
unrestrictedFunTy = functionWithMultiplicity manyDataConTy
unrestrictedFunTyCon :: TyCon
unrestrictedFunTyCon = buildSynTyCon unrestrictedFunTyConName [] arrowKind [] unrestrictedFunTy
where arrowKind = mkTyConKind binders liftedTypeKind
-- See also funTyCon
binders = [ Bndr runtimeRep1TyVar (NamedTCB Inferred)
, Bndr runtimeRep2TyVar (NamedTCB Inferred)
]
++ mkTemplateAnonTyConBinders [ tYPE runtimeRep1Ty
, tYPE runtimeRep2Ty
]
unrestrictedFunTyConName :: Name
unrestrictedFunTyConName = mkWiredInTyConName BuiltInSyntax gHC_TYPES (fsLit "->") unrestrictedFunTyConKey unrestrictedFunTyCon
{- *********************************************************************
* *
......@@ -1402,7 +1602,15 @@ charDataCon :: DataCon
charDataCon = pcDataCon charDataConName [] [charPrimTy] charTyCon
stringTy :: Type
stringTy = mkListTy charTy -- convenience only
stringTy = mkTyConApp stringTyCon []
stringTyCon :: TyCon
-- We have this wired-in so that Haskell literal strings
-- get type String (in hsLitType), which in turn influences
-- inferred types and error messages
stringTyCon = buildSynTyCon stringTyConName
[] liftedTypeKind []
(mkListTy charTy)
intTy :: Type
intTy = mkTyConTy intTyCon
......@@ -1565,7 +1773,7 @@ consDataCon :: DataCon
consDataCon = pcDataConWithFixity True {- Declared infix -}
consDataConName
alpha_tyvar [] alpha_tyvar
[alphaTy, mkTyConApp listTyCon alpha_ty] listTyCon
(map linear [alphaTy, mkTyConApp listTyCon alpha_ty]) listTyCon
-- Interesting: polymorphic recursion would help here.
-- We can't use (mkListTy alphaTy) in the defn of consDataCon, else mkListTy
-- gets the over-specific type (Type -> Type)
......@@ -1641,7 +1849,7 @@ mkTupleTy boxity tys = mkTupleTy1 boxity tys
-- | Make a tuple type. The list of types should /not/ include any
-- RuntimeRep specifications. Boxed 1-tuples are *not* flattened.
-- See Note [One-tuples] and Note [Don't flatten tuples from HsSyn]
-- in GHC.Core.Make
-- in "GHC.Core.Make"
mkTupleTy1 :: Boxity -> [Type] -> Type
mkTupleTy1 Boxed tys = mkTyConApp (tupleTyCon Boxed (length tys)) tys
mkTupleTy1 Unboxed tys = mkTyConApp (tupleTyCon Unboxed (length tys))
......@@ -1724,3 +1932,106 @@ extractPromotedList tys = go tys
| otherwise
= pprPanic "extractPromotedList" (ppr tys)
---------------------------------------
-- ghc-bignum
---------------------------------------
integerTyConName
, integerISDataConName
, integerIPDataConName
, integerINDataConName
:: Name
integerTyConName
= mkWiredInTyConName
UserSyntax
gHC_NUM_INTEGER
(fsLit "Integer")
integerTyConKey
integerTyCon
integerISDataConName
= mkWiredInDataConName
UserSyntax
gHC_NUM_INTEGER
(fsLit "IS")
integerISDataConKey
integerISDataCon
integerIPDataConName
= mkWiredInDataConName
UserSyntax
gHC_NUM_INTEGER
(fsLit "IP")
integerIPDataConKey
integerIPDataCon
integerINDataConName
= mkWiredInDataConName
UserSyntax
gHC_NUM_INTEGER
(fsLit "IN")
integerINDataConKey
integerINDataCon
integerTy :: Type
integerTy = mkTyConTy integerTyCon
integerTyCon :: TyCon
integerTyCon = pcTyCon integerTyConName Nothing []
[integerISDataCon, integerIPDataCon, integerINDataCon]
integerISDataCon :: DataCon
integerISDataCon = pcDataCon integerISDataConName [] [intPrimTy] integerTyCon
integerIPDataCon :: DataCon
integerIPDataCon = pcDataCon integerIPDataConName [] [byteArrayPrimTy] integerTyCon
integerINDataCon :: DataCon
integerINDataCon = pcDataCon integerINDataConName [] [byteArrayPrimTy] integerTyCon
naturalTyConName
, naturalNSDataConName
, naturalNBDataConName
:: Name
naturalTyConName
= mkWiredInTyConName
UserSyntax
gHC_NUM_NATURAL
(fsLit "Natural")
naturalTyConKey
naturalTyCon
naturalNSDataConName
= mkWiredInDataConName
UserSyntax
gHC_NUM_NATURAL
(fsLit "NS")
naturalNSDataConKey
naturalNSDataCon
naturalNBDataConName
= mkWiredInDataConName
UserSyntax
gHC_NUM_NATURAL
(fsLit "NB")
naturalNBDataConKey
naturalNBDataCon
naturalTy :: Type
naturalTy = mkTyConTy naturalTyCon
naturalTyCon :: TyCon
naturalTyCon = pcTyCon naturalTyConName Nothing []
[naturalNSDataCon, naturalNBDataCon]
naturalNSDataCon :: DataCon
naturalNSDataCon = pcDataCon naturalNSDataConName [] [wordPrimTy] naturalTyCon
naturalNBDataCon :: DataCon
naturalNBDataCon = pcDataCon naturalNBDataConName [] [byteArrayPrimTy] naturalTyCon
-- | Replaces constraint tuple names with corresponding boxed ones.
filterCTuple :: RdrName -> RdrName
filterCTuple (Exact n)
| Just arity <- cTupleTyConNameArity_maybe n
= Exact $ tupleTyConName BoxedTuple arity
filterCTuple rdr = rdr
......@@ -2,12 +2,13 @@ module GHC.Builtin.Types where
import {-# SOURCE #-} GHC.Core.TyCon ( TyCon )
import {-# SOURCE #-} GHC.Core.TyCo.Rep (Type, Kind)
import {-# SOURCE #-} GHC.Core.DataCon ( DataCon )
import GHC.Types.Basic (Arity, TupleSort)
import GHC.Types.Name (Name)
import GHC.Types.Basic (Arity, TupleSort, Boxity, ConTag)
import {-# SOURCE #-} GHC.Types.Name (Name)
listTyCon :: TyCon
typeNatKind, typeSymbolKind :: Type
typeSymbolKind :: Type
mkBoxedTupleTy :: [Type] -> Type
coercibleTyCon, heqTyCon :: TyCon
......@@ -44,4 +45,29 @@ anyTypeOfKind :: Kind -> Type
unboxedTupleKind :: [Type] -> Type
mkPromotedListTy :: Type -> [Type] -> Type
multiplicityTyCon :: TyCon
multiplicityTy :: Type
oneDataConTy :: Type
oneDataConTyCon :: TyCon
manyDataConTy :: Type
manyDataConTyCon :: TyCon
unrestrictedFunTyCon :: TyCon
multMulTyCon :: TyCon
tupleTyConName :: TupleSort -> Arity -> Name
integerTy, naturalTy :: Type
promotedTupleDataCon :: Boxity -> Arity -> TyCon
tupleDataCon :: Boxity -> Arity -> DataCon
tupleTyCon :: Boxity -> Arity -> TyCon
cTupleDataCon :: Arity -> DataCon
cTupleDataConName :: Arity -> Name
cTupleTyConName :: Arity -> Name
cTupleSelIdName :: ConTag -> Arity -> Name
sumDataCon :: ConTag -> Arity -> DataCon
sumTyCon :: Arity -> TyCon
......@@ -32,6 +32,7 @@ import GHC.Core.Coercion ( Role(..) )
import GHC.Tc.Types.Constraint ( Xi )
import GHC.Core.Coercion.Axiom ( CoAxiomRule(..), BuiltInSynFamily(..), TypeEqn )
import GHC.Types.Name ( Name, BuiltInSyntax(..) )
import GHC.Types.Unique.FM
import GHC.Builtin.Types
import GHC.Builtin.Types.Prim ( mkTemplateAnonTyConBinders )
import GHC.Builtin.Names
......@@ -50,7 +51,6 @@ import GHC.Builtin.Names
, typeSymbolAppendFamNameKey
)
import GHC.Data.FastString
import qualified Data.Map as Map
import Data.Maybe ( isJust )
import Control.Monad ( guard )
import Data.List ( isPrefixOf, isSuffixOf )
......@@ -236,7 +236,7 @@ typeNatLogTyCon = mkTypeNatFunTyCon1 name
typeNatLeqTyCon :: TyCon
typeNatLeqTyCon =
mkFamilyTyCon name
(mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
(mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
boolTy
Nothing
(BuiltInSynFamTyCon ops)
......@@ -255,7 +255,7 @@ typeNatLeqTyCon =
typeNatCmpTyCon :: TyCon
typeNatCmpTyCon =
mkFamilyTyCon name
(mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
(mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
orderingKind
Nothing
(BuiltInSynFamTyCon ops)
......@@ -301,14 +301,12 @@ typeSymbolAppendTyCon = mkTypeSymbolFunTyCon2 name
name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "AppendSymbol")
typeSymbolAppendFamNameKey typeSymbolAppendTyCon
-- Make a unary built-in constructor of kind: Nat -> Nat
mkTypeNatFunTyCon1 :: Name -> BuiltInSynFamily -> TyCon
mkTypeNatFunTyCon1 op tcb =
mkFamilyTyCon op
(mkTemplateAnonTyConBinders [ typeNatKind ])
typeNatKind
(mkTemplateAnonTyConBinders [ naturalTy ])
naturalTy
Nothing
(BuiltInSynFamTyCon tcb)
Nothing
......@@ -319,8 +317,8 @@ mkTypeNatFunTyCon1 op tcb =
mkTypeNatFunTyCon2 :: Name -> BuiltInSynFamily -> TyCon
mkTypeNatFunTyCon2 op tcb =
mkFamilyTyCon op
(mkTemplateAnonTyConBinders [ typeNatKind, typeNatKind ])
typeNatKind
(mkTemplateAnonTyConBinders [ naturalTy, naturalTy ])
naturalTy
Nothing
(BuiltInSynFamTyCon tcb)
Nothing
......@@ -401,7 +399,7 @@ axCmpSymbolDef =
s2' <- isStrLitTy s2
t2' <- isStrLitTy t2
return (mkTyConApp typeSymbolCmpTyCon [s1,t1] ===
ordering (compare s2' t2')) }
ordering (lexicalCompareFS s2' t2')) }
axAppendSymbolDef = CoAxiomRule
{ coaxrName = fsLit "AppendSymbolDef"
......@@ -457,8 +455,8 @@ axAppendSymbol0L = mkAxiom1 "Concat0L"
-- The list of built-in type family axioms that GHC uses.
-- If you define new axioms, make sure to include them in this list.
-- See Note [Adding built-in type families]
typeNatCoAxiomRules :: Map.Map FastString CoAxiomRule
typeNatCoAxiomRules = Map.fromList $ map (\x -> (coaxrName x, x))
typeNatCoAxiomRules :: UniqFM FastString CoAxiomRule
typeNatCoAxiomRules = listToUFM $ map (\x -> (coaxrName x, x))
[ axAddDef
, axMulDef
, axExpDef
......@@ -706,7 +704,7 @@ matchFamCmpNat _ = Nothing
matchFamCmpSymbol :: [Type] -> Maybe (CoAxiomRule, [Type], Type)
matchFamCmpSymbol [s,t]
| Just x <- mbX, Just y <- mbY =
Just (axCmpSymbolDef, [s,t], ordering (compare x y))
Just (axCmpSymbolDef, [s,t], ordering (lexicalCompareFS x y))
| tcEqType s t = Just (axCmpSymbolRefl, [s], ordering EQ)
where mbX = isStrLitTy s
mbY = isStrLitTy t
......