1. 27 Jan, 2022 14 commits
    • David Feuer's avatar
      Add test supplied in T20996 which uses data family result kind polymorphism · 31088dd3
      David Feuer authored and  Marge Bot's avatar Marge Bot committed
      David (@treeowl) writes:
      
      > Following @kcsongor, I've used ridiculous data family result kind
      > polymorphism in `linear-generics`, and am currently working on getting
      > it into `staged-gg`. If it should be removed, I'd appreciate a heads up,
      > and I imagine Csongor would too.
      >
      > What do I need by ridiculous polymorphic result kinds? Currently, data
      > families are allowed to have result kinds that end in `Type` (or maybe
      > `TYPE r`? I'm not sure), but not in concrete data kinds. However, they
      > *are* allowed to have polymorphic result kinds. This leads to things I
      > think most of us find at least quite *weird*. For example, I can write
      >
      > ```haskell
      > data family Silly :: k
      > data SBool :: Bool -> Type where
      >   SFalse :: SBool False
      >   STrue :: SBool True
      >   SSSilly :: SBool Silly
      > type KnownBool b where
      >   kb :: SBool b
      > instance KnownBool False where kb = SFalse
      > instance KnownBool True where kb = STrue
      > instance KnownBool Silly where kb = Silly
      > ```
      >
      > Basically, every kind now has potentially infinitely many "legit" inhabitants.
      >
      > As horrible as that is, it's rather useful for GHC's current native
      > generics system. It's possible to use these absurdly polymorphic result
      > kinds to probe the structure of generic representations in a relatively
      > pleasant manner. It's a sort of "formal type application" reminiscent of
      > the notion of a formal power series (see the test case below). I suspect
      > a system more like `kind-generics` wouldn't need this extra probing
      > power, but nothing like that is natively available as yet.
      >
      > If the ridiculous result kind polymorphism is banished, we'll still be
      > able to do what we need as long as we have stuck type families. It's
      > just rather less ergonomical: a stuck type family has to be used with a
      > concrete marker type argument.
      
      Closes #20996
      
      Co-authored-by: Matthew Pickering's avatarMatthew Pickering <matthewtpickering@gmail.com>
      31088dd3
    • Simon Peyton Jones's avatar
      Define and use restoreLclEnv · 18df4013
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      This fixes #20981.  See Note [restoreLclEnv vs setLclEnv]
      in GHC.Tc.Utils.Monad.
      
      I also use updLclEnv rather than get/set when I can, because it's
      then much clearer that it's an update rather than an entirely new
      TcLclEnv coming from who-knows-where.
      18df4013
    • Ryan Scott's avatar
      Expand type synonyms in markNominal · f0adea14
      Ryan Scott authored and  Marge Bot's avatar Marge Bot committed
      `markNominal` is repsonsible for setting the roles of type variables
      that appear underneath an `AppTy` to be nominal. However, `markNominal`
      previously did not expand type synonyms, so in a data type like this:
      
      ```hs
      data M f a = MkM (f (T a))
      
      type T a = Int
      ```
      
      The `a` in `M f a` would be marked nominal, even though `T a` would simply
      expand to `Int`. The fix is simple: call `coreView` as appropriate in
      `markNominal`. This is much like the fix for #14101, but in a different spot.
      
      Fixes #20999.
      f0adea14
    • Simon Peyton Jones's avatar
      Add an Outputable instance for RecTcChecker · 0573aeab
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      0573aeab
    • Simon Peyton Jones's avatar
      Improve partial signatures · f4ce4186
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      As #20921 showed, with partial signatures, it is helpful to use the
      same algorithm (namely findInferredDiff) for
      * picking the constraints to retain for the /group/
        in Solver.decideQuantification
      * picking the contraints to retain for the /individual function/
        in Bind.chooseInferredQuantifiers
      
      This is still regrettably declicate, but it's a step forward.
      f4ce4186
    • Matthew Pickering's avatar
      ci: Add ENABLE_NUMA flag to explicitly turn on libnuma dependency · 6e09b3cf
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      In recent releases a libnuma dependency has snuck into our bindists
      because the images have started to contain libnuma. We now explicitly
      pass `--disable-numa` to configure unless explicitly told not to by
      using the `ENABLE_NUMA` environment variable.
      
      So this is tested, there is one random validate job which builds with
      --enable-numa so that the code in the RTS is still built.
      
      Fixes #20957 and #15444
      6e09b3cf
    • Matthew Pickering's avatar
      ci: Move source-tarball and test-bootstrap into full-build · 3577defb
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      3577defb
    • Roland Senn's avatar
      Cleanup tests in directory ghci.debugger. Fixes #21009 · 4007905d
      Roland Senn authored and  Marge Bot's avatar Marge Bot committed
      * Remove wrong comment about panic in `break003.script`.
      * Improve test `break008`.
      * Add test `break028` to `all.T`
      * Fix wrong comments in `print019.script`, `print026.script` and `result001.script`.
      * Remove wrong comments from `print024.script` and `print031.script`.
      * Replace old module name with current name in `print035.script`.
      4007905d
    • Simon Peyton Jones's avatar
      Better occurrence analysis with casts · ce488c2b
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      This patch addresses #20988 by refactoring the way the
      occurrence analyser deals with lambdas.
      
      Previously it used collectBinders to split off a group of binders,
      and deal with them together.  Now I deal with them one at a time
      in occAnalLam, which allows me to skip casts easily.  See
          Note [Occurrence analysis for lambda binders]
      about "lambda-groups"
      
      This avoidance of splitting out a list of binders has some good
      consequences.  Less code, more efficient, and I think, more clear.
      
      The Simplifier needed a similar change, now that lambda-groups
      can inlude casts.  It turned out that I could simplify the code
      here too, in particular elminating the sm_bndrs field of StrictBind.
      Simpler, more efficient.
      
      Compile-time metrics improve slightly; here are the ones that are
      +/- 0.5% or greater:
      
                                        Baseline
                    Test    Metric         value     New value Change
      --------------------------------------------------------------------
         T11303b(normal) ghc/alloc    40,736,702    40,543,992  -0.5%
          T12425(optasm) ghc/alloc    90,443,459    90,034,104  -0.5%
          T14683(normal) ghc/alloc 2,991,496,696 2,956,277,288  -1.2%
          T16875(normal) ghc/alloc    34,937,866    34,739,328  -0.6%
         T17977b(normal) ghc/alloc    37,908,550    37,709,096  -0.5%
          T20261(normal) ghc/alloc   621,154,237   618,312,480  -0.5%
           T3064(normal) ghc/alloc   190,832,320   189,952,312  -0.5%
           T3294(normal) ghc/alloc 1,604,674,178 1,604,608,264  -0.0%
         T5321FD(normal) ghc/alloc   270,540,489   251,888,480  -6.9% GOOD
        T5321Fun(normal) ghc/alloc   300,707,814   281,856,200  -6.3% GOOD
           WWRec(normal) ghc/alloc   588,460,916   585,536,400  -0.5%
      
               geo. mean                                        -0.3%
      
      Metric Decrease:
          T5321FD
          T5321Fun
      ce488c2b
    • Joachim Breitner's avatar
      Simplifier: Do the right thing if doFloatFromRhs = False · a5924b38
      Joachim Breitner authored and  Marge Bot's avatar Marge Bot committed
      If `doFloatFromRhs` is `False` then the result from `prepareBinding`
      should not be used. Previously it was in ways that are silly (but not
      completly wrong, as the simplifier would clean that up again, so no
      test case).
      
      This was spotted by Simon during a phone call.
      
      Fixes #20976
      a5924b38
    • Zubin's avatar
      hadrian: Allow testing of the stage1 compiler (#20755) · 83d3ad31
      Zubin authored and  Marge Bot's avatar Marge Bot committed
      83d3ad31
    • Matthew Pickering's avatar
      Pass config.stage argument to testsuite · b5132f86
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      b5132f86
    • Matthew Pickering's avatar
      alwaysRerun generation of ghcconfig · c61ac4d8
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      This file needs to match exactly what is passed as the testCompiler.
      Before this change the settings for the first compiler to be tested
      woudl be stored and not regenerated if --test-compiler changed.
      c61ac4d8
    • Simon Peyton Jones's avatar
      Make RULE matching insensitive to eta-expansion · 590a2918
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      This patch fixes #19790 by making the rule matcher do on-the-fly
      eta reduction.  See Note [Eta reduction the target] in GHC.Core.Rules
      
      I found I also had to careful about casts when matching; see
      Note [Casts in the target] and Note [Casts in the template]
      
      Lots more comments and Notes in the rule matcher
      590a2918
  2. 26 Jan, 2022 5 commits
    • sheaf's avatar
      Fix haddock markup in GHC.Tc.Errors.Types · e8405829
      sheaf authored and  Marge Bot's avatar Marge Bot committed
      e8405829
    • sheaf's avatar
      Remove redundant SOURCE import in FitTypes · 61f62062
      sheaf authored and  Marge Bot's avatar Marge Bot committed
      Fixes #20995
      61f62062
    • sheaf's avatar
      Ensure that order of instances doesn't matter · b55d7db3
      sheaf authored and  Marge Bot's avatar Marge Bot committed
      The insert_overlapping used in lookupInstEnv used to return different
      results depending on the order in which instances were processed.
      The problem was that we could end up discarding an overlapping instance
      in favour of a more specific non-overlapping instance. This is a
      problem because, even though we won't choose the less-specific instance
      for matching, it is still useful for pruning away other instances,
      because it has the overlapping flag set while the new instance doesn't.
      
      In insert_overlapping, we now keep a list of "guard" instances, which
      are instances which are less-specific that one that matches (and hence
      which we will discard in the end), but want to keep around solely for
      the purpose of eliminating other instances.
      
      Fixes #20946
      b55d7db3
    • Andreas Klebinger's avatar
      CorePrep: Don't try to wrap partial applications of primops in profiling ticks. · 6e94ba54
      Andreas Klebinger authored and  Marge Bot's avatar Marge Bot committed
      This fixes #20938.
      6e94ba54
    • sheaf's avatar
      Levity-polymorphic arrays and mutable variables · e471a680
      sheaf authored and  Marge Bot's avatar Marge Bot committed
      This patch makes the following types levity-polymorphic in their
      last argument:
      
        - Array# a, SmallArray# a, Weak# b, StablePtr# a, StableName# a
      
        - MutableArray# s a, SmallMutableArray# s a,
          MutVar# s a, TVar# s a, MVar# s a, IOPort# s a
      
      The corresponding primops are also made levity-polymorphic, e.g.
      `newArray#`, `readArray#`, `writeMutVar#`, `writeIOPort#`, etc.
      
      Additionally, exception handling functions such as `catch#`, `raise#`,
      `maskAsyncExceptions#`,... are made levity/representation-polymorphic.
      
      Now that Array# and MutableArray# also work with unlifted types,
      we can simply re-define ArrayArray# and MutableArrayArray# in terms
      of them. This means that ArrayArray# and MutableArrayArray# are no
      longer primitive types, but simply unlifted newtypes around Array# and
      MutableArrayArray#.
      
      This completes the implementation of the Pointer Rep proposal
        https://github.com/ghc-proposals/ghc-proposals/pull/203
      
      Fixes #20911
      
      -------------------------
      Metric Increase:
          T12545
      -------------------------
      
      -------------------------
      Metric Decrease:
          T12545
      -------------------------
      e471a680
  3. 25 Jan, 2022 11 commits
    • Matthew Pickering's avatar
      Widen T12545 acceptance window · 781323a3
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      This test has been the scourge of contributors for a long time.
      
      It has caused many failed CI runs and wasted hours debugging a test
      which barely does anything. The fact is does nothing is the reason for
      the flakiness and it's very sensitive to small changes in initialisation costs,
      in particular adding wired-in things can cause this test to fluctuate
      quite a bit.
      
      Therefore we admit defeat and just bump the threshold up to 10% to catch
      very large regressions but otherwise don't care what this test does.
      
      Fixes #19414
      781323a3
    • Zubin's avatar
      Fix Werror on alpine · 112e9e9e
      Zubin authored and  Marge Bot's avatar Marge Bot committed
      112e9e9e
    • Ryan Scott's avatar
      DeriveGeneric: look up datacon fixities using getDataConFixityFun · 9d478d51
      Ryan Scott authored and  Marge Bot's avatar Marge Bot committed
      Previously, `DeriveGeneric` would look up the fixity of a data constructor
      using `getFixityEnv`, but this is subtly incorrect for data constructors
      defined in external modules. This sort of situation can happen with
      `StandaloneDeriving`, as noticed in #20994. In fact, the same bug has occurred
      in the past in #9830, and while that bug was fixed for `deriving Read` and
      `deriving Show`, the fix was never extended to `DeriveGeneric` due to an
      oversight. This patch corrects that oversight.
      
      Fixes #20994.
      9d478d51
    • Matthew Pickering's avatar
      ci: Move (most) deb9 jobs to deb10 · 871ce2a3
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      deb9 is now end-of-life so we are dropping support for producing
      bindists.
      871ce2a3
    • Peter Trommler's avatar
      testsuite: Mark test that require RTS linker · aa50e118
      Peter Trommler authored and  Marge Bot's avatar Marge Bot committed
      aa50e118
    • Ryan Scott's avatar
      Hadrian: update the index-state to allow building with GHC 9.0.2 · 7d7b9a01
      Ryan Scott authored and  Marge Bot's avatar Marge Bot committed
      Fixes #20984.
      7d7b9a01
    • Ben Gamari's avatar
      ghc-heap: Drop mention of BlockedOnIOCompletion · 4eac8e72
      Ben Gamari authored and  Marge Bot's avatar Marge Bot committed
      Fixes bootstrap with GHC 9.0 after 5a6efd21
      4eac8e72
    • Eric Lindblad's avatar
      links · 9b0d56d3
      Eric Lindblad authored and  Marge Bot's avatar Marge Bot committed
      9b0d56d3
    • Sebastian Graf's avatar
      Write Note [Strict State monad] to explain what G.U.M.State.Strict does · a5c94092
      Sebastian Graf authored and  Marge Bot's avatar Marge Bot committed
      As requested by Simon after review of !7342.
      
      I also took liberty to define the `Functor` instance by hand, as the derived one
      subverts the invariants maintained by the pattern synonym (as already stated in
      `Note [The one-shot state monad trick]`).
      a5c94092
    • Robert Hensing's avatar
      Add test case for C++ exception handling · 5262b1e5
      Robert Hensing authored and  Marge Bot's avatar Marge Bot committed
      5262b1e5
    • Robert Hensing's avatar
      Add -fcompact-unwind · 516eeb9e
      Robert Hensing authored and  Marge Bot's avatar Marge Bot committed
      This gives users the choice to enable __compact_unwind sections
      when linking. These were previously hardcoded to be removed.
      
      This can be used to solved the problem "C++ does not catch
      exceptions when used with Haskell-main and linked by ghc",
      #11829
      
      It does not change the default behavior, because I can not
      estimate the impact this would have.
      
      When Apple first introduced the compact unwind ABI, a number of
      open source projects have taken the easy route of disabling it,
      avoiding errors or even just warnings shortly after its
      introduction.
      
      Since then, about a decade has passed, so it seems quite possible
      that Apple itself, and presumably many programs with it, have
      successfully switched to the new format, to the point where the
      old __eh_frame section support is in disrepair. Perhaps we should
      get along with the program, but for now we can test the waters
      with this flag, and use it to fix packages that need it.
      516eeb9e
  4. 19 Jan, 2022 5 commits
  5. 18 Jan, 2022 5 commits
    • Sergey Vinokurov's avatar
      Improve detection of lld linker · 21510698
      Sergey Vinokurov authored and  Marge Bot's avatar Marge Bot committed
      Newer lld versions may include vendor info in --version output and
      thus the version string may not start with ‘LLD’.
      
      Fixes #20907
      21510698
    • Matthew Pickering's avatar
      Add note about heap invariant · 01254ceb
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      Closed #20904
      01254ceb
    • Ben Gamari's avatar
      rts/winio: Fix #18382 · 5a6efd21
      Ben Gamari authored and  Marge Bot's avatar Marge Bot committed
      Here we refactor WinIO's IO completion scheme, squashing a memory leak
      and fixing #18382.
      To fix #18382 we drop the special thread status introduced for IoPort
      blocking, BlockedOnIoCompletion, as well as drop the non-threaded RTS's
      special dead-lock detection logic (which is redundant to the GC's
      deadlock detection logic), as proposed in #20947.
      
      Previously WinIO relied on foreign import ccall "wrapper" to create an
      adjustor thunk which can be attached to the OVERLAPPED structure passed
      to the operating system. It would then use foreign import ccall
      "dynamic" to back out the original continuation from the adjustor. This
      roundtrip is significantly more expensive than the alternative, using a
      StablePtr. Furthermore, the implementation let the adjustor leak,
      meaning that every IO request would leak a page of memory.
      
      Fixes T18382.
      5a6efd21
    • Sebastian Graf's avatar
      Stricten the Strict State monad · 2d205154
      Sebastian Graf authored and  Marge Bot's avatar Marge Bot committed
      I found it weird that most of the combinators weren't actually strict. Making
      `pure` strict in the state should hopefully give Nested CPR an easier time to
      unbox the nested state.
      2d205154
    • Matthew Pickering's avatar
      Add test for using type families with static pointers · 7ec783de
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      Issue was reported on #13306
      7ec783de