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 (2)
  • Matthew Craven's avatar
    Remove unused ghc-internal module "GHC.Internal.Constants" · da0d8ba5
    Matthew Craven authored and Marge Bot's avatar Marge Bot committed
    da0d8ba5
  • Matthew Craven's avatar
    CorePrep: Rework lowering of BigNat# literals · b56d2761
    Matthew Craven authored and Marge Bot's avatar Marge Bot committed
    Don't use bigNatFromWord#, because that's terrible:
     * We shouldn't have to traverse a linked list at run-time
       to build a BigNat# literal. That's just silly!
     * The static List object we have to create is much larger
       than the actual BigNat#'s contents, bloating code size.
     * We have to read the corresponding interface file,
       which causes un-tracked implicit dependencies. (#23942)
    
    Instead, encode them into the appropriate platform-dependent
    sequence of bytes, and generate code that copies these bytes
    at run-time from an Addr# literal into a new ByteArray#.
    A ByteArray# literal would be the correct thing to generate,
    but these are not yet supported; see also #17747.
    
    Somewhat surprisingly, this change results in a slight
    reduction in compiler allocations, averaging around 0.5%
    on ghc's compiler performance tests, including when compiling
    programs that contain no bignum literals to begin with.
    The specific cause of this has not been investigated.
    
    Since this lowering no longer reads the interface file for
    GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer]
    is obsoleted.  But the story of un-tracked built-in dependencies
    remains complex, and Note [Tracking dependencies on primitives]
    now exists to explain this complexity.
    
    Additionally, many empty imports have been modified to refer to
    this new note and comply with its guidance.  Several empty imports
    necessary for other reasons have also been given brief explanations.
    
    Metric Decrease:
        MultiLayerModulesTH_OneShot
    b56d2761
Showing
with 158 additions and 100 deletions
......@@ -430,7 +430,6 @@ basicKnownKeyNames
naturalPowModName,
naturalSizeInBaseName,
bignatFromWordListName,
bignatEqName,
-- Float/Double
......@@ -1203,7 +1202,6 @@ integerFromNaturalName
, naturalLogBaseName
, naturalPowModName
, naturalSizeInBaseName
, bignatFromWordListName
, bignatEqName
, bignatCompareName
, bignatCompareWordName
......@@ -1215,7 +1213,6 @@ bnnVarQual str key = varQual gHC_INTERNAL_NUM_NATURAL (fsLit str) key
bniVarQual str key = varQual gHC_INTERNAL_NUM_INTEGER (fsLit str) key
-- Types and DataCons
bignatFromWordListName = bnbVarQual "bigNatFromWordList#" bignatFromWordListIdKey
bignatEqName = bnbVarQual "bigNatEq#" bignatEqIdKey
bignatCompareName = bnbVarQual "bigNatCompare" bignatCompareIdKey
bignatCompareWordName = bnbVarQual "bigNatCompareWord#" bignatCompareWordIdKey
......@@ -2641,7 +2638,6 @@ integerFromNaturalIdKey
, naturalLogBaseIdKey
, naturalPowModIdKey
, naturalSizeInBaseIdKey
, bignatFromWordListIdKey
, bignatEqIdKey
, bignatCompareIdKey
, bignatCompareWordIdKey
......@@ -2709,7 +2705,6 @@ naturalLogBaseIdKey = mkPreludeMiscIdUnique 682
naturalPowModIdKey = mkPreludeMiscIdUnique 683
naturalSizeInBaseIdKey = mkPreludeMiscIdUnique 684
bignatFromWordListIdKey = mkPreludeMiscIdUnique 690
bignatEqIdKey = mkPreludeMiscIdUnique 691
bignatCompareIdKey = mkPreludeMiscIdUnique 692
bignatCompareWordIdKey = mkPreludeMiscIdUnique 693
......
module GHC.Builtin.PrimOps where
import GHC.Prelude ()
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Base ()
data PrimOp
......@@ -63,7 +63,8 @@ module GHC.Builtin.Types.Prim(
doublePrimTyCon, doublePrimTy, doublePrimTyConName,
statePrimTyCon, mkStatePrimTy,
realWorldTyCon, realWorldTy, realWorldStatePrimTy,
realWorldTyCon, realWorldTy,
realWorldStatePrimTy, realWorldMutableByteArrayPrimTy,
proxyPrimTyCon, mkProxyPrimTy,
......@@ -1178,7 +1179,9 @@ realWorldTy :: Type
realWorldTy = mkTyConTy realWorldTyCon
realWorldStatePrimTy :: Type
realWorldStatePrimTy = mkStatePrimTy realWorldTy -- State# RealWorld
realWorldMutableByteArrayPrimTy :: Type
realWorldMutableByteArrayPrimTy
= mkMutableByteArrayPrimTy realWorldTy -- MutableByteArray# RealWorld
mkProxyPrimTy :: Type -> Type -> Type
mkProxyPrimTy k ty = TyConApp proxyPrimTyCon [k, ty]
......
......@@ -23,7 +23,6 @@ where
import GHC.Prelude
import Data.Array.IArray
import Data.Foldable()
import qualified Data.Tree as Tree
import Data.Word
......
......@@ -62,7 +62,7 @@ import {-# SOURCE #-} GHC.Core.Coercion
, mkCoercionType
, coercionKind, coercionLKind, coVarKindsTypesRole )
import {-# SOURCE #-} GHC.Core.TyCo.Ppr ( pprTyVar )
import {-# SOURCE #-} GHC.Core.Ppr ( )
import {-# SOURCE #-} GHC.Core.Ppr ( ) -- instance Outputable CoreExpr
import {-# SOURCE #-} GHC.Core ( CoreExpr )
import GHC.Core.TyCo.Rep
......
......@@ -14,7 +14,6 @@ module GHC.CoreToStg.Prep
, CorePrepPgmConfig (..)
, corePrepPgm
, corePrepExpr
, mkConvertNumLiteral
)
where
......@@ -24,11 +23,13 @@ import GHC.Platform
import GHC.Driver.Flags
import GHC.Tc.Utils.Env
import GHC.Unit
import GHC.Builtin.Names
import GHC.Builtin.PrimOps
import GHC.Builtin.PrimOps.Ids
import GHC.Builtin.Types
import GHC.Builtin.Types.Prim
import GHC.Core.Utils
import GHC.Core.Opt.Arity
......@@ -60,14 +61,16 @@ import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Types.Id.Make ( realWorldPrimId )
import GHC.Types.Basic
import GHC.Types.Name ( Name, NamedThing(..), nameSrcSpan, isInternalName )
import GHC.Types.Name ( NamedThing(..), nameSrcSpan, isInternalName )
import GHC.Types.SrcLoc ( SrcSpan(..), realSrcLocSpan, mkRealSrcLoc )
import GHC.Types.Literal
import GHC.Types.Tickish
import GHC.Types.TyThing
import GHC.Types.Unique.Supply
import Data.List ( unfoldr )
import qualified Data.ByteString as BS
import qualified Data.ByteString.Builder as BB
import Data.ByteString.Builder.Prim
import Control.Monad
{-
......@@ -764,11 +767,10 @@ cpeRhsE _ (Type ty)
= return (emptyFloats, Type ty)
cpeRhsE _ (Coercion co)
= return (emptyFloats, Coercion co)
cpeRhsE env expr@(Lit (LitNumber nt i))
= case cp_convertNumLit (cpe_config env) nt i of
Nothing -> return (emptyFloats, expr)
Just e -> cpeRhsE env e
cpeRhsE _env expr@(Lit {}) = return (emptyFloats, expr)
cpeRhsE env expr@(Lit lit)
| LitNumber LitNumBigNat i <- lit
= cpeBigNatLit env i
| otherwise = return (emptyFloats, expr)
cpeRhsE env expr@(Var {}) = cpeApp env expr
cpeRhsE env expr@(App {}) = cpeApp env expr
......@@ -2240,9 +2242,7 @@ data CorePrepConfig = CorePrepConfig
-- cases. This is helpful when debugging demand analysis or type
-- checker bugs which can sometimes manifest as segmentation faults.
, cp_convertNumLit :: !(LitNumType -> Integer -> Maybe CoreExpr)
-- ^ Convert some numeric literals (Integer, Natural) into their final
-- Core form.
, cp_platform :: Platform
, cp_arityOpts :: !(Maybe ArityOpts)
-- ^ Configuration for arity analysis ('exprEtaExpandArity').
......@@ -2442,57 +2442,119 @@ wrapTicks floats expr
-- Numeric literals
-- ---------------------------------------------------------------------------
-- | Create a function that converts Bignum literals into their final CoreExpr
mkConvertNumLiteral
:: Platform
-> HomeUnit
-> (Name -> IO TyThing)
-> IO (LitNumType -> Integer -> Maybe CoreExpr)
mkConvertNumLiteral platform home_unit lookup_global = do
let
guardBignum act
| isHomeUnitInstanceOf home_unit primUnitId
= return $ panic "Bignum literals are not supported in ghc-prim"
| isHomeUnitInstanceOf home_unit bignumUnitId
= return $ panic "Bignum literals are not supported in ghc-bignum"
| otherwise = act
lookupBignumId n = guardBignum (tyThingId <$> lookup_global n)
-- The lookup is done here but the failure (panic) is reported lazily when we
-- try to access the `bigNatFromWordList` function.
--
-- If we ever get built-in ByteArray# literals, we could avoid the lookup by
-- directly using the Integer/Natural wired-in constructors for big numbers.
bignatFromWordListId <- lookupBignumId bignatFromWordListName
let
convertNumLit nt i = case nt of
LitNumBigNat -> Just (convertBignatPrim i)
_ -> Nothing
convertBignatPrim i =
let
-- ByteArray# literals aren't supported (yet). Were they supported,
-- we would use them directly. We would need to handle
-- wordSize/endianness conversion between host and target
-- wordSize = platformWordSize platform
-- byteOrder = platformByteOrder platform
-- For now we build a list of Words and we produce
-- `bigNatFromWordList# list_of_words`
words = mkListExpr wordTy (reverse (unfoldr f i))
where
f 0 = Nothing
f x = let low = x .&. mask
high = x `shiftR` bits
in Just (mkConApp wordDataCon [Lit (mkLitWord platform low)], high)
bits = platformWordSizeInBits platform
mask = 2 ^ bits - 1
in mkApps (Var bignatFromWordListId) [words]
return convertNumLit
-- | Converts Bignum literals into their final CoreExpr
cpeBigNatLit
:: CorePrepEnv -> Integer -> UniqSM (Floats, CpeRhs)
cpeBigNatLit env i = assert (i >= 0) $ do
let
platform = cp_platform (cpe_config env)
-- Per the documentation in GHC.Num.BigNat, a BigNat# is:
-- "Represented as an array of limbs (Word#) stored in
-- little-endian order (Word# themselves use machine order)."
--
-- "Invariant (canonical representation): higher Word# is non-zero."
-- So we need to break up the integer into target-word-sized chunks,
-- and encode each of them using the target's byte-order.
encodeBigNat
:: forall a. Num a => FixedPrim a -> BS.ByteString
encodeBigNat encodeWord
= BS.toStrict (BB.toLazyByteString (primUnfoldrFixed encodeWord f i))
-- (quadratic complexity due to repeated shifts... ok for now)
where
f 0 = Nothing
f x = let low = fromInteger x :: a
high = x `shiftR` bits
in Just (low, high)
bits = platformWordSizeInBits platform
words :: BS.ByteString
words = case (platformWordSize platform, platformByteOrder platform) of
(PW4, LittleEndian) -> encodeBigNat word32LE
(PW4, BigEndian ) -> encodeBigNat word32BE
(PW8, LittleEndian) -> encodeBigNat word64LE
(PW8, BigEndian ) -> encodeBigNat word64BE
-- Ideally we would just generate a ByteArray# literal here:
-- pure (emptyFloats, Lit (LitByteArray words))
-- But sadly we don't have those yet, even in Core. (See also #17747.)
-- So instead we generate:
-- * An `Addr#` literal that contains the contents of the
-- `ByteArray#` we want to create. This gets its own float.
-- * A call to `newByteArray#` with the appropriate size
-- * A call to `copyAddrToByteArray#` to initialize the `ByteArray#`
-- * A call to `unsafeFreezeByteArray#` to make the types match
litAddrId <- mkSysLocalM (fsLit "bigNatGuts") ManyTy addrPrimTy
-- returned from newByteArray#:
deadNewByteArrayTupleId
<- fmap (`setIdOccInfo` IAmDead) . mkSysLocalM (fsLit "tup") ManyTy $
mkTupleTy Unboxed [ realWorldStatePrimTy
, realWorldMutableByteArrayPrimTy
]
stateTokenFromNewByteArrayId
<- mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy
mutableByteArrayId
<- mkSysLocalM (fsLit "mba") ManyTy realWorldMutableByteArrayPrimTy
-- returned from copyAddrToByteArray#:
stateTokenFromCopyId
<- mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy
-- returned from unsafeFreezeByteArray#:
deadFreezeTupleId
<- fmap (`setIdOccInfo` IAmDead) . mkSysLocalM (fsLit "tup") ManyTy $
mkTupleTy Unboxed [realWorldStatePrimTy, byteArrayPrimTy]
stateTokenFromFreezeId
<- (`setIdOccInfo` IAmDead) <$>
mkSysLocalM (fsLit "token") ManyTy realWorldStatePrimTy
byteArrayId <- mkSysLocalM (fsLit "ba") ManyTy byteArrayPrimTy
let
litAddrRhs = Lit (LitString words)
-- not "mkLitString"; that does UTF-8 encoding, which we don't want here
litAddrFloat = mkNonRecFloat env topDmd True litAddrId litAddrRhs
contentsLength = mkIntLit platform (toInteger (BS.length words))
newByteArrayCall =
Var (primOpId NewByteArrayOp_Char)
`App` Type realWorldTy
`App` contentsLength
`App` Var realWorldPrimId
copyContentsCall =
Var (primOpId CopyAddrToByteArrayOp)
`App` Type realWorldTy
`App` Var litAddrId
`App` Var mutableByteArrayId
`App` mkIntLit platform 0
`App` contentsLength
`App` Var stateTokenFromNewByteArrayId
unsafeFreezeCall =
Var (primOpId UnsafeFreezeByteArrayOp)
`App` Type realWorldTy
`App` Var mutableByteArrayId
`App` Var stateTokenFromCopyId
unboxed2tuple_altcon :: AltCon
unboxed2tuple_altcon = DataAlt (tupleDataCon Unboxed 2)
finalRhs =
Case newByteArrayCall deadNewByteArrayTupleId byteArrayPrimTy
[ Alt unboxed2tuple_altcon
[stateTokenFromNewByteArrayId, mutableByteArrayId]
copyContentsCase
]
copyContentsCase =
Case copyContentsCall stateTokenFromCopyId byteArrayPrimTy
[ Alt DEFAULT [] unsafeFreezeCase
]
unsafeFreezeCase =
Case unsafeFreezeCall deadFreezeTupleId byteArrayPrimTy
[ Alt unboxed2tuple_altcon
[stateTokenFromFreezeId, byteArrayId]
(Var byteArrayId)
]
pure (emptyFloats `snocFloat` litAddrFloat, finalRhs)
......@@ -248,4 +248,3 @@ module GHC.Data.Word64Map.Strict (
) where
import GHC.Data.Word64Map.Strict.Internal
import Prelude ()
......@@ -31,7 +31,7 @@ import GHC.Types.SrcLoc
import GHC.Types.Error
import GHC.Utils.Error
import GHC.Driver.Errors.Types
import GHC.Driver.Errors.Ppr ()
import GHC.Driver.Errors.Ppr () -- instance Diagnostic DriverMessage
import GHC.Utils.Outputable (text)
import Data.Function
......
......@@ -10,7 +10,6 @@ import GHC.Driver.Env
import GHC.Driver.Session
import GHC.Driver.Config.Core.Lint
import GHC.Driver.Config.Core.Opt.Arity
import GHC.Tc.Utils.Env
import GHC.Types.Var
import GHC.Utils.Outputable ( alwaysQualify )
......@@ -19,14 +18,9 @@ import GHC.CoreToStg.Prep
initCorePrepConfig :: HscEnv -> IO CorePrepConfig
initCorePrepConfig hsc_env = do
let dflags = hsc_dflags hsc_env
convertNumLit <- do
let platform = targetPlatform dflags
home_unit = hsc_home_unit hsc_env
lookup_global = lookupGlobal hsc_env
mkConvertNumLiteral platform home_unit lookup_global
return $ CorePrepConfig
{ cp_catchNonexhaustiveCases = gopt Opt_CatchNonexhaustiveCases dflags
, cp_convertNumLit = convertNumLit
, cp_platform = targetPlatform dflags
, cp_arityOpts = if gopt Opt_DoCleverArgEtaExpansion dflags
then Just (initArityOpts dflags)
else Nothing
......
......@@ -19,7 +19,7 @@ import GHC.Prelude
import GHC.Utils.Outputable
import GHC.Utils.Error (DiagOpts (..))
import GHC.Driver.Errors.Types (GhcMessage, GhcMessageOpts (..), PsMessage, DriverMessage, DriverMessageOpts (..), checkBuildingCabalPackage)
import GHC.Driver.Errors.Ppr ()
import GHC.Driver.Errors.Ppr () -- Diagnostic instances
import GHC.Tc.Errors.Types
import GHC.HsToCore.Errors.Types
import GHC.Types.Error
......
......@@ -14,8 +14,8 @@ import GHC.Prelude
import GHC.Driver.Errors.Types
import GHC.Driver.Flags
import GHC.Driver.DynFlags
import GHC.HsToCore.Errors.Ppr ()
import GHC.Parser.Errors.Ppr ()
import GHC.HsToCore.Errors.Ppr () -- instance Diagnostic DsMessage
import GHC.Parser.Errors.Ppr () -- instance Diagnostic PsMessage
import GHC.Types.Error
import GHC.Types.Error.Codes
import GHC.Unit.Types
......@@ -30,8 +30,8 @@ import Language.Haskell.Syntax.Decls (RuleDecl(..))
import GHC.Tc.Errors.Types (TcRnMessage)
import GHC.HsToCore.Errors.Types (DsMessage)
import GHC.Iface.Errors.Types
import GHC.Tc.Errors.Ppr ()
import GHC.Iface.Errors.Ppr ()
import GHC.Tc.Errors.Ppr () -- instance Diagnostic TcRnMessage
import GHC.Iface.Errors.Ppr () -- instance Diagnostic IfaceMessage
--
-- Suggestions
......
......@@ -7,7 +7,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance Diagnostic TcRnMessage
{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance Diagnostic IfaceMessage
{-# LANGUAGE InstanceSigs #-}
module GHC.Iface.Errors.Ppr
......
......@@ -85,7 +85,7 @@ import GHC.Hs.Doc ( WithHsDocIdentifiers(..) )
import GHC.Utils.Lexeme (isLexSym)
import GHC.Utils.Fingerprint
import GHC.Utils.Binary
import GHC.Utils.Binary.Typeable ()
import GHC.Utils.Binary.Typeable () -- instance Binary AnnPayload
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith,
......
......@@ -6,7 +6,7 @@ module GHC.Iface.Type
where
-- Empty import to influence the compilation ordering.
-- See Note [Depend on GHC.Num.Integer] in GHC.Base
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Base ()
data IfaceAppArgs
......
......@@ -139,7 +139,6 @@ import GHC.Types.SourceText
import GHC.Parser.Types
import GHC.Parser.Lexer
import GHC.Parser.Errors.Types
import GHC.Parser.Errors.Ppr ()
import GHC.Utils.Lexeme ( okConOcc )
import GHC.Types.TyThing
import GHC.Core.Type ( Specificity(..) )
......
......@@ -79,7 +79,7 @@ data Platform = Platform
, platformTablesNextToCode :: !Bool
-- ^ Determines whether we will be compiling info tables that reside just
-- before the entry code, or with an indirection to the entry code. See
-- TABLES_NEXT_TO_CODE in rts/include/rts/storage/InfoTables.h.
-- TABLES_NEXT_TO_CODE in @rts/include/rts/storage/InfoTables.h@.
, platformHasLibm :: !Bool
-- ^ Some platforms require that we explicitly link against @libm@ if any
-- math-y things are used (which we assume to include all programs). See
......
......@@ -26,7 +26,7 @@ import GHC.JS.JStg.Syntax
import GHC.JS.Ident
import qualified GHC.JS.Syntax as Sat
import GHC.JS.Make
import GHC.JS.Ppr ()
import GHC.JS.Ppr () -- expose Outputable instances to downstream modules
import GHC.Stg.Syntax
import GHC.Core.TyCon
......
module GHC.Tc.Errors.Hole.Plugin where
data HoleFitPlugin
\ No newline at end of file
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Base ()
data HoleFitPlugin
module GHC.Tc.Types.LclEnv where
data TcLclEnv
\ No newline at end of file
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Base ()
data TcLclEnv
......@@ -888,7 +888,7 @@ tcGetDefaultTys
{-
Note [Extended defaults]
~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
In interactive mode (or with -XExtendedDefaultRules) we add () as the first type we
try when defaulting. This has very little real impact, except in the following case.
Consider:
......