1. 21 Jun, 2017 2 commits
  2. 19 Jun, 2017 4 commits
    • Michal Terepeta's avatar
      cmm/CmmLayoutStack: avoid generating unnecessary reloads · 6a2264d2
      Michal Terepeta authored
      This tries to be more precise when generating reloads of local
      registers in proc points. Previously we'd reload all local registers
      that were live. But we used liveness information that assumed local
      registers survive native calls. For the purpose of reloading registers
      this is an overapproximation and might lead to generating huge amounts
      of unnecessary reloads (in case there's another proc point before the
      register is used).
      
      This change takes the approach of moving the generation of reloads to
      a second pass over the Cmm, which allows to recompute the liveness and
      can use the knowledge that local registers do *not* survive calls.
      This leads to generating only useful reloads. For an extreme example
      where this helps a lot please see T3294. This should also fix #7198
      
      Finally, this re-introduces the code to do Cmm rewriting using in
      `Dataflow` module (with the difference that we know operate on a whole
      block at a time).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Reviewers: austin, bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: kavon, rwbarton, thomie
      
      GHC Trac Issues: #7198
      
      Differential Revision: https://phabricator.haskell.org/D3586
      6a2264d2
    • Douglas Wilson's avatar
      Add test cases for #13821 · 271e0f08
      Douglas Wilson authored
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13821
      
      Differential Revision: https://phabricator.haskell.org/D3642
      271e0f08
    • David Feuer's avatar
      Add T9630 · 23f47b15
      David Feuer authored
      This is not the most precise test, unfortunately, but it does
      demonstrate a modest improvement in compiler residency as a
      result of the specializer don't-loop patch. A rather less
      realistic variation on this has somewhat more dramatic effects.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3656
      23f47b15
    • Ben Gamari's avatar
      testsuite: Add testcase for #13822 · 04ca0360
      Ben Gamari authored
      Reviewers: austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13822
      
      Differential Revision: https://phabricator.haskell.org/D3655
      04ca0360
  3. 18 Jun, 2017 1 commit
  4. 16 Jun, 2017 2 commits
    • Simon Peyton Jones's avatar
      Fix the treatment of 'closed' definitions · dc8e6861
      Simon Peyton Jones authored
      The IdBindingInfo field of ATcId serves two purposes
      
      - to control generalisation when we have -XMonoLocalBinds
      - to check for floatability when dealing with (static e)
      
      These are related, but not the same, and they'd becomme confused.
      Trac #13804 showed this up via an example like this:
      
        f periph = let sr :: forall a. [a] -> [a]
                       sr = if periph then reverse else id
      
                       sr2 = sr
                       -- The question: is sr2 generalised?
                       -- It should be, because sr has a type sig
                       -- even though it has periph free
                   in
                   (sr2 [True], sr2 "c")
      
      Here sr2 should be generalised, despite the free var 'periph'
      in 'sr' because 'sr' has a closed type signature.
      
      I documented all this very carefully this time, in TcRnTypes:
        Note [Meaning of IdBindingInfo]
        Note [Bindings with closed types: ClosedTypeId]
      dc8e6861
    • Ben Gamari's avatar
      base: Validate input in setNumCapabilities · 98494031
      Ben Gamari authored
      Test Plan: validate
      
      Reviewers: austin, hvr, erikd, simonmar
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13832
      
      Differential Revision: https://phabricator.haskell.org/D3652
      98494031
  5. 12 Jun, 2017 5 commits
  6. 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
  7. 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
  8. 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
  9. 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
  10. 31 May, 2017 1 commit
  11. 28 May, 2017 1 commit
  12. 27 May, 2017 2 commits
  13. 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
  14. 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
  15. 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
  16. 20 May, 2017 2 commits