...
 
Commits (57)
  • Ömer Sinan Ağacan's avatar
    Don't override proc CafInfos in ticky builds · dcfe29c8
    Ömer Sinan Ağacan authored
    Fixes #17947
    
    When we have a ticky label for a proc, IdLabels for the ticky counter
    and proc entry share the same Name. This caused overriding proc CafInfos
    with the ticky CafInfos (i.e. NoCafRefs) during SRT analysis.
    
    We now ignore the ticky labels when building SRTMaps. This makes sense
    because:
    
    - When building the current module they don't need to be in SRTMaps as
      they're initialized as non-CAFFY (see mkRednCountsLabel), so they
      don't take part in the dependency analysis and they're never added to
      SRTs.
    
      (Reminder: a "dependency" in the SRT analysis is a CAFFY dependency,
      non-CAFFY uses are not considered as dependencies for the algorithm)
    
    - They don't appear in the interfaces as they're not exported, so it
      doesn't matter for cross-module concerns whether they're in the SRTMap
      or not.
    
    See also the new Note [Ticky labels in SRT analysis].
    dcfe29c8
  • Simon Peyton Jones's avatar
    Fix an tricky specialiser loop · cec2c71f
    Simon Peyton Jones authored
    Issue #17151 was a very tricky example of a bug in which the
    specialiser accidentally constructs a recurive dictionary,
    so that everything turns into bottom.
    
    I have fixed variants of this bug at least twice before:
    see Note [Avoiding loops].  It was a bit of a struggle
    to isolate the problem, greatly aided by the work that
    Alexey Kuleshevich did in distilling a test case.
    
    Once I'd understood the problem, it was not difficult to fix,
    though it did lead me a bit of refactoring in specImports.
    cec2c71f
  • Simon Peyton Jones's avatar
    Refactoring only · e850d14f
    Simon Peyton Jones authored
    This refactors DictBinds into a data type rather than a pair.
    No change in behaviour, just better code
    e850d14f
  • Daniel Gröber (dxld)'s avatar
    rts: ProfHeap: Fix memory leak when not compiled with profiling · f38e8d61
    Daniel Gröber (dxld) authored
    If we're doing heap profiling on an unprofiled executable we keep
    allocating new space in initEra via nextEra on each profiler run but we
    don't have a corresponding freeEra call.
    
    We do free the last era in endHeapProfiling but previous eras will have
    been overwritten by initEra and will never get free()ed.
    
    Metric Decrease:
        space_leak_001
    f38e8d61
  • Sebastian Graf's avatar
    Re-export GHC.Magic.noinline from base · bcd66859
    Sebastian Graf authored
    bcd66859
  • Ben Gamari's avatar
    simplifier: Kill off ufKeenessFactor · 3d2991f8
    Ben Gamari authored
    We used to have another factor, ufKeenessFactor, which would scale the
    discounts before they were subtracted from the size. This was justified
    with the following comment:
    
      -- We multiple the raw discounts (args_discount and result_discount)
      -- ty opt_UnfoldingKeenessFactor because the former have to do with
      --  *size* whereas the discounts imply that there's some extra
      --  *efficiency* to be gained (e.g. beta reductions, case reductions)
      -- by inlining.
    
    However, this is highly suspect since it means that we subtract a
    *scaled* size from an absolute size, resulting in crazy (e.g. negative)
    scores in some cases (#15304). We consequently killed off
    ufKeenessFactor and bumped up the ufUseThreshold to compensate.
    
    Adjustment of unfolding use threshold
    =====================================
    
    Since this removes a discount from our inlining heuristic, I revisited our
    default choice of -funfolding-use-threshold to minimize the change in
    overall inlining behavior. Specifically, I measured runtime allocations
    and executable size of nofib and the testsuite performance tests built
    using compilers (and core libraries) built with several values of
    -funfolding-use-threshold.
    
    This comes as a result of a quantitative comparison of testsuite
    performance and code size as a function of ufUseThreshold, comparing
    GHC trees using values of 50, 60, 70, 80, 90, and 100. The test set
    consisted of nofib and the testsuite performance tests.
    A full summary of these measurements are found in the description of
    !2608
    
    Comparing executable sizes (relative to the base commit) across all
    nofib tests, we see that sizes are similar to the baseline:
    
                gmean      min      max   median
    thresh
    50         -6.36%   -7.04%   -4.82%   -6.46%
    60         -5.04%   -5.97%   -3.83%   -5.11%
    70         -2.90%   -3.84%   -2.31%   -2.92%
    80         -0.75%   -2.16%   -0.42%   -0.73%
    90         +0.24%   -0.41%   +0.55%   +0.26%
    100        +1.36%   +0.80%   +1.64%   +1.37%
    baseline   +0.00%   +0.00%   +0.00%   +0.00%
    
    Likewise, looking at runtime allocations we see that 80 gives slightly
    better optimisation than the baseline:
    
                gmean      min      max   median
    thresh
    50         +0.16%   -0.16%   +4.43%   +0.00%
    60         +0.09%   -0.00%   +3.10%   +0.00%
    70         +0.04%   -0.09%   +2.29%   +0.00%
    80         +0.02%   -1.17%   +2.29%   +0.00%
    90         -0.02%   -2.59%   +1.86%   +0.00%
    100        +0.00%   -2.59%   +7.51%   -0.00%
    baseline   +0.00%   +0.00%   +0.00%   +0.00%
    
    Finally, I had to add a NOINLINE in T4306 to ensure that `upd` is
    worker-wrappered as the test expects. This makes me wonder whether the
    inlining heuristic is now too liberal as `upd` is quite a large
    function. The same measure was taken in T12600.
    
                 Wall clock time compiling Cabal with -O0
    thresh       50     60     70     80     90      100    baseline
    build-Cabal  93.88  89.58  92.59  90.09  100.26  94.81  89.13
    
    Also, this change happens to avoid the spurious test output in
    `plugin-recomp-change` and `plugin-recomp-change-prof` (see #17308).
    
    Metric Decrease:
        hie002
        T12234
        T13035
        T13719
        T14683
        T4801
        T5631
        T5642
        T9020
        T9872d
        T9961
    Metric Increase:
        T12150
        T12425
        T13701
        T14697
        T15426
        T1969
        T3064
        T5837
        T6048
        T9203
        T9872a
        T9872b
        T9872c
        T9872d
        haddock.Cabal
        haddock.base
        haddock.compiler
    3d2991f8
  • Sylvain Henry's avatar
    Modules: type-checker (#13009) · 255418da
    Sylvain Henry authored
    Update Haddock submodule
    255418da
  • Ryan Scott's avatar
    Make NoExtCon fields strict · 04b6cf94
    Ryan Scott authored
    This changes every unused TTG extension constructor to be strict in
    its field so that the pattern-match coverage checker is smart enough
    any such constructors are unreachable in pattern matches. This lets
    us remove nearly every use of `noExtCon` in the GHC API. The only
    ones we cannot remove are ones underneath uses of `ghcPass`, but that
    is only because GHC 8.8's and 8.10's coverage checkers weren't smart
    enough to perform this kind of reasoning. GHC HEAD's coverage
    checker, on the other hand, _is_ smart enough, so we guard these uses
    of `noExtCon` with CPP for now.
    
    Bumps the `haddock` submodule.
    
    Fixes #17992.
    04b6cf94
  • Ryan Scott's avatar
    Handle promoted data constructors in typeToLHsType correctly · 7802fa17
    Ryan Scott authored
    Instead of using `nlHsTyVar`, which hardcodes `NotPromoted`, have
    `typeToLHsType` pick between `Promoted` and `NotPromoted` by checking
    if a type constructor is promoted using `isPromotedDataCon`.
    
    Fixes #18020.
    7802fa17
  • Ben Gamari's avatar
    hadrian: Use --export-dynamic when linking iserv · ce481361
    Ben Gamari authored
    As noticed in #17962, the make build system currently does this (see
    3ce0e0ba) but the change was never ported to Hadrian.
    ce481361
  • Ben Gamari's avatar
    iserv: Don't pass --export-dynamic on FreeBSD · fa66f143
    Ben Gamari authored
    This is definitely a hack but it's probably the best we can do for now.
    Hadrian does the right thing here by passing --export-dynamic only to
    the linker.
    fa66f143
  • Ömer Sinan Ağacan's avatar
    Fix CNF handling in compacting GC · 39075176
    Ömer Sinan Ağacan authored
    Fixes #17937
    
    Previously compacting GC simply ignored CNFs. This is mostly fine as
    most (see "What about small compacts?" below) CNF objects don't have
    outgoing pointers, and are "large" (allocated in large blocks) and large
    objects are not moved or compacted.
    
    However if we do GC *during* sharing-preserving compaction then the CNF
    will have a hash table mapping objects that have been moved to the CNF
    to their location in the CNF, to be able to preserve sharing.
    
    This case is handled in the copying collector, in `scavenge_compact`,
    where we evacuate hash table entries and then rehash the table.
    
    Compacting GC ignored this case.
    
    We now visit CNFs in all generations when threading pointers to the
    compacted heap and thread hash table keys. A visited CNF is added to the
    list `nfdata_chain`. After compaction is done, we re-visit the CNFs in
    that list and rehash the tables.
    
    The overhead is minimal: the list is static in `Compact.c`, and link
    field is added to `StgCompactNFData` closure. Programs that don't use
    CNFs should not be affected.
    
    To test this CNF tests are now also run in a new way 'compacting_gc',
    which just passes `-c` to the RTS, enabling compacting GC for the oldest
    generation. Before this patch the result would be:
    
        Unexpected failures:
           compact_gc.run          compact_gc [bad exit code (139)] (compacting_gc)
           compact_huge_array.run  compact_huge_array [bad exit code (1)] (compacting_gc)
    
    With this patch all tests pass. I can also pass `-c -DS` without any
    failures.
    
    What about small compacts? Small CNFs are still not handled by the
    compacting GC. However so far I'm unable to write a test that triggers a
    runtime panic ("update_fwd: unknown/strange object") by allocating a
    small CNF in a compated heap. It's possible that I'm missing something
    and it's not possible to have a small CNF.
    
    NoFib Results:
    
    --------------------------------------------------------------------------------
            Program           Size    Allocs    Instrs     Reads    Writes
    --------------------------------------------------------------------------------
                 CS          +0.1%      0.0%      0.0%     +0.0%     +0.0%
                CSD          +0.1%      0.0%      0.0%      0.0%      0.0%
                 FS          +0.1%      0.0%      0.0%      0.0%      0.0%
                  S          +0.1%      0.0%      0.0%      0.0%      0.0%
                 VS          +0.1%      0.0%      0.0%      0.0%      0.0%
                VSD          +0.1%      0.0%     +0.0%     +0.0%     -0.0%
                VSM          +0.1%      0.0%     +0.0%     -0.0%      0.0%
               anna          +0.0%      0.0%     -0.0%     -0.0%     -0.0%
               ansi          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               atom          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             awards          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             banner          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         bernouilli          +0.1%      0.0%      0.0%     -0.0%     +0.0%
       binary-trees          +0.1%      0.0%     -0.0%     -0.0%      0.0%
              boyer          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             boyer2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               bspt          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
          cacheprof          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
           calendar          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           cichelli          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            circsim          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           clausify          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
      comp_lab_zift          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           compress          +0.1%      0.0%     +0.0%     +0.0%      0.0%
          compress2          +0.1%      0.0%     -0.0%      0.0%      0.0%
        constraints          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       cryptarithm1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       cryptarithm2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
                cse          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       digits-of-e1          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
       digits-of-e2          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             dom-lt          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
              eliza          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
              event          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        exact-reals          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             exp3_8          +0.1%      0.0%     +0.0%     -0.0%      0.0%
             expert          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
     fannkuch-redux          +0.1%      0.0%     -0.0%      0.0%      0.0%
              fasta          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
                fem          +0.1%      0.0%     -0.0%     +0.0%      0.0%
                fft          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
               fft2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           fibheaps          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               fish          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
              fluid          +0.0%      0.0%     +0.0%     +0.0%     +0.0%
             fulsom          +0.1%      0.0%     -0.0%     +0.0%      0.0%
             gamteb          +0.1%      0.0%     +0.0%     +0.0%      0.0%
                gcd          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
        gen_regexps          +0.1%      0.0%     -0.0%     +0.0%      0.0%
             genfft          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
                 gg          +0.1%      0.0%      0.0%     +0.0%     +0.0%
               grep          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
             hidden          +0.1%      0.0%     +0.0%     -0.0%      0.0%
                hpg          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
                ida          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
              infer          +0.1%      0.0%     +0.0%      0.0%     -0.0%
            integer          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          integrate          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
       k-nucleotide          +0.1%      0.0%     +0.0%     +0.0%      0.0%
              kahan          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            knights          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             lambda          +0.1%      0.0%     +0.0%     +0.0%     -0.0%
         last-piece          +0.1%      0.0%     +0.0%      0.0%      0.0%
               lcss          +0.1%      0.0%     +0.0%     +0.0%      0.0%
               life          +0.1%      0.0%     -0.0%     +0.0%     +0.0%
               lift          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             linear          +0.1%      0.0%     -0.0%     +0.0%      0.0%
          listcompr          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           listcopy          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           maillist          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
             mandel          +0.1%      0.0%     +0.0%     +0.0%      0.0%
            mandel2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               mate          +0.1%      0.0%     +0.0%      0.0%     +0.0%
            minimax          +0.1%      0.0%     -0.0%      0.0%     -0.0%
            mkhprog          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
         multiplier          +0.1%      0.0%     +0.0%      0.0%      0.0%
             n-body          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           nucleic2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               para          +0.1%      0.0%      0.0%     +0.0%     +0.0%
          paraffins          +0.1%      0.0%     +0.0%     -0.0%      0.0%
             parser          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
            parstof          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
                pic          +0.1%      0.0%     -0.0%     -0.0%      0.0%
           pidigits          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
              power          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             pretty          +0.1%      0.0%     -0.0%     -0.0%     -0.1%
             primes          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
          primetest          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             prolog          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             puzzle          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             queens          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            reptile          +0.1%      0.0%     -0.0%     -0.0%     +0.0%
    reverse-complem          +0.1%      0.0%     +0.0%      0.0%     -0.0%
            rewrite          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
               rfib          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
                rsa          +0.1%      0.0%     -0.0%     +0.0%     -0.0%
                scc          +0.1%      0.0%     -0.0%     -0.0%     -0.1%
              sched          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
                scs          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             simple          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
              solid          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            sorting          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
      spectral-norm          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
             sphere          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
             symalg          +0.1%      0.0%     -0.0%     -0.0%     -0.0%
                tak          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
          transform          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
           treejoin          +0.1%      0.0%     +0.0%     -0.0%     -0.0%
          typecheck          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
            veritas          +0.0%      0.0%     +0.0%     +0.0%     +0.0%
               wang          +0.1%      0.0%      0.0%     +0.0%     +0.0%
          wave4main          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       wheel-sieve1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
       wheel-sieve2          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
               x2n1          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
    --------------------------------------------------------------------------------
                Min          +0.0%      0.0%     -0.0%     -0.0%     -0.1%
                Max          +0.1%      0.0%     +0.0%     +0.0%     +0.0%
     Geometric Mean          +0.1%     -0.0%     -0.0%     -0.0%     -0.0%
    
    Bumping numbers of nonsensical perf tests:
    
    Metric Increase:
        T12150
        T12234
        T12425
        T13035
        T5837
        T6048
    
    It's simply not possible for this patch to increase allocations, and
    I've wasted enough time on these test in the past (see #17686). I think
    these tests should not be perf tests, but for now I'll bump the numbers.
    39075176
  • Sylvain Henry's avatar
    Rts: show errno on failure (#18033) · dce50062
    Sylvain Henry authored
    dce50062
  • Hécate's avatar
    Add an example to liftIO and explain its purpose · 045139f4
    Hécate authored
    045139f4
  • Sebastian Graf's avatar
    Special case `isConstraintKindCon` on `AlgTyCon` · 101fab6e
    Sebastian Graf authored
    Previously, the `tyConUnique` record selector would unfold into a huge
    case expression that would be inlined in all call sites, such as the
    `INLINE`-annotated `coreView`, see #18026. `constraintKindTyConKey` only
    occurs as the `Unique` of an `AlgTyCon` anyway, so we can make the code
    a lot more compact, but have to move it to GHC.Core.TyCon.
    
    Metric Decrease:
        T12150
        T12234
    101fab6e
  • Sebastian Graf's avatar
    DmdAnal: No need to attach a StrictSig to DataCon workers · f5212dfc
    Sebastian Graf authored
    In GHC.Types.Id.Make we were giving a strictness signature to every data
    constructor wrapper Id that we weren't looking at in demand analysis
    anyway. We used to use its CPR info, but that has its own CPR signature
    now.
    
    `Note [Data-con worker strictness]` then felt very out of place, so I
    moved it to GHC.Core.DataCon.
    f5212dfc
  • Sylvain Henry's avatar
    Hadrian: fix --summary · 75a185dc
    Sylvain Henry authored
    75a185dc
  • Ömer Sinan Ağacan's avatar
    testsuite: Move no_lint to the top level, tweak hie002 · 723062ed
    Ömer Sinan Ağacan authored
    - We don't want to benchmark linting so disable lints in hie002 perf
      test
    
    - Move no_lint to the top-level to be able to use it in tests other than
      those in `testsuite/tests/perf/compiler`.
    
    - Filter out -dstg-lint in no_lint.
    
    - hie002 allocation numbers on 32-bit are unstable, so skip it on 32-bit
    
    Metric Decrease:
        hie002
        ManyConstructors
        T12150
        T12234
        T13035
        T1969
        T4801
        T9233
        T9961
    723062ed
  • Peter Trommler's avatar
    Testsuite: mark T11531 fragile · bcafaa82
    Peter Trommler authored
    The test depends on a link editor allowing undefined symbols in an ELF
    shared object. This is the standard but it seems some distributions
    patch their link editor. See the report by @hsyl20 in #11531.
    
    Fixes #11531
    bcafaa82
  • Takenobu Tani's avatar
    testsuite: Fix comment for a language extension · 0889f5ee
    Takenobu Tani authored
    [skip ci]
    0889f5ee
  • Simon Peyton Jones's avatar
    Significant refactor of Lint · cd4f92b5
    Simon Peyton Jones authored
    This refactoring of Lint was triggered by #17923, which is
    fixed by this patch.
    
    The main change is this.  Instead of
       lintType :: Type -> LintM LintedKind
    we now have
       lintType :: Type -> LintM LintedType
    
    Previously, all of typeKind was effectively duplicate in lintType.
    Moreover, since we have an ambient substitution, we still had to
    apply the substition here and there, sometimes more than once. It
    was all very tricky, in the end, and made my head hurt.
    
    Now, lintType returns a fully linted type, with all substitutions
    performed on it.  This is much simpler.
    
    The same thing is needed for Coercions.  Instead of
      lintCoercion :: OutCoercion
                   -> LintM (LintedKind, LintedKind,
                             LintedType, LintedType, Role)
    we now have
      lintCoercion :: Coercion -> LintM LintedCoercion
    
    Much simpler!  The code is shorter and less bug-prone.
    
    There are a lot of knock on effects.  But life is now better.
    
    Metric Decrease:
        T1969
    cd4f92b5
  • Josh Meredith's avatar
    Implement extensible interface files · 0efaf301
    Josh Meredith authored
    0efaf301
  • Ryan Scott's avatar
    Use conLikeUserTyVarBinders to quantify field selector types · 54ca66a7
    Ryan Scott authored
    This patch:
    
    1. Writes up a specification for how the types of top-level field
       selectors should be determined in a new section of the GHC User's
       Guide, and
    2. Makes GHC actually implement that specification by using
       `conLikeUserTyVarBinders` in `mkOneRecordSelector` to preserve the
       order and specificity of type variables written by the user.
    
    Fixes #18023.
    54ca66a7
  • Ben Gamari's avatar
    hadrian: Don't --export-dynamic on Darwin · 35799dda
    Ben Gamari authored
    When fixing #17962 I neglected to consider that --export-dynamic is only
    supported on ELF platforms.
    35799dda
  • Alexis King's avatar
    Add an INLINE pragma to Control.Category.>>> · e8029816
    Alexis King authored
    This fixes #18013 by adding INLINE pragmas to both Control.Category.>>>
    and GHC.Desugar.>>>. The functional change in this patch is tiny (just
    two lines of pragmas!), but an accompanying Note explains in gory
    detail what’s going on.
    e8029816
  • Krzysztof Gogolewski's avatar
    0da186c1
  • Andreas Klebinger's avatar
    Small change to the windows ticker. · 074c1ccd
    Andreas Klebinger authored
    We already have a function to go from time to ms so use it.
    Also expand on the state of timer resolution.
    074c1ccd
  • Alp Mestanogullari's avatar
  • Julien Debon's avatar
    doc (Foldable): Add examples to Data.Foldable · d0c3b069
    Julien Debon authored
    See #17929
    d0c3b069
  • Ben Gamari's avatar
    StgCRun: Enable unwinding only on Linux · 5b08e0c0
    Ben Gamari authored
    It's broken on macOS due and SmartOS due to assembler differences
    (#15207) so let's be conservative in enabling it. Also, refactor things
    to make the intent clearer.
    5b08e0c0
  • Ben Gamari's avatar
    rts: Don't mark evacuate_large as inline · 27cc2e7b
    Ben Gamari authored
    This function has two callsites and is quite large. GCC consequently
    decides not to inline and warns instead. Given the situation, I can't
    blame it. Let's just remove the inline specifier.
    27cc2e7b
  • Ben Gamari's avatar
    base: Enable large file support for OFD locking impl. · 9853fc5e
    Ben Gamari authored
    Not only is this a good idea in general but this should also avoid
    issue #17950 by ensuring that off_t is 64-bits.
    9853fc5e
  • Matthew Pickering's avatar
    Hadrian: Make -i paths absolute · 7b41f21b
    Matthew Pickering authored
    The primary reason for this change is that ghcide does not work with
    relative paths. It also matches what cabal and stack do, they always
    pass absolute paths.
    7b41f21b
  • Daniel Gröber (dxld)'s avatar
    Zero out pinned block alignment slop when profiling · 41230e26
    Daniel Gröber (dxld) authored
    The heap profiler currently cannot traverse pinned blocks because of
    alignment slop. This used to just be a minor annoyance as the whole block
    is accounted into a special cost center rather than the respective object's
    CCS, cf. #7275. However for the new root profiler we would like to be able
    to visit _every_ closure on the heap. We need to do this so we can get rid
    of the current 'flip' bit hack in the heap traversal code.
    
    Since info pointers are always non-zero we can in principle skip all the
    slop in the profiler if we can rely on it being zeroed. This assumption
    caused problems in the past though, commit a586b33f ("rts: Correct
    handling of LARGE ARR_WORDS in LDV profiler"), part of !1118, tried to use
    the same trick for BF_LARGE objects but neglected to take into account that
    shrink*Array# functions don't ensure that slop is zeroed when not
    compiling with profiling.
    
    Later, commit 0c114c65 ("Handle large ARR_WORDS in heap census (fix
    as we will only be assuming slop is zeroed when profiling is on.
    
    This commit also reduces the ammount of slop we introduce in the first
    place by calculating the needed alignment before doing the allocation for
    small objects where we know the next available address. For large objects
    we don't know how much alignment we'll have to do yet since those details
    are hidden behind the allocateMightFail function so there we continue to
    allocate the maximum additional words we'll need to do the alignment.
    
    So we don't have to duplicate all this logic in the cmm code we pull it
    into the RTS allocatePinned function instead.
    
    Metric Decrease:
        T7257
        haddock.Cabal
        haddock.base
    41230e26
  • Daniel Gröber (dxld)'s avatar
    15fa9bd6
  • Daniel Gröber (dxld)'s avatar
  • Daniel Gröber (dxld)'s avatar
    c3c0f662
  • Daniel Gröber (dxld)'s avatar
    rts: Fix nomenclature in OVERWRITING_CLOSURE macros · e149dea9
    Daniel Gröber (dxld) authored
    The additional commentary introduced by commit 8916e64e ("Implement
    shrinkSmallMutableArray# and resizeSmallMutableArray#.") unfortunately got
    this wrong. We set 'prim' to true in overwritingClosureOfs because we
    _don't_ want to call LDV_recordDead().
    
    The reason is because of this "inherently used" distinction made in the LDV
    profiler so I rename the variable to be more appropriate.
    e149dea9
  • Daniel Gröber (dxld)'s avatar
  • Daniel Gröber (dxld)'s avatar
    rts: Assert LDV_recordDead is not called for inherently used closures · 19de2fb0
    Daniel Gröber (dxld) authored
    The comments make it clear LDV_recordDead should not be called for
    inhererently used closures, so add an assertion to codify this fact.
    19de2fb0
  • Ryan Scott's avatar
    Bump template-haskell version to 2.17.0.0 · 0b934e30
    Ryan Scott authored
    This requires bumping the `exceptions` and `text` submodules to bring
    in commits that bump their respective upper version bounds on
    `template-haskell`.
    
    Fixes #17645. Fixes #17696.
    
    Note that the new `text` commit includes a fair number of additions
    to the Haddocks in that library. As a result, Haddock has to do more
    work during the `haddock.Cabal` test case, increasing the number of
    allocations it requires. Therefore,
    
    -------------------------
    Metric Increase:
        haddock.Cabal
    -------------------------
    0b934e30
  • Ryan Scott's avatar
    Fix #18052 by using pprPrefixOcc in more places · 22cc8e51
    Ryan Scott authored
    This fixes several small oversights in the choice of pretty-printing
    function to use. Fixes #18052.
    22cc8e51
  • Daniel Gröber (dxld)'s avatar
    rts: ProfHeap: Fix wrong time in last heap profile sample · ec77b2f1
    Daniel Gröber (dxld) authored
    We've had this longstanding issue in the heap profiler, where the time of
    the last sample in the profile is sometimes way off causing the rendered
    graph to be quite useless for long runs.
    
    It seems to me the problem is that we use mut_user_time() for the last
    sample as opposed to getRTSStats(), which we use when calling heapProfile()
    in GC.c.
    
    The former is equivalent to getProcessCPUTime() but the latter does
    some additional stuff:
    
        getProcessCPUTime() - end_init_cpu - stats.gc_cpu_ns -
        stats.nonmoving_gc_cpu_ns
    
    So to fix this just use getRTSStats() in both places.
    ec77b2f1
  • Sylvain Henry's avatar
    Hadrian: fix dyn_o/dyn_hi rule (#17534) · 85fc32f0
    Sylvain Henry authored
    85fc32f0
  • Ryan Scott's avatar
    Fix #18065 by fixing an InstCo oversight in Core Lint · bfde3b76
    Ryan Scott authored
    There was a small thinko in Core Lint's treatment of `InstCo`
    coercions that ultimately led to #18065. The fix: add an apostrophe.
    That's it!
    
    Fixes #18065.
    Co-authored-by: Simon Peyton Jones's avatarSimon Peyton Jones <simonpj@microsoft.com>
    bfde3b76
  • cgibbard's avatar
    Change the fail operator argument of BindStmt to be a Maybe · a05348eb
    cgibbard authored
    Don't use noSyntaxExpr for it. There is no good way to defensively case
    on that, nor is it clear one ought to do so.
    a05348eb
  • John Ericson's avatar
    Use trees that grow for rebindable operators for `<-` binds · 79e27144
    John Ericson authored
    Also add more documentation.
    79e27144
  • cgibbard's avatar
    Use FailOperator in more places, define a couple datatypes (XBindStmtRn and... · 18bc16ed
    cgibbard authored
    Use FailOperator in more places, define a couple datatypes (XBindStmtRn and XBindStmtTc) to help clarify the meaning of XBindStmt in the renamer and typechecker
    18bc16ed
  • Simon Peyton Jones's avatar
    Add a missing zonk in tcHsPartialType · 84cc8394
    Simon Peyton Jones authored
    I omitted a vital zonk when refactoring tcHsPartialType in
       commit 48fb3482
       Author: Simon Peyton Jones <simonpj@microsoft.com>
       Date:   Wed Jun 5 08:55:17 2019 +0100
    
       Fix typechecking of partial type signatures
    
    This patch fixes it and adds commentary to explain why.
    
    Fixes #18008
    84cc8394
  • Ben Gamari's avatar
    2ee96ac1
  • Ben Gamari's avatar
    434312e5
  • Ben Gamari's avatar
    ddffb227
  • Ben Gamari's avatar
    Bump hsc2hs submodule · e2586828
    Ben Gamari authored
    e2586828
  • Ömer Sinan Ağacan's avatar
    Improve prepForeignCall error reporting · 15ab6cd5
    Ömer Sinan Ağacan authored
    Show parameters and description of the error code when ffi_prep_cif
    fails.
    
    This may be helpful for debugging #17018.
    15ab6cd5
  • Sylvain Henry's avatar
    GHC.Core.Opt renaming · 3ca52151
    Sylvain Henry authored
    * GHC.Core.Op                  => GHC.Core.Opt
    * GHC.Core.Opt.Simplify.Driver => GHC.Core.Opt.Driver
    * GHC.Core.Opt.Tidy            => GHC.Core.Tidy
    * GHC.Core.Opt.WorkWrap.Lib    => GHC.Core.Opt.WorkWrap.Utils
    
    As discussed in:
     * https://mail.haskell.org/pipermail/ghc-devs/2020-April/018758.html
     * ghc/ghc#13009 (comment 264650)
    3ca52151
  • Sylvain Henry's avatar
    Modules (#13009) · 15312bbb
    Sylvain Henry authored
    * SysTools
    * Parser
    * GHC.Builtin
    * GHC.Iface.Recomp
    * Settings
    
    Update Haddock submodule
    
    Metric Decrease:
        Naperian
        parsing001
    15312bbb
  • Alexis King's avatar
    Add missing addInScope call for letrec binders in OccurAnal · eaed0a32
    Alexis King authored
    This fixes #18044, where a shadowed variable was incorrectly substituted
    by the binder swap on the RHS of a floated-in letrec. This can only
    happen when the uniques line up *just* right, so writing a regression
    test would be very difficult, but at least the fix is small and
    straightforward.
    eaed0a32
......@@ -26,19 +26,18 @@ stages:
- testing # head.hackage correctness and compiler performance testing
- deploy # push documentation
# N.B.Don't run on wip/ branches, instead on run on merge requests.
.only-default: &only-default
only:
- master
- /ghc-[0-9]+\.[0-9]+/
- merge_requests
- tags
- web
workflow:
# 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_PIPELINE_SOURCE == "web"'
.nightly: &nightly
only:
variables:
- $NIGHTLY
rules:
- if: $NIGHTLY
artifacts:
when: always
expire_in: 8 weeks
......@@ -50,9 +49,8 @@ stages:
artifacts:
when: always
expire_in: 1 year
only:
variables:
- $RELEASE == "yes"
rules:
- if: '$RELEASE == "yes"'
############################################################
# Runner Tags
......@@ -86,13 +84,11 @@ ghc-linters:
dependencies: []
tags:
- lint
only:
refs:
- merge_requests
rules:
- if: $CI_MERGE_REQUEST_ID
# Run mypy Python typechecker on linter scripts.
lint-linters:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
......@@ -103,7 +99,6 @@ lint-linters:
# Check that .T files all parse by listing broken tests.
lint-testsuite:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
script:
......@@ -114,7 +109,6 @@ lint-testsuite:
# Run mypy Python typechecker on testsuite driver
typecheck-testsuite:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
......@@ -127,7 +121,6 @@ typecheck-testsuite:
# accommodate, e.g., haddock changes not yet upstream) but not on `master` or
# Marge jobs.
.lint-submods:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
......@@ -140,25 +133,14 @@ typecheck-testsuite:
tags:
- lint
lint-submods-marge:
lint-submods:
extends: .lint-submods
only:
refs:
- merge_requests
variables:
- "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
lint-submods-mr:
extends: .lint-submods
# Allow failure since any necessary submodule patches may not be upstreamed
# yet.
allow_failure: true
only:
refs:
- merge_requests
except:
variables:
- "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
# Allow failure on merge requests since any necessary submodule patches may
# not be upstreamed yet.
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
allow_failure: false
- allow_failure: true
lint-submods-branch:
extends: .lint-submods
......@@ -166,13 +148,11 @@ lint-submods-branch:
- "echo Linting submodule changes between $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
- git submodule foreach git remote update
- submodchecker . $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
only:
refs:
- master
- /ghc-[0-9]+\.[0-9]+/
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
.lint-changelogs:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
dependencies: []
......@@ -185,15 +165,13 @@ lint-changelogs:
extends: .lint-changelogs
# Allow failure since this isn't a final release.
allow_failure: true
only:
refs:
- /ghc-[0-9]+\.[0-9]+/
rules:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
lint-release-changelogs:
extends: .lint-changelogs
only:
refs:
- /ghc-[0-9]+\.[0-9]+\.[0-9]+-.*/
rules:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
############################################################
......@@ -201,7 +179,6 @@ lint-release-changelogs:
############################################################
.validate-hadrian:
<<: *only-default
variables:
FLAVOUR: "validate"
script:
......@@ -250,7 +227,6 @@ validate-x86_64-linux-deb9-unreg-hadrian:
TEST_ENV: "x86_64-linux-deb9-unreg-hadrian"
hadrian-ghc-in-ghci:
<<: *only-default
stage: quick-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
before_script:
......@@ -283,7 +259,6 @@ hadrian-ghc-in-ghci:
############################################################
.validate:
<<: *only-default
variables:
TEST_TYPE: test
MAKE_ARGS: "-Werror"
......@@ -317,8 +292,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.6.3
CABAL_INSTALL_VERSION: 3.0.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"
......@@ -334,10 +309,12 @@ hadrian-ghc-in-ghci:
- cabal-cache
- toolchain
# Disabled due to lack of builder capacity
.validate-x86_64-freebsd:
# 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
......@@ -414,7 +391,6 @@ validate-x86_64-darwin:
# Disabled because of OS X CI capacity
.validate-x86_64-darwin-hadrian:
<<: *only-default
stage: full-build
tags:
- x86_64-darwin
......@@ -777,7 +753,6 @@ validate-x86_64-linux-fedora27:
############################################################
.build-windows:
<<: *only-default
# For the reasons given in #17777 this build isn't reliable.
allow_failure: true
before_script:
......@@ -951,7 +926,6 @@ nightly-i386-windows:
# See Note [Cleanup after shell executor]
cleanup-darwin:
<<: *only-default
stage: cleanup
tags:
- x86_64-darwin
......@@ -973,7 +947,6 @@ cleanup-darwin:
############################################################
doc-tarball:
<<: *only-default
stage: packaging
tags:
- x86_64-linux
......@@ -1013,10 +986,10 @@ source-tarball:
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
when: always
dependencies: []
only:
- tags
rules:
- if: $CI_COMMIT_TAG
when: always
artifacts:
paths:
- ghc-*.tar.xz
......@@ -1043,7 +1016,6 @@ source-tarball:
# pipeline.
.hackage:
<<: *only-default
stage: testing
image: ghcci/x86_64-linux-deb9:0.2
tags:
......@@ -1060,9 +1032,8 @@ hackage:
hackage-label:
extends: .hackage
only:
variables:
- $CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/'
nightly-hackage:
<<: *nightly
......@@ -1077,11 +1048,10 @@ perf-nofib:
dependencies:
- validate-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
only:
refs:
- merge_requests
- master
- /ghc-[0-9]+\.[0-9]+/
rules:
- if: $CI_MERGE_REQUEST_ID
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
tags:
- x86_64-linux
script:
......@@ -1130,8 +1100,8 @@ pages:
<meta http-equiv="refresh" content="1; url=doc/">
EOF
- cp -f index.html public/doc
only:
- master
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
artifacts:
paths:
- public
......@@ -139,12 +139,6 @@ function set_toolchain_paths() {
export CABAL
export HAPPY
export ALEX
# FIXME: Temporarily use ghc from ports
case "$(uname)" in
FreeBSD) GHC="/usr/local/bin/ghc" ;;
*) ;;
esac
}
# Extract GHC toolchain
......
......@@ -16,26 +16,26 @@
/includes/ @bgamari @simonmar @osa1
# The compiler
/compiler/parser/ @int-index
/compiler/hsSyn/ @simonpj @rae
/compiler/typecheck/ @simonpj @rae
/compiler/rename/ @simonpj @rae
/compiler/types/ @simonpj @rae
/compiler/deSugar/ @simonpj @rae
/compiler/typecheck/TcDeriv* @RyanGlScott
/compiler/nativeGen/ @simonmar @bgamari @AndreasK
/compiler/llvmGen/ @angerman
/compiler/codeGen/ @simonmar @osa1
/compiler/cmm/ @simonmar @osa1
/compiler/ghci/ @simonmar
/compiler/simplCore/CallArity.hs @nomeata
/compiler/utils/UnVarGraph.hs @nomeata
/compiler/simplCore/Exitify.hs @nomeata
/compiler/simplStg/StgCse.hs @nomeata
/compiler/simplStg/StgLiftLams.hs @sgraf
/compiler/cmm/CmmSwitch.hs @nomeata
/compiler/stranal/DmdAnal.hs @simonpj @sgraf
/compiler/hsSyn/Convert.hs @rae
/compiler/parser/ @int-index
/compiler/GHC/Hs/ @simonpj @rae
/compiler/GHC/Tc/ @simonpj @rae
/compiler/GHC/Rename/ @simonpj @rae
/compiler/GHC/Types/ @simonpj @rae
/compiler/GHC/HsToCore/ @simonpj @rae
/compiler/GHC/Tc/Deriv/ @RyanGlScott
/compiler/GHC/CmmToAsm/ @simonmar @bgamari @AndreasK
/compiler/GHC/CmmToLlvm/ @angerman
/compiler/GHC/StgToCmm/ @simonmar @osa1
/compiler/GHC/Cmm/ @simonmar @osa1
/compiler/ghci/ @simonmar
/compiler/GHC/Core/Op/CallArity.hs @nomeata
/compiler/utils/UnVarGraph.hs @nomeata
/compiler/GHC/Core/Op/Exitify.hs @nomeata
/compiler/GHC/Stg/CSE.hs @nomeata
/compiler/GHC/Stg/Lift.hs @sgraf
/compiler/GHC/Cmm/Switch.hs @nomeata
/compiler/GHC/Core/Op/DmdAnal.hs @simonpj @sgraf
/compiler/GHC/ThToHs.hs @rae
# Core libraries
/libraries/base/ @hvr
......
......@@ -308,18 +308,18 @@ import GHC.Driver.Make
import GHC.Driver.Hooks
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface )
import TcRnTypes
import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface )
import GHC.Tc.Types
import GHC.Core.Predicate
import GHC.Driver.Packages
import GHC.Types.Name.Set
import GHC.Types.Name.Reader
import GHC.Hs
import GHC.Core.Type hiding( typeKind )
import TcType
import GHC.Tc.Utils.TcType
import GHC.Types.Id
import TysPrim ( alphaTyVars )
import GHC.Builtin.Types.Prim ( alphaTyVars )
import GHC.Core.TyCon
import GHC.Core.TyCo.Ppr ( pprForAll )
import GHC.Core.Class
......@@ -338,8 +338,8 @@ import GHC.Driver.Types
import GHC.Driver.CmdLine
import GHC.Driver.Session hiding (WarnReason(..))
import GHC.Driver.Ways
import SysTools
import SysTools.BaseDir
import GHC.SysTools
import GHC.SysTools.BaseDir
import GHC.Types.Annotations
import GHC.Types.Module
import Panic
......@@ -352,15 +352,15 @@ import StringBuffer
import Outputable
import GHC.Types.Basic
import FastString
import qualified Parser
import Lexer
import ApiAnnotation
import qualified GHC.Parser as Parser
import GHC.Parser.Lexer
import GHC.Parser.Annotation
import qualified GHC.LanguageExtensions as LangExt
import GHC.Types.Name.Env
import TcRnDriver
import Inst
import FamInst
import FileCleanup
import GHC.Tc.Module
import GHC.Tc.Utils.Instantiate
import GHC.Tc.Instance.Family
import GHC.SysTools.FileCleanup
import Data.Foldable
import qualified Data.Map.Strict as Map
......@@ -857,7 +857,7 @@ data ParsedModule =
, pm_parsed_source :: ParsedSource
, pm_extra_src_files :: [FilePath]
, pm_annotations :: ApiAnns }
-- See Note [Api annotations] in ApiAnnotation.hs
-- See Note [Api annotations] in GHC.Parser.Annotation
instance ParsedMod ParsedModule where
modSummary m = pm_mod_summary m
......@@ -951,7 +951,7 @@ parseModule ms = do
hpm <- liftIO $ hscParse hsc_env_tmp ms
return (ParsedModule ms (hpm_module hpm) (hpm_src_files hpm)
(hpm_annotations hpm))
-- See Note [Api annotations] in ApiAnnotation.hs
-- See Note [Api annotations] in GHC.Parser.Annotation
-- | Typecheck and rename a parsed module.
--
......@@ -1322,7 +1322,7 @@ getNameToInstancesIndex visible_mods mods_to_load = do
; (pkg_fie, home_fie) <- tcGetFamInstEnvs
-- We use Data.Sequence.Seq because we are creating left associated
-- mappends.
-- cls_index and fam_index below are adapted from TcRnDriver.lookupInsts
-- cls_index and fam_index below are adapted from GHC.Tc.Module.lookupInsts
; let cls_index = Map.fromListWith mappend
[ (n, Seq.singleton ispec)
| ispec <- instEnvElts ie_local ++ instEnvElts ie_global
......
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[PrelNames]{Definitions of prelude modules and names}
\section[GHC.Builtin.Names]{Definitions of prelude modules and names}
Nota Bene: all Names defined in here should come from the base package
......@@ -63,7 +63,7 @@ This is accomplished through a combination of mechanisms:
2. The knownKeyNames (which consist of the basicKnownKeyNames from
the module, and those names reachable via the wired-in stuff from
TysWiredIn) are used to initialise the "OrigNameCache" in
GHC.Builtin.Types) are used to initialise the "OrigNameCache" in
GHC.Iface.Env. This initialization ensures that when the type checker
or renamer (both of which use GHC.Iface.Env) look up an original name
(i.e. a pair of a Module and an OccName) for a known-key name
......@@ -98,7 +98,7 @@ things,
GHC.Iface.Binary.putName, with that special treatment detected when we read
back to ensure that we get back to the correct uniques. See Note [Symbol
table representation of names] in GHC.Iface.Binary and Note [How tuples
work] in TysWiredIn.
work] in GHC.Builtin.Types.
Most of the infinite families cannot occur in source code, so mechanisms (a) and (b)
suffice to ensure that they always have the right Unique. In particular,
......@@ -145,16 +145,17 @@ Note [Wired-in packages] in GHC.Types.Module. This is done in Packages.findWired
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module PrelNames (
Unique, Uniquable(..), hasKey, -- Re-exported for convenience
module GHC.Builtin.Names
( Unique, Uniquable(..), hasKey, -- Re-exported for convenience
-----------------------------------------------------------
module PrelNames, -- A huge bunch of (a) Names, e.g. intTyConName
-- (b) Uniques e.g. intTyConKey
-- (c) Groups of classes and types
-- (d) miscellaneous things
-- So many that we export them all
) where
-----------------------------------------------------------
module GHC.Builtin.Names, -- A huge bunch of (a) Names, e.g. intTyConName
-- (b) Uniques e.g. intTyConKey
-- (c) Groups of classes and types
-- (d) miscellaneous things
-- So many that we export them all
)
where
#include "HsVersions.h"
......@@ -210,7 +211,7 @@ isUnboundName name = name `hasKey` unboundKey
This section tells what the compiler knows about the association of
names with uniques. These ones are the *non* wired-in ones. The
wired in ones are defined in TysWiredIn etc.
wired in ones are defined in GHC.Builtin.Types etc.
-}
basicKnownKeyNames :: [Name] -- See Note [Known-key names]
......@@ -1291,7 +1292,7 @@ mkTrFunName = varQual tYPEABLE_INTERNAL (fsLit "mkTrFun") mkTrF
typeNatTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeNatTypeRep") typeNatTypeRepKey
typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey
-- this is the Typeable 'Module' for GHC.Prim (which has no code, so we place in GHC.Types)
-- See Note [Grand plan for Typeable] in TcTypeable.
-- See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.
trGhcPrimModuleName = varQual gHC_TYPES (fsLit "tr$ModuleGHCPrim") trGhcPrimModuleKey
-- Typeable KindReps for some common cases
......@@ -1620,11 +1621,11 @@ datatypeClassKey = mkPreludeClassUnique 39
constructorClassKey = mkPreludeClassUnique 40
selectorClassKey = mkPreludeClassUnique 41
-- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in TcEvidence
-- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
knownNatClassNameKey :: Unique
knownNatClassNameKey = mkPreludeClassUnique 42
-- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in TcEvidence
-- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in GHC.Tc.Types.Evidence
knownSymbolClassNameKey :: Unique
knownSymbolClassNameKey = mkPreludeClassUnique 43
......@@ -1648,7 +1649,7 @@ hasFieldClassNameKey = mkPreludeClassUnique 49
---------------- Template Haskell -------------------
-- THNames.hs: USES ClassUniques 200-299
-- GHC.Builtin.Names.TH: USES ClassUniques 200-299
-----------------------------------------------------
{-
......@@ -1895,7 +1896,7 @@ unsafeEqualityTyConKey = mkPreludeTyConUnique 191
---------------- Template Haskell -------------------
-- THNames.hs: USES TyConUniques 200-299
-- GHC.Builtin.Names.TH: USES TyConUniques 200-299
-----------------------------------------------------
----------------------- SIMD ------------------------
......@@ -2025,7 +2026,7 @@ vecRepDataConKey = mkPreludeDataConUnique 71
tupleRepDataConKey = mkPreludeDataConUnique 72
sumRepDataConKey = mkPreludeDataConUnique 73
-- See Note [Wiring in RuntimeRep] in TysWiredIn
-- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types
runtimeRepSimpleDataConKeys, unliftedSimpleRepDataConKeys, unliftedRepDataConKeys :: [Unique]
liftedRepDataConKey :: Unique
runtimeRepSimpleDataConKeys@(liftedRepDataConKey : unliftedSimpleRepDataConKeys)
......@@ -2036,12 +2037,12 @@ unliftedRepDataConKeys = vecRepDataConKey :
sumRepDataConKey :
unliftedSimpleRepDataConKeys
-- See Note [Wiring in RuntimeRep] in TysWiredIn
-- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types
-- VecCount
vecCountDataConKeys :: [Unique]
vecCountDataConKeys = map mkPreludeDataConUnique [89..94]
-- See Note [Wiring in RuntimeRep] in TysWiredIn
-- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types
-- VecElem
vecElemDataConKeys :: [Unique]
vecElemDataConKeys = map mkPreludeDataConUnique [95..104]
......@@ -2068,7 +2069,7 @@ unsafeReflDataConKey :: Unique
unsafeReflDataConKey = mkPreludeDataConUnique 114
---------------- Template Haskell -------------------
-- THNames.hs: USES DataUniques 200-250
-- GHC.Builtin.Names.TH: USES DataUniques 200-250
-----------------------------------------------------
......@@ -2319,7 +2320,7 @@ proxyHashKey :: Unique
proxyHashKey = mkPreludeMiscIdUnique 502
---------------- Template Haskell -------------------
-- THNames.hs: USES IdUniques 200-499
-- GHC.Builtin.Names.TH: USES IdUniques 200-499
-----------------------------------------------------
-- Used to make `Typeable` dictionaries
......@@ -2451,7 +2452,7 @@ standardClassKeys = derivableClassKeys ++ numericClassKeys
{-
@derivableClassKeys@ is also used in checking \tr{deriving} constructs
(@TcDeriv@).
(@GHC.Tc.Deriv@).
-}
derivableClassKeys :: [Unique]
......
module PrelNames where
module GHC.Builtin.Names where
import GHC.Types.Module
import GHC.Types.Unique
......
......@@ -4,11 +4,11 @@
-- %* *
-- %************************************************************************
module THNames where
module GHC.Builtin.Names.TH where
import GhcPrelude ()
import PrelNames( mk_known_key_name )
import GHC.Builtin.Names( mk_known_key_name )
import GHC.Types.Module( Module, mkModuleNameFS, mkModule, thUnitId )
import GHC.Types.Name( Name )
import GHC.Types.Name.Occurrence( tcName, clsName, dataName, varName )
......@@ -608,7 +608,7 @@ incoherentDataConName = thCon (fsLit "Incoherent") incoherentDataConKey
********************************************************************* -}
-- ClassUniques available: 200-299
-- Check in PrelNames if you want to change this
-- Check in GHC.Builtin.Names if you want to change this
liftClassKey :: Unique
liftClassKey = mkPreludeClassUnique 200
......@@ -623,7 +623,7 @@ quoteClassKey = mkPreludeClassUnique 201
********************************************************************* -}
-- TyConUniques available: 200-299
-- Check in PrelNames if you want to change this
-- Check in GHC.Builtin.Names if you want to change this
expTyConKey, matchTyConKey, clauseTyConKey, qTyConKey, expQTyConKey,
patTyConKey,
......@@ -675,7 +675,7 @@ decsTyConKey = mkPreludeTyConUnique 236
********************************************************************* -}
-- DataConUniques available: 100-150
-- If you want to change this, make sure you check in PrelNames
-- If you want to change this, make sure you check in GHC.Builtin.Names
-- data Inline = ...
noInlineDataConKey, inlineDataConKey, inlinableDataConKey :: Unique
......@@ -715,7 +715,7 @@ incoherentDataConKey = mkPreludeDataConUnique 212
********************************************************************* -}
-- IdUniques available: 200-499
-- If you want to change this, make sure you check in PrelNames
-- If you want to change this, make sure you check in GHC.Builtin.Names
returnQIdKey, bindQIdKey, sequenceQIdKey, liftIdKey, newNameIdKey,
mkNameIdKey, mkNameG_vIdKey, mkNameG_dIdKey, mkNameG_tcIdKey,
......
......@@ -6,7 +6,7 @@
{-# LANGUAGE CPP #-}
module PrimOp (
module GHC.Builtin.PrimOps (
PrimOp(..), PrimOpVecCat(..), allThePrimOps,
primOpType, primOpSig,
primOpTag, maxPrimOpTag, primOpOcc,
......@@ -27,15 +27,15 @@ module PrimOp (
import GhcPrelude
import TysPrim
import TysWiredIn
import GHC.Builtin.Types.Prim
import GHC.Builtin.Types
import GHC.Cmm.Type
import GHC.Types.Demand
import GHC.Types.Id ( Id, mkVanillaGlobalWithInfo )
import GHC.Types.Id.Info ( vanillaIdInfo, setCafInfo, CafInfo(NoCafRefs) )
import GHC.Types.Name
import PrelNames ( gHC_PRIMOPWRAPPERS )
import GHC.Builtin.Names ( gHC_PRIMOPWRAPPERS )
import GHC.Core.TyCon ( TyCon, isPrimTyCon, PrimRep(..) )
import GHC.Core.Type
import GHC.Types.RepType ( typePrimRep1, tyConPrimRep1 )
......@@ -499,7 +499,7 @@ primOpOkForSideEffects op
Note [primOpIsCheap]
~~~~~~~~~~~~~~~~~~~~
@primOpIsCheap@, as used in GHC.Core.Op.Simplify.Utils. For now (HACK
@primOpIsCheap@, as used in GHC.Core.Opt.Simplify.Utils. For now (HACK
WARNING), we just borrow some other predicates for a
what-should-be-good-enough test. "Cheap" means willing to call it more
than once, and/or push it inside a lambda. The latter could change the
......
module PrimOp where
module GHC.Builtin.PrimOps where
import GhcPrelude ()
......
{-
(c) The GRASP Project, Glasgow University, 1994-1998
\section[TysWiredIn]{Wired-in knowledge about {\em non-primitive} types}
Wired-in knowledge about {\em non-primitive} types
-}
{-# LANGUAGE CPP #-}
......@@ -10,10 +10,10 @@
{-# 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 TysPrim
module TysWiredIn (
-- 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 TcTypeNats to define the
mkWiredInTyConName, -- This is used in GHC.Builtin.Types.Literals to define the
-- built-in functions for evaluation.
mkWiredInIdName, -- used in GHC.Types.Id.Make
......@@ -135,14 +135,14 @@ import GhcPrelude
import {-# SOURCE #-} GHC.Types.Id.Make ( mkDataConWorkId, mkDictSelId )
-- friends:
import PrelNames
import TysPrim
import {-# SOURCE #-} KnownUniques
import GHC.Builtin.Names
import GHC.Builtin.Types.Prim
import {-# SOURCE #-} GHC.Builtin.Uniques
-- others:
import GHC.Core.Coercion.Axiom
import GHC.Types.Id
import Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE, mAX_SUM_SIZE )
import GHC.Settings.Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE, mAX_SUM_SIZE )
import GHC.Types.Module ( Module )
import GHC.Core.Type
import GHC.Types.RepType
......@@ -193,10 +193,10 @@ See also Note [Getting from RuntimeRep to PrimRep] in GHC.Types.RepType.
************************************************************************
If you change which things are wired in, make sure you change their
names in PrelNames, so they use wTcQual, wDataQual, etc
names in GHC.Builtin.Names, so they use wTcQual, wDataQual, etc
-}
-- This list is used only to define PrelInfo.wiredInThings. That in turn
-- This list is used only to define GHC.Builtin.Utils.wiredInThings. That in turn
-- is used to initialise the name environment carried around by the renamer.
-- This means that if we look up the name of a TyCon (or its implicit binders)
-- that occurs in this list that name will be assigned the wired-in key we
......@@ -375,7 +375,7 @@ It has these properties:
* If (Any k) is the type of a value, it must be a /lifted/ value. So
if we have (Any @(TYPE rr)) then rr must be 'LiftedRep. See
Note [TYPE and RuntimeRep] in TysPrim. This is a convenient
Note [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim. This is a convenient
invariant, and makes isUnliftedTyCon well-defined; otherwise what
would (isUnliftedTyCon Any) be?
......@@ -639,6 +639,7 @@ typeNatKind = mkTyConTy typeNatKindCon
typeSymbolKind = mkTyConTy typeSymbolKindCon
constraintKindTyCon :: TyCon
-- 'TyCon.isConstraintKindCon' assumes that this is an AlgTyCon!
constraintKindTyCon = pcTyCon constraintKindTyConName Nothing [] []
liftedTypeKind, typeToTypeKind, constraintKind :: Kind
......@@ -653,7 +654,7 @@ constraintKind = mkTyConApp constraintKindTyCon []
* *
************************************************************************
Note [How tuples work] See also Note [Known-key names] in PrelNames
Note [How tuples work] See also Note [Known-key names] in GHC.Builtin.Names
~~~~~~~~~~~~~~~~~~~~~~
* There are three families of tuple TyCons and corresponding
DataCons, expressed by the type BasicTypes.TupleSort:
......@@ -679,7 +680,7 @@ Note [How tuples work] See also Note [Known-key names] in PrelNames
- Given constraints: the superclasses automatically become available
- Wanted constraints: there is a built-in instance
instance (c1,c2) => (c1,c2)
See TcInteract.matchCTuple
See GHC.Tc.Solver.Interact.matchCTuple
- Currently just go up to 62; beyond that
you have to use manual nesting
- Their OccNames look like (%,,,%), so they can easily be
......@@ -700,7 +701,7 @@ Note [How tuples work] See also Note [Known-key names] in PrelNames
* Serialization to interface files works via the usual mechanism for known-key
things: instead of serializing the OccName we just serialize the key. During
deserialization we lookup the Name associated with the unique with the logic
in KnownUniques. See Note [Symbol table representation of names] for details.
in GHC.Builtin.Uniques. See Note [Symbol table representation of names] for details.
Note [One-tuples]
~~~~~~~~~~~~~~~~~
......@@ -730,7 +731,7 @@ nothing special about one-tuples in Core; in particular, they have no
custom pretty-printing, just using `Unit`.
Note that there is *not* a unary constraint tuple, unlike for other forms of
tuples. See [Ignore unary constraint tuples] in TcHsType for more
tuples. See [Ignore unary constraint tuples] in GHC.Tc.Gen.HsType for more
details.
See also Note [Flattening one-tuples] in GHC.Core.Make and
......@@ -1090,7 +1091,7 @@ mk_sum arity = (tycon, sum_cons)
* *
********************************************************************* -}
-- See Note [The equality types story] in TysPrim
-- See Note [The equality types story] in GHC.Builtin.Types.Prim
-- ((~~) :: forall k1 k2 (a :: k1) (b :: k2). a -> b -> Constraint)
--
-- It's tempting to put functional dependencies on (~~), but it's not
......@@ -1170,11 +1171,11 @@ mk_class tycon sc_pred sc_sel_id
********************************************************************* -}
-- For information about the usage of the following type,
-- see Note [TYPE and RuntimeRep] in module TysPrim
-- see Note [TYPE and RuntimeRep] in module GHC.Builtin.Types.Prim
runtimeRepTy :: Type
runtimeRepTy = mkTyConTy runtimeRepTyCon
-- Type synonyms; see Note [TYPE and RuntimeRep] in TysPrim
-- Type synonyms; see Note [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim
-- type Type = tYPE 'LiftedRep
liftedTypeKindTyCon :: TyCon
liftedTypeKindTyCon = buildSynTyCon liftedTypeKindTyConName
......
module TysWiredIn where
module GHC.Builtin.Types where
import {-# SOURCE #-} GHC.Core.TyCon ( TyCon )
import {-# SOURCE #-} GHC.Core.TyCo.Rep (Type, Kind)
......
{-# LANGUAGE LambdaCase #-}
module TcTypeNats
module GHC.Builtin.Types.Literals
( typeNatTyCons
, typeNatCoAxiomRules
, BuiltInSynFamily(..)
......@@ -25,16 +25,17 @@ import GhcPrelude
import GHC.Core.Type
import Pair
import TcType ( TcType, tcEqType )
import GHC.Tc.Utils.TcType ( TcType, tcEqType )
import GHC.Core.TyCon ( TyCon, FamTyConFlav(..), mkFamilyTyCon
, Injectivity(..) )
import GHC.Core.Coercion ( Role(..) )
import Constraint ( Xi )
import GHC.Tc.Types.Constraint ( Xi )
import GHC.Core.Coercion.Axiom ( CoAxiomRule(..), BuiltInSynFamily(..), TypeEqn )
import GHC.Types.Name ( Name, BuiltInSyntax(..) )
import TysWiredIn
import TysPrim ( mkTemplateAnonTyConBinders )
import PrelNames ( gHC_TYPELITS
import GHC.Builtin.Types
import GHC.Builtin.Types.Prim ( mkTemplateAnonTyConBinders )
import GHC.Builtin.Names
( gHC_TYPELITS
, gHC_TYPENATS
, typeNatAddTyFamNameKey
, typeNatMulTyFamNameKey
......@@ -60,7 +61,7 @@ import Data.List ( isPrefixOf, isSuffixOf )
Note [Type-level literals]
~~~~~~~~~~~~~~~~~~~~~~~~~~
There are currently two forms of type-level literals: natural numbers, and
symbols (even though this module is named TcTypeNats, it covers both).
symbols (even though this module is named GHC.Builtin.Types.Literals, it covers both).
Type-level literals are supported by CoAxiomRules (conditional axioms), which
power the built-in type families (see Note [Adding built-in type families]).
......@@ -77,20 +78,20 @@ There are a few steps to adding a built-in type family:
* Adding a unique for the type family TyCon
These go in PrelNames. It will likely be of the form
These go in GHC.Builtin.Names. It will likely be of the form
@myTyFamNameKey = mkPreludeTyConUnique xyz@, where @xyz@ is a number that
ha