1. 12 Jun, 2017 4 commits
  2. 08 Jun, 2017 4 commits
    • Douglas Wilson's avatar
      Don't pass -dcore-lint to haddock in Haddock.mk · b10d3f36
      Douglas Wilson authored
      This fixes the regressions in the haddock performance tests introduced
      in c9eb4385.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13789
      
      Differential Revision: https://phabricator.haskell.org/D3629
      b10d3f36
    • Douglas Wilson's avatar
      Refactor temp files cleanup · 3ee3822c
      Douglas Wilson authored
      Remove filesToNotIntermediateClean from DynFlags, create a data type
      FilesToClean, and change filesToClean in DynFlags to be a FilesToClean.
      
      Modify SysTools.newTempName and the Temporary constructor of
      PipelineMonad.PipelineOutput to take a TempFileLifetime, which specifies
      whether a temp file should live until the end of GhcMonad.withSession,
      or until the next time cleanIntermediateTempFiles is called.
      
      These changes allow the cleaning of intermediate files in GhcMake to be
      much more efficient.
      
      HscTypes.hptObjs is removed as it is no longer used.
      
      A new performance test T13701 is added, which passes both with and
      without -keep-tmp-files.  The test fails by 25% without the patch, and
      passes when -keep-tmp-files is added.
      
      Note that there are still at two hotspots caused by
      algorithms quadratic in the number of modules, however neither of them
      allocate. They are:
      
      * DriverPipeline.compileOne'.needsLinker
      * GhcMake.getModLoop
      
      DriverPipeline.compileOne'.needsLinker is changed slightly to improve
      the situation.
      
      I don't like adding these Types to DynFlags, but they need to be seen by
      Dynflags, SysTools and PipelineMonad. The alternative seems to be to
      create a new module.
      
      Reviewers: austin, hvr, bgamari, dfeuer, niteria, simonmar, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13701
      
      Differential Revision: https://phabricator.haskell.org/D3620
      3ee3822c
    • Ben Gamari's avatar
      testsuite: Add performance test, Naperian · 7bb2aa00
      Ben Gamari authored
      This is a module contributed by Austin Seipp which is fairly minimal
      (albeit requiring vector) but is still representative of contemporary
      Haskell.
      
      Reviewers: austin
      
      Subscribers: dfeuer, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3596
      7bb2aa00
    • Simon Marlow's avatar
      Fix a lost-wakeup bug in BLACKHOLE handling (#13751) · 59847290
      Simon Marlow authored
      Summary:
      The problem occurred when
      * Threads A & B evaluate the same thunk
      * Thread A context-switches, so the thunk gets blackholed
      * Thread C enters the blackhole, creates a BLOCKING_QUEUE attached to
        the blackhole and thread A's `tso->bq` queue
      * Thread B updates the blackhole with a value, overwriting the BLOCKING_QUEUE
      * We GC, replacing A's update frame with stg_enter_checkbh
      * Throw an exception in A, which ignores the stg_enter_checkbh frame
      
      Now we have C blocked on A's tso->bq queue, but we forgot to check the
      queue because the stg_enter_checkbh frame has been thrown away by the
      exception.
      
      The solution and alternative designs are discussed in Note [upd-black-hole].
      
      This also exposed a bug in the interpreter, whereby we were sometimes
      context-switching without calling `threadPaused()`.  I've fixed this
      and added some Notes.
      
      Test Plan:
      * `cd testsuite/tests/concurrent && make slow`
      * validate
      
      Reviewers: niteria, bgamari, austin, erikd
      
      Reviewed By: erikd
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13751
      
      Differential Revision: https://phabricator.haskell.org/D3630
      59847290
  3. 07 Jun, 2017 2 commits
    • Simon Peyton Jones's avatar
      Test Trac #13750 · ef07010c
      Simon Peyton Jones authored
      ef07010c
    • Simon Peyton Jones's avatar
      Stop the specialiser generating loopy code · 2b74bd9d
      Simon Peyton Jones authored
      This patch fixes a bad bug in the specialiser, which showed up as
      Trac #13429.  When specialising an imported DFun, the specialiser could
      generate a recusive loop where none existed in the original program.
      
      It's all rather tricky, and I've documented it at some length in
         Note [Avoiding loops]
      
      We'd encoutered exactly this before (Trac #3591) but I had failed
      to realise that the very same thing could happen for /imported/
      DFuns.
      
      I did quite a bit of refactoring.
      
      The compiler seems to get a tiny bit faster on
         deriving/perf/T10858
      but almost all the gain had occurred before now; this
      patch just pushed it over the line.
      2b74bd9d
  4. 05 Jun, 2017 4 commits
    • Alan Zimmerman's avatar
      Udate hsSyn AST to use Trees that Grow · 8e6ec0fa
      Alan Zimmerman authored
      Summary:
      See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
      
      This commit prepares the ground for a full extensible AST, by replacing the type
      parameter for the hsSyn data types with a set of indices into type families,
      
          data GhcPs -- ^ Index for GHC parser output
          data GhcRn -- ^ Index for GHC renamer output
          data GhcTc -- ^ Index for GHC typechecker output
      
      These are now used instead of `RdrName`, `Name` and `Id`/`TcId`/`Var`
      
      Where the original name type is required in a polymorphic context, this is
      accessible via the IdP type family, defined as
      
          type family IdP p
          type instance IdP GhcPs = RdrName
          type instance IdP GhcRn = Name
          type instance IdP GhcTc = Id
      
      These types are declared in the new 'hsSyn/HsExtension.hs' module.
      
      To gain a better understanding of the extension mechanism, it has been applied
      to `HsLit` only, also replacing the `SourceText` fields in them with extension
      types.
      
      To preserve extension generality, a type class is introduced to capture the
      `SourceText` interface, which must be honoured by all of the extension points
      which originally had a `SourceText`.  The class is defined as
      
          class HasSourceText a where
            -- Provide setters to mimic existing constructors
            noSourceText  :: a
            sourceText    :: String -> a
      
            setSourceText :: SourceText -> a
            getSourceText :: a -> SourceText
      
      And the constraint is captured in `SourceTextX`, which is a constraint type
      listing all the extension points that make use of the class.
      
      Updating Haddock submodule to match.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, shayan-najd, goldfire, austin, bgamari
      
      Subscribers: rwbarton, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D3609
      8e6ec0fa
    • Douglas Wilson's avatar
      Desugar modules compiled with -fno-code · c9eb4385
      Douglas Wilson authored
      Previously modules with hscTarget == HscNothing were not desugared.
      This patch changes behavior so that all modules HsSrcFile Modules except GHC.Prim
      are desugared. Modules with hscTarget == HscNothing are not simplified.
      
      Warnings and errors produced by the desugarer will now be produced when
      compiling with -fno-code.
      
      HscMain.finishTypecheckingOnly is removed, HscMain.hscIncrementalCompile is
      simplified a bit, and HscMain.finish takes in the removed logic. I think this
      is easier to follow.
      
      Updates haddock submodule.
      
      Tests T8101, T8101b, T10600 are no longer expect_broken.
      
      Reviewers: ezyang, austin, bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #10600
      
      Differential Revision: https://phabricator.haskell.org/D3542
      c9eb4385
    • Simon Peyton Jones's avatar
      Make the MR warning more accurage · a65dfea5
      Simon Peyton Jones authored
      Trac #13785 showed that we were emitting monomorphism warnings
      when we shouldn't.  The fix turned out to be simple.
      
      In fact test T10935 then turned out to be another example of
      the over-noisy warning so I changed the test slightly.
      a65dfea5
    • Simon Peyton Jones's avatar
      Test Trac #13784 · 6597f084
      Simon Peyton Jones authored
      6597f084
  5. 02 Jun, 2017 3 commits
    • Ryan Scott's avatar
      Make GHCi work when RebindableSyntax is enabled · 2abe54e1
      Ryan Scott authored
      Previously, we were running some blocks of code at the start of every
      GHCi sessions which use do-notation, something which doesn't work well
      if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the
      code to avoid the use of do-notation so that `-XRebindableSyntax` won't
      reject it.
      
      Test Plan: make test TEST=T13385
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13385
      
      Differential Revision: https://phabricator.haskell.org/D3621
      2abe54e1
    • Tamar Christina's avatar
      Better import library support for Windows · 93489cd3
      Tamar Christina authored
      The import library support added for 7.10.3 was only a partial one.
      This support was predicated on using file extensions to determine
      whether or not a library was an import library. It also couldn't handle
      libraries with multiple dll pointers.
      
      This is a rewrite of that patch and fully integrating it into the normal
      archive parsing and loading routines. This solves a host of issues,
      among others allowing us to finally use `-lgcc_s`.
      
      This also fixes a problem with our previous implementation, where we
      just loaded the DLL and moved on. Doing this had the potential of using
      the wrong symbol at resolve time. Say a DLL already loaded (A.dll) has
      symbol a exported (dependency of another dll perhaps).
      
      We find an import library `B.lib` explicitly defining an export of `a`.
      we load `B.dll` but this gets put after `A.dll`, at resolve time we
      would use the value from `A` instead of `B` which is what we wanted.
      
      Test Plan: ./valide and make test TEST=13606
      
      Reviewers: austin, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, RyanGlScott, thomie, #ghc_windows_task_force
      
      GHC Trac Issues: #13606, #12499, #12498
      
      Differential Revision: https://phabricator.haskell.org/D3513
      93489cd3
    • Gabor Greif's avatar
      A few typos [ci skip] · 750a25f4
      Gabor Greif authored
      750a25f4
  6. 31 May, 2017 1 commit
  7. 28 May, 2017 1 commit
  8. 27 May, 2017 2 commits
  9. 26 May, 2017 3 commits
    • Ryan Scott's avatar
      Add regression test for #13758 · c8231408
      Ryan Scott authored
      c8231408
    • Simon Peyton Jones's avatar
      Some tidying up of type pretty-printing · ad14efd5
      Simon Peyton Jones authored
      Triggered by the changes in #13677, I ended up doing a bit of
      refactoring in type pretty-printing.
      
      * We were using TyOpPrec and FunPrec rather inconsitently, so
        I made it consisent.
      
      * That exposed the fact that we were a bit undecided about whether
        to print
           a + b -> c + d   vs   (a+b) -> (c+d)
        and similarly
           a ~ [b] => blah  vs   (a ~ [b]) => blah
      
        I decided to make TyOpPrec and FunPrec compare equal
        (in BasicTypes), so (->) is treated as equal precedence with
        other type operators, so you get the unambiguous forms above,
        even though they have more parens.
      
        We could readily reverse this decision.
        See Note [Type operator precedence] in BasicTypes
      
      * I fixed a bug in pretty-printing of HsType where some
        parens were omitted by mistake.
      ad14efd5
    • Simon Peyton Jones's avatar
      Re-engineer Given flatten-skolems · 8dc6d645
      Simon Peyton Jones authored
      The big change here is to fix an outright bug in flattening of Givens,
      albeit one that is very hard to exhibit.  Suppose we have the constraint
          forall a. (a ~ F b) => ..., (forall c. ....(F b)...) ...
      
      Then
       - we'll flatten the (F) b to a fsk, say  (F b ~ fsk1)
       - we'll rewrite the (F b) inside the inner implication to 'fsk1'
       - when we leave the outer constraint we are suppose to unflatten;
         but that fsk1 will still be there
       - if we re-simplify the entire outer implication, we'll re-flatten
         the Given (F b) to, say, (F b ~ fsk2)
      Now we have two fsks standing for the same thing, and that is very
      wrong.
      
      Solution: make fsks behave more like fmvs:
       - A flatten-skolem is now a MetaTyVar, whose MetaInfo is FlatSkolTv
       - We "fill in" that meta-tyvar when leaving the implication
       - The old FlatSkol form of TcTyVarDetails is gone completely
       - We track the flatten-skolems for the current implication in
         a new field of InertSet, inert_fsks.
      
      See Note [The flattening story] in TcFlatten.
      
      In doing this I found various other things to fix:
      
      * I removed the zonkSimples from TcFlatten.unflattenWanteds; it wasn't
        needed.   But I added one in TcSimplify.floatEqualities, which does
        the zonk precisely when it is needed.
      
      * Trac #13674 showed up a case where we had
           - an insoluble Given,   e.g.  a ~ [a]
           - the same insoluble Wanted   a ~ [a]
        We don't use the Given to rewwrite the Wanted (obviously), but
        we therefore ended up reporting
            Can't deduce (a ~ [a]) from (a ~ [a])
        which is silly.
      
        Conclusion: when reporting errors, make the occurs check "win"
        See Note [Occurs check wins] in TcErrors
      8dc6d645
  10. 25 May, 2017 1 commit
    • Simon Peyton Jones's avatar
      Pattern synonyms and higher rank types · c9977385
      Simon Peyton Jones authored
      This patch fixes two separate bugs which contributed to making
      Trac #13752 go wrong
      
      1.  We need to use tcSubType, not tcUnify,
          in tcCheckPatSynDecl.tc_arg.
      
          Reason: Note [Pattern synonyms and higher rank types]
      
      2.  TcUnify.tc_sub_type had a special case designed to improve error
          messages; see Note [Don't skolemise unnecessarily].  But the
          special case was too liberal, and ended up using unification
          (which led to rejecting the program) when it should instead taken
          the normal path (which accepts the program).
      
          I fixed this by making the test more conservative.
      c9977385
  11. 22 May, 2017 3 commits
    • niteria's avatar
      Testcase for type family consistency checks · 2bc3a057
      niteria authored
      Based on my quick search, we don't have a test
      that verifies that we check the type family instances of
      currently compiled module against direct or indirect
      dependencies.
      
      This adds two tests: for a direct dependency and
      for an indirect dependency.
      
      I also added a comment to make it clear what the 'Over'
      test tests.
      
      Other than completeness, it makes sense to have these
      tests because if you look at
      Note [The type family instance consistency story] in FamInsts
      these cases are checked through different mechanisms.
      
      Test Plan: new tests
      
      Reviewers: simonmar, rwbarton, simonpj, austin, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie
      
      GHC Trac Issues: #13719
      
      Differential Revision: https://phabricator.haskell.org/D3602
      2bc3a057
    • niteria's avatar
      Testcase for #13719 · 17fef390
      niteria authored
      I expect to improve this, a testcase will ensure
      it doesn't regress.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13719
      
      Differential Revision: https://phabricator.haskell.org/D3600
      17fef390
    • Herbert Valerio Riedel's avatar
      Handle file targets in missing home modules warning · dac49bdc
      Herbert Valerio Riedel authored
      When main module is listed on command line as a file, we should not
      issue a warning about it. See Trac #13727
      
      Reviewers: austin, bgamari, Yuras
      
      Reviewed By: bgamari, Yuras
      
      Subscribers: 23Skidoo, rwbarton, thomie
      
      GHC Trac Issues: #13727
      
      Differential Revision: https://phabricator.haskell.org/D3598
      dac49bdc
  12. 20 May, 2017 4 commits
    • Ryan Scott's avatar
      Pretty-print strict record fields from ifaces correctly · 2108460f
      Ryan Scott authored
      We need to use parentheses more when pretty-printing types with bang
      patterns within constructors that use record syntax. Fixes #13699.
      
      Test Plan: make test TEST=T13699
      
      Reviewers: austin, bgamari, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: dfeuer, rwbarton, thomie
      
      GHC Trac Issues: #13699
      
      Differential Revision: https://phabricator.haskell.org/D3587
      2108460f
    • Rufflewind's avatar
      Correctly expand lines with multiple tabs · 86466489
      Rufflewind authored
      rwbarton pointed out that tab expansions can affect the column numbers
      of subsequent characters, so a unstateful map + zip won't do.  This
      commit hopefully fixes that.  It also adds a test for this particular
      case.
      
      Test Plan: validate
      
      Reviewers: bgamari, rwbarton, austin
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3578
      86466489
    • Douglas Wilson's avatar
      Compile modules that are needed by template haskell, even with -fno-code. · 53c78be0
      Douglas Wilson authored
      This patch relates to Trac #8025
      
      The goal here is to enable typechecking of packages that contain some
      template haskell. Prior to this patch, compilation of a package with
      -fno-code would fail if any functions in the package were called from
      within a splice.
      
      downsweep is changed to do an additional pass over the modules,
      targetting any ModSummaries transitively depended on by a module that
      has LangExt.TemplateHaskell enabled. Those targeted modules have
      hscTarget changed from HscNothing to the default target of the platform.
      
      There is a small change to the prevailing_target logic to enable this.
      
      A simple test is added.
      
      I have benchmarked with and without a patched haddock
      (available:https://github.com/duog/haddock/tree/wip-no-explicit-th-compi
      lation).  Running cabal haddock on the wreq package results in a 25%
      speedup on my machine:
      
      time output from patched cabal haddock:
      
      real    0m5.780s
      user    0m5.304s
      sys     0m0.496s
      time output from unpatched cabal haddock:
      
      real    0m7.712s
      user    0m6.888s
      sys     0m0.736s
      
      Reviewers: austin, bgamari, ezyang
      
      Reviewed By: bgamari
      
      Subscribers: bgamari, DanielG, rwbarton, thomie
      
      GHC Trac Issues: #8025
      
      Differential Revision: https://phabricator.haskell.org/D3441
      53c78be0
    • Joachim Breitner's avatar
      Failing test case for #13734 · 0a754e60
      Joachim Breitner authored
      0a754e60
  13. 19 May, 2017 2 commits
    • Simon Peyton Jones's avatar
      Fix scoping of data cons during kind checking · 2501fb70
      Simon Peyton Jones authored
      Trac #13625 pointed out that in
      
         data X :: Y where Y :: X
      
      we need 'Y' to be in scope (as APromotionErr) when dealing with
      X's kind signature.  Previously we got a crash.
      
      This patch simplifies the code as well as making it work.
      2501fb70
    • Simon Peyton Jones's avatar
      Ensure that insolubles are fully rewritten · 433b80de
      Simon Peyton Jones authored
      I was alerted to this by Trac #12468 and #11325.  We were treating
      insolubles (and "hole" constraints are treated as insoluble)
      inconsistently.  In some places we were carefully rewriting them
      e.g. Note [Make sure that insolubles are fully rewritten] in
      TcCanonical.  But in TcSimplify we weren't feeding them into
      the solver.
      
      As a result, "hole" constraints were not being rewritten, which
      some users found confusing, and I think rightly so.
      
      This patch also fixes a bug in TcSMonad.emitInsoluble, in which two
      different "hole" constriants could be treated (bogusly) as duplicates,
      thereby losing one.
      433b80de
  14. 17 May, 2017 2 commits
    • Simon Peyton Jones's avatar
      Handle type-lets better · d6461f96
      Simon Peyton Jones authored
      Core allows non-recursive type-lets, thus
      
         let a = TYPE ty in ...
      
      They are substituted away very quickly, but it's convenient for
      some passes to produce them (rather than to have to substitute
      immediately).
      
      Trac #13708 tried the effect of not running the simplifer at all
      (a rather bizarre thing to do, but still).  That showed that some
      passes crashed because they always treated a let-bounder binder
      as an Id.  This patch adds some easy fixes.
      d6461f96
    • Edward Z. Yang's avatar
      Fix #13703 by correctly using munged names in ghc-pkg. · d9e9a9b3
      Edward Z. Yang authored
      Summary:
      Cabal internal libraries are implemented using a trick, where the 'name'
      field in ghc-pkg registration file is munged into a new form to keep
      each internal library looking like a distinct package to ghc-pkg and
      other tools; e.g. the internal library q from package p is named
      z-p-z-q.
      
      Later, Cabal library got refactored so that we made a closer distinction
      between these "munged" package names and the true package name of a
      package.  Unfortunately, this is an example of a refactor for clarity in
      the source code which ends up causing problems downstream, because the
      point of "munging" the package name was to make it so that ghc-pkg and
      similar tools transparently used MungedPackageName whereever they
      previously used PackageName (in preparation for them learning proper
      syntax for package name + component name).  Failing to do this meant
      that internal libraries from the same package (but with different
      names) clobber each other.
      
      This commit search-replaces most occurrences of PackageName in
      ghc-pkg and turns them into MungedPackageName. Otherwise there
      shouldn't be any functional differenes.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13703
      
      Differential Revision: https://phabricator.haskell.org/D3590
      d9e9a9b3
  15. 16 May, 2017 2 commits
  16. 15 May, 2017 2 commits