1. 15 Apr, 2021 2 commits
    • Simon Peyton Jones's avatar
      Fix handling ze_meta_tv_env in GHC.Tc.Utils.Zonk · 0a8c14bd
      Simon Peyton Jones authored
      As #19668 showed, there was an /asymptotic/ slow-down in zonking in
      GHC 9.0, exposed in test T9198.  The bug was actually present in earlier
      compilers, but by a fluke didn't actually show up in any of our tests;
      but adding Quick Look exposed it.
      
      The bug was that in zonkTyVarOcc we
      1. read the meta-tyvar-env variable
      2. looked up the variable in the env
      3. found a 'miss'
      4. looked in the variable, found `Indirect ty`
      5. zonked `ty`
      6. update the env *gotten from step 1* to map the variable
         to its zonked type.
      
      The bug is that we thereby threw away all teh work done in step 4.
      In T9198 that made an enormous, indeed asymptotic difference.
      
      The fix is easy: use updTcRef.
      
      I commented in `Note [Sharing when zonking to Type]`
      
      -------------------------
      Metric Decrease:
          T9198
      -------------------------
      0a8c14bd
    • Matthew Pickering's avatar
      hie: Initialise the proper environment for calling dsExpr · da92e728
      Matthew Pickering authored
      We now use DsM as the base monad for writing hie files and properly
      initialise it from the TcGblEnv.
      
      Before, we would end up reading the interface file from disk for the
      module we were currently compiling. The modules iface then ended up in
      the EPS causing all sorts of subtle
      carnage, including difference in the generated core and haddock emitting
      a lot of warnings. With the fix, the
      module in the TcGblEnv is set correctly so the lookups happen in the
      local name env rather than thinking the identifier comes from an
      external package.
      
      Fixes #19693 and #19334
      da92e728
  2. 14 Apr, 2021 6 commits
  3. 13 Apr, 2021 4 commits
  4. 12 Apr, 2021 5 commits
  5. 10 Apr, 2021 16 commits
    • Matthew Pickering's avatar
      Fix magicDict in ghci (and in the presence of other ticks) · 6974c9e4
      Matthew Pickering authored
      The problem was that ghci inserts some ticks around the crucial bit of
      the expression. Just like in some of the other rules we now strip the
      ticks so that the rule fires more reliably.
      
      It was possible to defeat magicDict by using -fhpc as well, so not just an
      issue in ghci.
      
      Fixes #19667 and related to #19673
      6974c9e4
    • Matthew Pickering's avatar
    • Matthew Pickering's avatar
    • Facundo Domínguez's avatar
      Report actual port in libiserv:Remote.Slave.startSlave · b39dec86
      Facundo Domínguez authored
      This allows to start iserv by passing port 0 to startSlave,
      which in turns allows to get an available port when no
      port is known to be free a priori.
      b39dec86
    • John Ericson's avatar
    • John Ericson's avatar
      eb1a86bb
    • Sylvain Henry's avatar
      b699c4fb
    • Sylvain Henry's avatar
      Don't produce platformConstants file · 2cdc95f9
      Sylvain Henry authored
      It isn't used for anything anymore
      2cdc95f9
    • Sylvain Henry's avatar
      Read constants header instead of global platformConstants · 085983e6
      Sylvain Henry authored
      With this patch we switch from reading the globally installed
      platformConstants file to reading the DerivedConstants.h header file
      that is bundled in the RTS unit.  When we build the RTS unit itself, we
      get it from its includes directories.
      
      The new parser is more efficient and strict than the Read instance for
      PlatformConstants and we get about 2.2MB less allocations in every
      cases. However it only really shows in tests that don't allocate much,
      hence the following metric decreases.
      
      Metric Decrease:
          Naperian
          T10421
          T10547
          T12150
          T12234
          T12425
          T13035
          T18304
          T18923
          T5837
          T6048
          T18140
      085983e6
    • Sylvain Henry's avatar
      Generate parser for DerivedConstants.h · 9c762f27
      Sylvain Henry authored
      deriveConstants utility now generates a Haskell parser for
      DerivedConstants.h. It can be used to replace the one used to read
      platformConstants file.
      9c762f27
    • Sylvain Henry's avatar
      Enhance pretty-printing perf · 3f851bbd
      Sylvain Henry authored
      A few refactorings made after looking at Core/STG
      
      * Use Doc instead of SDoc in pprASCII to avoid passing the SDocContext
        that is never used.
      
      * Inline every SDoc wrappers in GHC.Utils.Outputable to expose Doc
        constructs
      
      * Add text/[] rule for empty strings (i.e., text "")
      
      * Use a single occurrence of pprGNUSectionHeader
      
      * Use bangs on Platform parameters and some others
      
      Metric Decrease:
          ManyAlternatives
          ManyConstructors
          T12707
          T13035
          T13379
          T18698a
          T18698b
          T1969
          T3294
          T4801
          T5321FD
          T783
      3f851bbd
    • koz_'s avatar
      Implement list `fold` and `foldMap` via mconcat · 6b1d0b9c
      koz_ authored
      - This allows specialized mconcat implementations an opportunity to combine
        elements efficiently in a single pass.
      
      - Inline the default implementation of `mconcat`, this
        may result in list fusion.
      
      - In Monoids with strict `mappend`, implement `mconcat` as a strict left fold:
      
        * And (FiniteBits)
        * Ior (FiniteBits)
        * Xor (FiniteBits)
        * Iff (FiniteBits)
        * Max (Ord)
        * Min (Ord)
        * Sum (Num)
        * Product (Num)
        * (a -> m) (Monoid m)
      
      - Delegate mconcat for WrappedMonoid to the underlying monoid.
      
      Resolves: #17123
      
      Per the discussion in !4890, we expect some stat changes:
      
          * T17123(normal) run/alloc   403143160.0     4954736.0 -98.8% GOOD
      
            This is the expected improvement in `fold` for a long list of
            `Text` elements.
      
          * T13056(optasm) ghc/alloc   381013328.0   447700520.0 +17.5% BAD
      
            Here there's an extra simplifier run as a result of the new methods
            of the Foldable instance for List.  It looks benign.  The test is
            a micro benchmark that compiles just the derived foldable instances
            for a pair of structures, a cost of this magnitude is not expected
            to extend to more realistic programs.
      
          * T9198(normal) ghc/alloc   504661992.0   541334168.0  +7.3% BAD
      
            This test regressed from 8.10 and 9.0 back to exponential blowup.
            This metric also fluctuates, for reasons not yet clear.  The issue
            here is the exponetial blowup, not this MR.
      
      Metric Decrease:
          T17123
      Metric Increase:
          T9198
          T13056
      6b1d0b9c
    • Richard Eisenberg's avatar
      3c98dda6
    • Richard Eisenberg's avatar
      Clarify commentary around the constraint solver · 449be647
      Richard Eisenberg authored
      No changes to code; no changes to theory. Just better
      explanation.
      449be647
    • Richard Eisenberg's avatar
      Kick out fewer equalities by thinking harder · 7536126e
      Richard Eisenberg authored
      Close #17672.
      
      By scratching our heads quite hard, we realized that
      we should never kick out Given/Nominal equalities. This
      commit tweaks the kick-out conditions accordingly.
      
      See also Note [K4] which describes what is going on.
      
      This does not fix a known misbehavior, but it should be
      a small improvement in both practice (kicking out is bad,
      and we now do less of it) and theory (a Given/Nominal should
      behave just like a filled-in metavariable, which has no notion
      of kicking out).
      7536126e
    • Richard Eisenberg's avatar
      Tweak kick-out condition K2b to deal with LHSs · cd391756
      Richard Eisenberg authored
      Kick out condition K2b really only makes sense for
      inerts with a type variable on the left. This updates
      the commentary and the code to skip this check for
      inerts with type families on the left.
      
      Also cleans up some commentary around solver invariants
      and adds Note [K2b].
      
      Close #19042.
      
      test case: typecheck/should_compile/T19042
      cd391756
  6. 09 Apr, 2021 7 commits