Skip to content
Snippets Groups Projects
  1. Feb 06, 2024
    • Andrei Borzenkov's avatar
      Lazy skolemisation for @a-binders (#17594) · f5d3e03c
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      This patch is a preparation for @a-binders implementation.  The main changes are:
      
      * Skolemisation is now prepared to deal with @binders.
        See Note [Skolemisation overview] in GHC.Tc.Utils.Unify.
        Most of the action is in
          - Utils.Unify.matchExpectedFunTys
          - Gen.Pat.tcMatchPats
          - Gen.Expr.tcPolyExprCheck
          - Gen.Binds.tcPolyCheck
      
      Some accompanying refactoring:
      
      * I found that funTyConAppTy_maybe was doing a lot of allocation, and
        rejigged userTypeError_maybe to avoid calling it.
      f5d3e03c
    • Simon Peyton Jones's avatar
      Refactoring in preparation for lazy skolemisation · e2ea933f
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      
      * Make HsMatchContext and HsStmtContext be parameterised over the
        function name itself, rather than over the pass.
        See [mc_fun field of FunRhs] in Language.Haskell.Syntax.Expr
          - Replace types
              HsMatchContext GhcPs --> HsMatchContextPs
              HsMatchContext GhcRn --> HsMatchContextRn
              HsMatchContext GhcTc --> HsMatchContextRn  (sic! not Tc)
              HsStmtContext  GhcRn --> HsStmtContextRn
          - Kill off convertHsMatchCtxt
      
      * Split GHC.Tc.Type.BasicTypes.TcSigInfo so that TcCompleteSig (describing
        a complete user-supplied signature) is its own data type.
          - Split TcIdSigInfo(CompleteSig, PartialSig) into
              TcCompleteSig(CSig)
              TcPartialSig(PSig)
          - Use TcCompleteSig in tcPolyCheck, CheckGen
          - Rename types and data constructors:
              TcIdSigInfo         --> TcIdSig
              TcPatSynInfo(TPSI)  --> TcPatSynSig(PatSig)
          - Shuffle around helper functions:
              tcSigInfoName           (moved to GHC.Tc.Types.BasicTypes)
              completeSigPolyId_maybe (moved to GHC.Tc.Types.BasicTypes)
              tcIdSigName             (inlined and removed)
              tcIdSigLoc              (introduced)
          - Rearrange the pattern match in chooseInferredQuantifiers
      
      * Rename functions and types:
          tcMatchesCase         --> tcCaseMatches
          tcMatchesFun          --> tcFunBindMatches
          tcMatchLambda         --> tcLambdaMatches
          tcPats                --> tcMatchPats
          matchActualFunTysRho  --> matchActualFunTys
          matchActualFunTySigma --> matchActualFunTy
      
      * Add HasDebugCallStack constraints to:
          mkBigCoreVarTupTy, mkBigCoreTupTy, boxTy,
          mkPiTy, mkPiTys, splitAppTys, splitTyConAppNoView_maybe
      
      * Use `penv` from the outer context in the inner loop of
        GHC.Tc.Gen.Pat.tcMultiple
      
      * Move tcMkVisFunTy, tcMkInvisFunTy, tcMkScaledFunTys down the file,
        factor out and export tcMkScaledFunTy.
      
      * Move isPatSigCtxt down the file.
      
      * Formatting and comments
      
      Co-authored-by: default avatarVladislav Zavialov <vlad.z.4096@gmail.com>
      e2ea933f
  2. Feb 05, 2024
    • Andrei Borzenkov's avatar
      ce90f12f
    • Simon Peyton Jones's avatar
      Add Note [Bangs in Integer functions] · e4d137bb
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      ...to document the bangs in the functions in GHC.Num.Integer
      e4d137bb
    • Simon Peyton Jones's avatar
      Stop dropping a case whose binder is demanded · cfd68290
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR fixes #24251.
      
      See Note [Case-to-let for strictly-used binders]
      in GHC.Core.Opt.Simplify.Iteration, plus #24251, for
      lots of discussion.
      
      Final Nofib changes over 0.1%:
      +-----------------------------------------
      |        imaginary/digits-of-e2    -2.16%
      |                imaginary/rfib    -0.15%
      |                    real/fluid    -0.10%
      |                   real/gamteb    -1.47%
      |                       real/gg    -0.20%
      |                 real/maillist    +0.19%
      |                      real/pic    -0.23%
      |                      real/scs    -0.43%
      |               shootout/n-body    -0.41%
      |        shootout/spectral-norm    -0.12%
      +========================================
      |                     geom mean    -0.05%
      
      Pleasingly, overall executable size is down by just over 1%.
      
      Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the
      geometric mean is -0.1% which seems good.
      cfd68290
  3. Feb 04, 2024
  4. Feb 03, 2024
    • Apoorv Ingle's avatar
      Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. · 5ff7cc26
      Apoorv Ingle authored
      - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206
      
      - The change is detailed in
        - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
        - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr`
               expains the rational of doing expansions in type checker as opposed to in the renamer
      
      - Adds new datatypes:
        - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier
          1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`)
          2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack
      
        - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated
          This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam`
      
        - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc`
      
      - Ensures warnings such as
        1. Pattern match checks
        2. Failable patterns
        3. non-() return in body statements are preserved
      
      - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker`
      
      - Testcases:
        * T18324 T20020 T23147 T22788 T15598 T22086
        * T23147b (error message check),
        * DoubleMatch (match inside a match for pmc check)
        * pattern-fails (check pattern match with non-refutable pattern, eg. newtype)
        * Simple-rec (rec statements inside do statment)
        * T22788 (code snippet from #22788)
        * DoExpanion1 (Error messages for body statments)
        * DoExpansion2 (Error messages for bind statements)
        * DoExpansion3 (Error messages for let statements)
      
      Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass
      
      Metric Increase 'compile_time/bytes allocated':
          T9020
      
      The testcase is a pathalogical example of a `do`-block with many statements that do nothing.
      Given that we are expanding the statements into function binds, we will have to bear
      a (small) 2% cost upfront in the compiler to unroll the statements.
      5ff7cc26
    • Rodrigo Mesquita's avatar
      Work around autotools setting C11 standard in CC/CXX · cdddeb0f
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      In autoconf >=2.70, C11 is set by default for $CC and $CXX via the
      -std=...11 flag. In this patch, we split the "-std" flag out of the $CC
      and $CXX variables, which we traditionally assume to be just the
      executable name/path, and move it to $CFLAGS/$CXXFLAGS instead.
      
      Fixes #24324
      cdddeb0f
    • Matthew Craven's avatar
      Bump bytestring submodule to something closer to 0.12.1 · 27020458
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c
      (which reworks unaligned writes in Builder) and the stuff in
      https://github.com/haskell/bytestring/pull/631 can see wider testing.
      
      The less-terrible code for unaligned writes used in Builder on
      hosts not known to be ulaigned-friendly also takes less effort
      for GHC to compile, resulting in a metric decrease for T21839c
      on some platforms.
      
      The metric increase on T21839r is caused by the unrelated commit
      750dac33465e7b59100698a330b44de7049a345c.  It perhaps warrants
      further analysis and discussion (see #23822) but is not critical.
      
      Metric Decrease:
      T21839c
      Metric Increase:
      T21839r
      27020458
  5. Feb 01, 2024
  6. Jan 31, 2024
  7. Jan 29, 2024
Loading