1. 27 Aug, 2018 1 commit
  2. 25 Aug, 2018 1 commit
    • Tamar Christina's avatar
      ghc, ghc-pkg: use getExecutablePath on Windows when base >= 4.11.0 · c523525b
      Tamar Christina authored
      Summary:
      This completes the work started in D4227 by using just 'getExecutablePath'
      in ghc and ghc-pkg when building with base >= 4.11.0.
      
      On the long term, we will be able to simply kill the existing code that
      follows (or not) symlinks and just get this behaviour for free from
      getExecutable. For now we however have to require base >= 4.11.0 to be able
      to just use getExecutablePath under Windows, and use the current code when
      building with an older base.
      
      Original code by @alpmestan commandeering since patch has been stale
      and bug remains open.
      
      Test Plan: Validate
      
      Reviewers: angerman, bgamari, erikd, alpmestan
      
      Reviewed By: bgamari
      
      Subscribers: carter, rwbarton, thomie
      
      GHC Trac Issues: #14483
      
      Differential Revision: https://phabricator.haskell.org/D4229
      c523525b
  3. 24 Aug, 2018 7 commits
    • Simon Peyton Jones's avatar
      Better error reporting for inaccessible code · ff29fc84
      Simon Peyton Jones authored
      This patch fixes Trac #15558.  There turned out to be
      two distinct problems
      
      * In TcExpr.tc_poly_expr_nc we had
      
          tc_poly_expr_nc (L loc expr) res_ty
            = do { traceTc "tcPolyExprNC" (ppr res_ty)
                 ; (wrap, expr')
                     <- tcSkolemiseET GenSigCtxt res_ty $ \ res_ty ->
                        setSrcSpan loc $
                          -- NB: setSrcSpan *after* skolemising,
                          -- so we get better skolem locations
                        tcExpr expr res_ty
      
        Putting the setSrcSpan inside the tcSkolemise means that
        the location on the Implication constraint is the /call/
        to the function rather than the /argument/ to the call,
        and that is really quite wrong.
      
        I don't know what Richard's comment NB means -- I moved the
        setSrcSpan outside, and the "binding site" info in error
        messages actually improved.
      
        The reason I found this is that it affects the span reported
        for Trac #15558.
      
      * In TcErrors.mkGivenErrorReporter we carefully munge the location
        for an insoluble Given constraint (Note [Inaccessible code]).
        But the 'implic' passed in wasn't necesarily the immediately-
        enclosing implication -- but for location-munging purposes
        it jolly well should be.
      
        Solution: use the innermost implication. This actually
        simplifies the code -- no need to pass an implication in to
        mkGivenErrorReporter.
      ff29fc84
    • Simon Peyton Jones's avatar
      Add comments about pretty-printing via IfaceSyn · 4b79329f
      Simon Peyton Jones authored
      Provoked by discussion on Phab:D5097 (Trac #15546), I'm adding
      a big Note explaing the strategy of pretty-printing via IfaceSyn
      4b79329f
    • Simon Peyton Jones's avatar
      Comments only · 1cca4423
      Simon Peyton Jones authored
      1cca4423
    • Simon Peyton Jones's avatar
      Clean up TcHsSyn.zonkEnv · 184a569c
      Simon Peyton Jones authored
      Triggered by Trac #15552, I'd been looking at ZonkEnv in TcHsSyn.
      
      This patch does some minor refactoring
      
      * Make ZonkEnv into a record with named fields, and use them.
        (I'm planning to add a new field, for TyCons, so this prepares
        the way.)
      
      * Replace UnboundTyVarZonker (a higer order function) with the
        simpler and more self-descriptive ZonkFlexi data type, below.
       It's just much more perspicuous and direct, and (I suspect)
       a tiny bit faster too -- no unknown function calls.
      
      data ZonkFlexi   -- See Note [Un-unified unification variables]
        = DefaultFlexi    -- Default unbound unificaiton variables to Any
        | SkolemiseFlexi  -- Skolemise unbound unification variables
                          -- See Note [Zonking the LHS of a RULE]
        | RuntimeUnkFlexi -- Used in the GHCi debugger
      
      There was one knock-on effect in the GHCi debugger -- the
      RuntimeUnkFlexi case.  Somehow previously, these RuntimeUnk
      variables were sometimes getting SystemNames (and hence
      printed as 'a0', 'a1', etc) and sometimes not (and hence
      printed as 'a', 'b' etc).  I'm not sure precisely why, but
      the new behaviour seems more uniform, so I just accepted the
      (small) renaming wibbles in some ghci.debugger tests.
      
      I had a quick look at perf: any changes are tiny.
      184a569c
    • Artem Pelenitsyn's avatar
      Update unicode tables to v. 12 of the standard · 14d88380
      Artem Pelenitsyn authored
      Reviewers: hvr, bgamari, Azel
      
      Reviewed By: bgamari
      
      Subscribers: thomie, Azel, rwbarton, carter
      
      GHC Trac Issues: #5518, #15525
      
      Differential Revision: https://phabricator.haskell.org/D5066
      14d88380
    • Ben Gamari's avatar
    • Ben Gamari's avatar
      TcSimplify: Condense MASSERT2() usage onto a single line · 8d72f878
      Ben Gamari authored
      Sadly macOS's C preprocessor gets angry at the sight of multi-line macro
      invocations.
      8d72f878
  4. 23 Aug, 2018 3 commits
    • Simon Peyton Jones's avatar
      Accommodate API change in transSuperClasses · 4293a80a
      Simon Peyton Jones authored
      In this patch
      
          commit 6eabb6dd
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Tue Dec 15 14:26:13 2015 +0000
      
          Allow recursive (undecidable) superclasses
      
      I changed (transSuperClasses p) to return only the
      superclasses of p, but not p itself. (Previously it always
      returned p as well.)
      
      The use of transSuperClasses in TcErrors.warnRedundantConstraints
      really needs 'p' in the result -- but I faild to fix this
      call site, and instead crippled the test for Trac #10100.
      
      This patch sets things right
      
      * Accomodates the API change
      * Re-enables T10100
      * And thereby fixes Trac #11474
      4293a80a
    • Simon Peyton Jones's avatar
      Comments only · 2a54209f
      Simon Peyton Jones authored
      2a54209f
    • Simon Peyton Jones's avatar
      Fix a typo in TcValidity.checkFamInstRhs · 8c7f90ab
      Simon Peyton Jones authored
      In error message generation we were using the wrong
      type constructor in inst_head.  Result: the type became
      ill-kinded, and that sent the compiler into a loop.
      
      A separate patch fixes the loop. This patch fixes the
      actual bug -- Trac #15473.
      
      I also improved the "occurs more often" error message
      a bit.  But it's still pretty terrible:
      
          * Variable ‘a’ occurs more often
            in the type family application ‘Undefined’
            than in the instance head ‘LetInterleave xs t ts is y z’
      
      It looks like nonsense, but all becomes clear if you use
      -fprint-explicit-kinds.  Really we should fix this by spotting
      when invisible arguments are involved and at least suggesting
      -fprint-explicit-kinds.
      8c7f90ab
  5. 22 Aug, 2018 3 commits
  6. 21 Aug, 2018 24 commits
    • Mitsutoshi Aoe's avatar
      Add traceBinaryEvent# primop · 21f0f561
      Mitsutoshi Aoe authored
      This adds a new primop called traceBinaryEvent# that takes the length
      of binary data and a pointer to the data, then emits it to the eventlog.
      
      There is some example code that uses this primop and the new event:
      
      * [traceBinaryEventIO][1] that calls `traceBinaryEvent#`
      
      * [A patch to ghc-events][2] that parses the new `EVENT_USER_BINARY_MSG`
      
      There's no corresponding issue on Trac but it was discussed at
      ghc-devs [3].
      
      [1] https://github.com/maoe/ghc-trace-events/blob
          /fb226011ef1f85a97b4da7cc9d5f98f9fe6316ae/src/Debug/Trace/Binary.hs#L29)
      [2] https://github.com/maoe/ghc-events/commit
          /239ca77c24d18cdd10d6d85a0aef98e4a7c56ae6)
      [3] https://mail.haskell.org/pipermail/ghc-devs/2018-May/015791.html
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5007
      21f0f561
    • Artem Pelenitsyn's avatar
      docs: "state transformer" -> "state monad" / "ST" (whichever is meant) · 8546afc5
      Artem Pelenitsyn authored
      FIxes #15189.
      
      Reviewers: hvr, bgamari, simonmar, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #15189
      
      Differential Revision: https://phabricator.haskell.org/D5019
      8546afc5
    • Artem Pelenitsyn's avatar
      Fix precision of asinh/acosh/atanh by making them primops · c6f4eb4f
      Artem Pelenitsyn authored
      Reviewers: hvr, bgamari, simonmar, jrtc27
      
      Reviewed By: bgamari
      
      Subscribers: alpmestan, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5034
      c6f4eb4f
    • David Eichmann's avatar
      Correct limb length and assertion for gcdExtInteger · c3315921
      David Eichmann authored
      Reviewers: hvr, bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: monoidal, rwbarton, thomie, carter
      
      GHC Trac Issues: #15350
      
      Differential Revision: https://phabricator.haskell.org/D5042
      c3315921
    • Ömer Sinan Ağacan's avatar
      Properly tag fun field of PAPs generated by ap_0_fast · 2693eb11
      Ömer Sinan Ağacan authored
      Currently ap_0_fast doesn't maintain the invariant for PAP fun fields
      which says if the closure can be tagged, it should be. This is checked
      by `Sanity.c:checkPAP` and correctly implemented by `genautoapply`.
      
      This causes sanity check failures when we have a profiling code like
      
          f = {-# SCC scc #-} g
      
      where g is a PAP or a FUN, and `scc` is different than the current cost
      centre.
      
      Test Plan: Slow validate (not done yet)
      
      Reviewers: simonmar, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15508
      
      Differential Revision: https://phabricator.haskell.org/D5051
      2693eb11
    • Ben Gamari's avatar
      rts: Align the_gc_thread to 64 bytes · 68a1fc29
      Ben Gamari authored
      In a previous attempt (c6cc93bc) I had
      tried aligning to 8 bytes under the assumption that the problem was that
      the_gc_thread, a StgWord8[], wasn't being aligned to 8-bytes as the
      gc_thread struct would expect. However, we actually need even stronger
      alignment due to the alignment attribute attached to gen_workspace,
      which claims it should be aligned to a 64-byte boundary.
      
      This fixes #15482.
      
      Reviewers: erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15482
      
      Differential Revision: https://phabricator.haskell.org/D5052
      68a1fc29
    • Roland Senn's avatar
      Show -with-rtsopts options in runtime's --info (#15261) · dcf27e6f
      Roland Senn authored
      Add an additional line to the output of +RTS --info.  It shows the value
      of the flag -with-rtsopts provided at compile/link time.
      
      Test Plan: make test TESTS="T15261a T15261b"
      
      Reviewers: hvr, erikd, dfeuer, thomie, austin, bgamari, simonmar, osa1,
      monoidal
      
      Reviewed By: osa1, monoidal
      
      Subscribers: osa1, rwbarton, carter
      
      GHC Trac Issues: #15261
      
      Differential Revision: https://phabricator.haskell.org/D5053
      dcf27e6f
    • Alec Theriault's avatar
      Fix ambiguous/out-of-scope Haddock identifiers · ddffa0cd
      Alec Theriault authored
      This drastically cuts down on the number of Haddock warnings when making
      docs for `base`.  Plus this means more actual links end up in the docs!
      Also fixed other small mostly markup issues in the documentation along
      the way.
      
      This is a docs-only change.
      
      Reviewers: hvr, bgamari, thomie
      
      Reviewed By: thomie
      
      Subscribers: thomie, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5055
      ddffa0cd
    • KevinBuhr's avatar
      base: Mark `findIndices` as INLINABLE instead of INLINE (fixes #15426) · 14817621
      KevinBuhr authored
      If `findIndices` is marked INLINE in `Data.OldList`, then the unfolded
      versions of `elemIndex` and `findIndex` included in the interface file
      are unfusible (even though `findIndices` itself remains fusible).  By
      marking it INLINABLE instead, elemIndex` and `findIndex` will fuse
      properly.
      
      Test Plan: make TEST=T15426
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15426
      
      Differential Revision: https://phabricator.haskell.org/D5063
      14817621
    • Ryan Scott's avatar
      rts/RetainerProfile: Dump closure type if pop() fails · 2bacf6f8
      Ryan Scott authored
      While investigating #15529, I noticed that the `barf`ed
      error message in `pop()` doesn't print out the closure type that
      causes it to crash. Let's do so.
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15529
      
      Differential Revision: https://phabricator.haskell.org/D5072
      2bacf6f8
    • Alec Theriault's avatar
      Explicitly tell 'getNameToInstances' mods to load · c971e119
      Alec Theriault authored
      Calculating which modules to load based on the InteractiveContext means
      maintaining a potentially very large GblRdrEnv.
      
      In Haddock's case, it is much cheaper (from a memory perspective) to
      just keep track of which modules interfaces we want loaded then hand
      these off explicitly to 'getNameToInstancesIndex'.
      
      Bumps haddock submodule.
      
      Reviewers: alexbiehl, bgamari
      
      Reviewed By: alexbiehl
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5003
      c971e119
    • Ben Gamari's avatar
      92db10bc
    • Simon Peyton Jones's avatar
      Simplify callSiteInline a little · 8a05836a
      Simon Peyton Jones authored
      This patch has virtually no effect on anything (according to a
      nofib run).  But it simplifies the definition of interesting_call
      by being a bit less gung-ho about inlining nested function
      bindings.  See Note [Nested functions]
      
      -----------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      -----------------------------------------------------------------------
                 anna          +0.2%     -0.0%     0.163     0.163      0.0%
         binary-trees          +0.1%     +0.0%     -4.5%     -4.5%      0.0%
            cacheprof          -0.1%     +0.1%     -4.7%     -4.8%     +2.7%
                fasta          +0.2%      0.0%     +2.6%     +3.0%      0.0%
                fluid          -0.0%     -0.6%     0.011     0.011      0.0%
               gamteb          -0.1%     -0.0%     0.069     0.070      0.0%
                  hpg          +0.1%     +0.0%     +0.7%     +0.7%      0.0%
                infer          +0.3%     +0.2%     0.097     0.098      0.0%
               lambda          -0.1%     -0.0%     +2.0%     +2.0%      0.0%
               n-body          +0.1%     -0.1%     -0.1%     -0.1%      0.0%
               simple          -0.2%     -0.2%     +0.6%     +0.6%      0.0%
        spectral-norm          +0.1%     -0.0%     -0.1%     -0.1%      0.0%
                  tak          -0.0%     -0.1%     0.024     0.024      0.0%
      --------------------------------------------------------------------------------
                  Min          -0.4%     -0.6%     -5.3%     -5.3%      0.0%
                  Max          +0.3%     +0.2%     +3.3%     +3.3%    +15.0%
       Geometric Mean          -0.0%     -0.0%     -0.3%     -0.3%     +0.2%
      
      (cherry picked from commit 33de71fa)
      
      (This reverts the previous reversion in commit
      9dbf66d7)
      8a05836a
    • Roland Senn's avatar
      Introduce flag -keep-hscpp-files · ebcbfba7
      Roland Senn authored
      Test Plan: `make test=T10869`
      
      Reviewers: mpickering, thomie, ezyang, bgamari
      
      Reviewed By: thomie, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #10869
      
      Differential Revision: https://phabricator.haskell.org/D4861
      ebcbfba7
    • Tamar Christina's avatar
      function-section: enable on windows · 23774c98
      Tamar Christina authored
      gc-sections was onced observed to be slow on Windows, which is the only
      reason it's not enabled yet.  However, it seems to be better now.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15051
      
      Differential Revision: https://phabricator.haskell.org/D4916
      23774c98
    • Andreas Klebinger's avatar
      Replace most occurences of foldl with foldl'. · 09c1d5af
      Andreas Klebinger authored
      This patch adds foldl' to GhcPrelude and changes must occurences
      of foldl to foldl'. This leads to better performance especially
      for quick builds where GHC does not perform strictness analysis.
      
      It does change strictness behaviour when we use foldl' to turn
      a argument list into function applications. But this is only a
      drawback if code looks ONLY at the last argument but not at the first.
      And as the benchmarks show leads to fewer allocations in practice
      at O2.
      
      Compiler performance for Nofib:
      
      O2 Allocations:
              -1 s.d.                -----            -0.0%
              +1 s.d.                -----            -0.0%
              Average                -----            -0.0%
      
      O2 Compile Time:
              -1 s.d.                -----            -2.8%
              +1 s.d.                -----            +1.3%
              Average                -----            -0.8%
      
      O0 Allocations:
              -1 s.d.                -----            -0.2%
              +1 s.d.                -----            -0.1%
              Average                -----            -0.2%
      
      Test Plan: ci
      
      Reviewers: goldfire, bgamari, simonmar, tdammers, monoidal
      
      Reviewed By: bgamari, monoidal
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4929
      09c1d5af
    • Ben Sklaroff's avatar
      Fix #line pragmas in nested comments · 02518f9d
      Ben Sklaroff authored
      When parsing a nested comment or nested doc comment in the lexer, if we
      see a line starting with '#' we attempt to parse a #line pragma. This
      fixes how ghc handles output of the C preproccesor (-cpp flag) when the
      original source has C comments or pragmas inside haskell comments.
      
      Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #314
      
      Differential Revision: https://phabricator.haskell.org/D4934
      02518f9d
    • Ben Gamari's avatar
      Fix redundant imports of Class · 966aa781
      Ben Gamari authored
      966aa781
    • Sergei Trofimovich's avatar
      driver: unconditionally disable relaxation when linking partially · 1cc9061f
      Sergei Trofimovich authored
      In https://github.com/gentoo-haskell/gentoo-haskell/issues/704
      user explicitly uses -Wl,--relax for most built binaries.
      
      Most of the time this works fine except for capi haskell code
      similar to the following:
      
      ```haskell
      {-# LANGUAGE CApiFFI #-}
      module Z where
      
      import Foreign.C
      
      foreign import capi "unistd.h close" c_close :: CInt -> IO CInt
      ```
      
      In this case compilation fails as:
      
      ```
      $ inplace/bin/ghc-stage2 -c Z.hs -optl-Wl,--relax -fforce-recomp
      ld: --relax and -r may not be used together
      ```
      
      GHC's driver already disables relaxation on sparc as there relaxation
      is already a default mode.
      
      This change disables relaxation on partial linking for all platforms
      where linker is binutils linker.
      
      Reported-by: wmyrda
      Bug: https://github.com/gentoo-haskell/gentoo-haskell/issues/704Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      
      Test Plan: pass -optl-Wl,--relax in test above
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4888
      1cc9061f
    • Simon Peyton Jones's avatar
      Add a solveEqualities to tcClassDecl1 · 43b08cfb
      Simon Peyton Jones authored
      Trac #15505 showed that, when we have a type error, we
      could have an unfilled-in coercion hole.  We don't want an
      assertion error in that case.
      
      The underlying cause is that tcClassDecl1 should call
      solveEqualities to fully solve all top-level equalities
      (or fail in the attempt).
      
      I also refactored the ClassDecl case for tcTyClDecl1 into
      a new function tcClassDecl1.  That makes it symmetrical
      with the others.
      43b08cfb
    • Simon Peyton Jones's avatar
      Comments only · 828e9493
      Simon Peyton Jones authored
      828e9493
    • Simon Peyton Jones's avatar
      Improve ambiguous-occurrence error message · 18c302cb
      Simon Peyton Jones authored
      Trac #15487 correctly reported that the qualification
      of a Name in an ambiguous-occurrence error message was
      wrong.  This patch fixes it.
      
      It's easily done, in RnUtils.addNameClashErrRn
      
      The problem was that in complaining about M.x we must
      enusre that 'M' part is the same as that used in
      pprNameProvenance.
      18c302cb
    • Simon Peyton Jones's avatar
      Set strictness correctly for JoinIds · ce6ce788
      Simon Peyton Jones authored
      We were failing to keep correct strictness info when eta-expanding
      join points; Trac #15517.   The situation was something like
      
        \q v eta ->
           let j x = error "blah
               -- STR Lx   bottoming!
           in case y of
                 A -> j x eta
                 B -> blah
                 C -> j x eta
      
      So we spot j as a join point and eta-expand it.  But we must
      also adjust the stricness info, else it vlaimes to bottom after
      one arg is applied but now it has become two.
      
      I fixed this in two places:
      
       - In CoreOpt.joinPointBinding_maybe, adjust strictness info
      
       - In SimplUtils.tryEtaExpandRhs, return consistent values
         for arity and bottom-ness
      ce6ce788
    • David Feuer's avatar
      Expose the StableName constructor · 9c4e6c6b
      David Feuer authored
      * Move the definition of `StableName` from `System.Mem.StableName`
        to a new `GHC.StableName` module.
      
      * Expose the `StableName` data constructor from `GHC.StableName`.
        Once we have `UnliftedArray#`, this will enable `StableName`s to
        be stored in `UnliftedArray`s (from `primitive`) without unsafe
        coercions.
      
      Reviewers: hvr, bgamari, andrewthad, osa1
      
      Reviewed By: osa1
      
      Subscribers: osa1, rwbarton, carter
      
      GHC Trac Issues: #15535
      
      Differential Revision: https://phabricator.haskell.org/D5078
      9c4e6c6b
  7. 20 Aug, 2018 1 commit