1. 10 Jan, 2017 23 commits
    • David Feuer's avatar
      Inline partially-applied wrappers · 2be364ac
      David Feuer authored
      Suppose we have
      
      ```
      data Node a = Node2 !Int a a | Node3 !Int a a a
      instance Traversable Node where
        traverse f (Node2 s x y) = Node2 s <$> f x <*> f y
        ...
      
      ```
      
      Since `Node2` is partially applied, we wouldn't inline its
      wrapper.  The result was that we'd box up the `Int#` to put
      the box in the closure passed to `fmap`. We now allow the wrapper
      to inline when partially applied, so GHC stores the `Int#`
      directly in the closure.
      
      Reviewers: rwbarton, mpickering, simonpj, austin, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2891
      
      GHC Trac Issues: #12990
      2be364ac
    • David Feuer's avatar
      Fix references in let/app invariant note · 8b15fc42
      David Feuer authored
      `mkCoreApp` and `mkCoreLet` have moved since the let/app invariant
      note was written. Update the note to reflect that change.
      
      [skip ci]
      
      Test Plan: Read
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2953
      8b15fc42
    • takano-akio's avatar
      Mark *FB functions INLINE[0] (Fixes #13001) · 09bce7ac
      takano-akio authored
      When fusion rules successfully fire, we are left with calls to
      *FB functions. They are higher-order functions, and therefore they
      often benefit from inlining. This is particularly important when
      then final consumer is a strict fold (foldl', length, etc.), because
      not inlining these functions means allocating a function closure
      for each element in the list, which often is more costly than what
      fusion eliminates.
      
      Nofib shows a slight increase in the binary size:
      
      ------------------------------------------------------------------------
             Program           Size    Allocs   Runtime   Elapsed  TotalMem
      ------------------------------------------------------------------------
         gen_regexps          -0.3%      0.0%     0.000     0.000      0.0%
              puzzle          +0.8%      0.0%     0.089     0.090      0.0%
             reptile          +0.8%     -0.0%     0.008     0.008      0.0%
      ------------------------------------------------------------------------
                 Min          -0.3%     -0.0%     -7.3%     -7.1%      0.0%
                 Max          +0.8%     +0.0%     +7.8%     +7.7%     +1.8%
      Geometric Mean          +0.0%     -0.0%     +0.2%     +0.2%     +0.0%
      ------------------------------------------------------------------------
      
      Reviewers: simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2951
      
      GHC Trac Issues: #13001
      09bce7ac
    • dobenour's avatar
      Don't use the splitter on Darwin · 266a9dc4
      dobenour authored
      Test Plan: GHC CI
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2879
      266a9dc4
    • Rufflewind's avatar
      Fix terminal corruption bug and clean up SDoc interface. · 22845adc
      Rufflewind authored
      - Fix #13076 by wrapping `printDoc_` so that the terminal color is
        reset even if an exception occurs.
      
      - Add `printSDoc`, `printSDocLn`, and `bufLeftRenderSDoc` to keep `SDoc`
        values abstract (they are wrappers of `printDoc_`, `printDoc`, and
        `bufLeftRender` respectively).
      
      - Remove unused function: `printForAsm`
      
      Test Plan: manual
      
      Reviewers: RyanGlScott, austin, dfeuer, bgamari
      
      Reviewed By: dfeuer, bgamari
      
      Subscribers: dfeuer, mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2932
      
      GHC Trac Issues: #13076
      22845adc
    • rwbarton's avatar
      testsuite driver: don't append to existing output files · 35a5b603
      rwbarton authored
      If you happen to have a T1234.run.stdout file lying aroud (probably
      from before the move to running tests in temporary subdirectories)
      it gets symlinked into the T1234.run directory since its name starts
      with T1234; and then program output gets appended to the existing
      file (through the symlink). We should open the file for writing
      instead, to replace the symlink with a new file.
      
      Test Plan: tested locally, + harbormaster
      
      Reviewers: austin, Phyx, bgamari
      
      Reviewed By: Phyx, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2946
      35a5b603
    • Jon Coens's avatar
      Expose purgeObj in ObjLink · c2bd62ed
      Jon Coens authored
      Test Plan: Rebuild GHC under 7.10.2.
      
      Reviewers: niteria, simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2948
      c2bd62ed
    • Steffen Forkmann's avatar
      Fix typo in comment · b1923ed5
      Steffen Forkmann authored
      b1923ed5
    • David Feuer's avatar
      Remove tyConString · 5857dfb8
      David Feuer authored
      `tyConString` has been deprecated since GHC 7.4. It's time for it to go.
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2950
      
      GHC Trac Issues: #13096
      5857dfb8
    • David Feuer's avatar
      Remove deprecated InteractiveEval API · eee81994
      David Feuer authored
      Remove `RunResult(..)`, `runStmt`, and `runStmtWithLocation`.  These
      were all deprecated and documented as slated for removal in GHC 7.14,
      which I figure means 8.2.
      
      See cf7573b8 for an explanation of why
      this change was made.
      
      Reviewers: simonpj, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2949
      
      GHC Trac Issues: #13095
      eee81994
    • Ben Gamari's avatar
      event manager: Don't worry if attempt to wake dead manager fails · 6de76136
      Ben Gamari authored
      This fixes #12038, where the TimerManager would attempt to wake up a
      manager that was already dead, resulting in setnumcapabilities001
      occassionally failing during shutdown with unexpected output on stderr.
      
      I'm frankly still not entirely confident in this solution but perhaps it
      will help to get a few more eyes on this.
      
      My hypothesis is that the TimerManager is racing:
      
        thread                   TimerManager worker
        -------                  --------------------
        requests that thread
        manager shuts down
      
                                 begins to clean up,
                                 closing eventfd
      
        calls wakeManager,
        which tries to write
        to closed eventfd
      
      To prevent this `wakeManager` will need to synchronize with the
      TimerManger worker to ensure that the worker doesn't clean up the
      `Control` while another thread is trying to send a wakeup. However, this
      would add a bit of overhead on every timer interaction, which feels
      rather costly for what is really a problem only at shutdown.  Moreover,
      it seems that the event manager (e.g.  `GHC.Event.Manager`) is also
      afflicted by a similar race.
      
      This patch instead simply tries to catch the write failure after it has
      happened and silence it in the case that the fd has vanished. It feels
      rather hacky but it seems to work.
      
      Test Plan: Run `setnumcapabilities001` repeatedly
      
      Reviewers: austin, hvr, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2926
      
      GHC Trac Issues: #12038
      6de76136
    • Chris Martin's avatar
      Add doc header to Dynamic's re-export of Typeable · fe8bc14f
      Chris Martin authored
      Data.Data and Data.Dynamic both re-export Data.Typeable with the same
      comment, though in the Data module the comment is a haddock header, and
      in Typeable it is not. I assume the inconsistency was a mistake.
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2923
      fe8bc14f
    • Ben Gamari's avatar
      users-guide: Produce OpenSearch description · 89d4d261
      Ben Gamari authored
      Reviewers: austin, hsyl20
      
      Reviewed By: hsyl20
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2921
      89d4d261
    • dobenour's avatar
      Enable subsections via symbols on iOS · 58e68b37
      dobenour authored
      Test Plan: GHC CI
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2915
      
      GHC Trac Issues: #11040, #13049
      58e68b37
    • johnleo's avatar
      Check that type variable does not reference itself in its kind signature · 8a76d32e
      johnleo authored
      This fixes #11592.
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, bgamari, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2914
      
      GHC Trac Issues: #11592
      8a76d32e
    • shlevy's avatar
      base: Add Foreign.ForeignPtr.plusForeignPtr. · 226c5352
      shlevy authored
      Reviewers: simonmar, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2900
      226c5352
    • dobenour's avatar
      Throw an exception on heap overflow · 12ad4d41
      dobenour authored
      This changes heap overflow to throw a HeapOverflow exception instead of
      killing the process.
      
      Test Plan: GHC CI
      
      Reviewers: simonmar, austin, hvr, erikd, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2790
      
      GHC Trac Issues: #1791
      12ad4d41
    • Ben Gamari's avatar
      e8d74321
    • Ben Gamari's avatar
      fe75d2d4
    • dobenour's avatar
      -dead_strip is now the default on Darwin · 0a6c257d
      dobenour authored
      This enables subsections-via-symbols (-dead_strip) by default on Darwin.
      The Static Reference Table (SRT) needs to be split in order for
      -dead_strip to be helpful, so this commit always splits it on Darwin
      systems.
      
      Test Plan: GHC CI on Darwin
      
      Reviewers: erikd, austin, bgamari
      
      Reviewed By: erikd, bgamari
      
      Subscribers: erikd, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2911
      
      GHC Trac Issues: #11040, #13049
      0a6c257d
    • Ryan Scott's avatar
      Properly detect MinTTY when running GHCi on Windows · 6fe9b057
      Ryan Scott authored
      Before, we detecting the presence of MinTTY on Windows in a very
      imprecise way: by checking if the `_` environment variable was set. Not
      only is this easy to circumvent, but it also yields false positives on
      terminals like ConEmu.
      
      This changes the test to use the `GetFileInformationByHandleEx` function
      instead, which provides a far more accurate check for MinTTY's presence.
      I've tested this on PowerShell, MSYS2, Cygwin, ConEmu, and Git Bash, and
      it does the right thing on each one.
      
      Fixes #12958.
      
      Test Plan: Run GHCi on many different Windows and MinTTY consoles
      
      Reviewers: erikd, Phyx, austin, bgamari
      
      Reviewed By: Phyx, bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2878
      
      GHC Trac Issues: #12958
      6fe9b057
    • Ben Gamari's avatar
      CmmCommonBlockElim: Ignore CmmUnwind nodes · e94b07dc
      Ben Gamari authored
      We don't want unwind information to affect the code we produce.
      Consequently we need to ensure that CBE ignores unwind nodes for the
      purposes of equality.
      
      Test Plan: Validate
      
      Reviewers: scpmw, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2739
      e94b07dc
    • Alan Zimmerman's avatar
      Make HsIParamTy have a Located HsIPName · 1a6bdca0
      Alan Zimmerman authored
      To simplify API Annotations.
      
      Updates haddock submodule
      1a6bdca0
  2. 09 Jan, 2017 2 commits
  3. 08 Jan, 2017 1 commit
    • Ömer Sinan Ağacan's avatar
      Parse holes as infix operators · 6c869f90
      Ömer Sinan Ağacan authored
      Reported as #13050. Since holes are expressions but not identifiers,
      holes were not allowed in infix operator position. This patch introduces
      a new production in infix operator parser to allow this.
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, RyanGlScott, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2910
      
      GHC Trac Issues: #13050
      6c869f90
  4. 07 Jan, 2017 1 commit
  5. 06 Jan, 2017 10 commits
    • Facundo Domínguez's avatar
      Have addModFinalizer expose the local type environment. · c1ed9557
      Facundo Domínguez authored
      Kind inference in ghci was interfered when renaming of type splices
      introduced the HsSpliced data constructor. This patch has kind
      inference skip over it.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, rrnewton, bgamari, goldfire, austin
      
      Subscribers: thomie, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2886
      
      GHC Trac Issues: #12985
      c1ed9557
    • Facundo Domínguez's avatar
      c5452cc1
    • Matthew Pickering's avatar
      54227a45
    • Facundo Domínguez's avatar
      Have addModFinalizer expose the local type environment. · e5d1ed9c
      Facundo Domínguez authored
      Summary:
      Kind inference in ghci was interfered when renaming of type splices
      introduced the HsSpliced data constructor. This patch has kind
      inference skip over it.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, rrnewton, austin, goldfire, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2886
      
      GHC Trac Issues: #12985
      e5d1ed9c
    • Matthew Pickering's avatar
      Add missing stderr file for T13035 · f3c7cf9b
      Matthew Pickering authored
      f3c7cf9b
    • Simon Marlow's avatar
      More fixes for #5654 · 3a18baff
      Simon Marlow authored
      * In stg_ap_0_fast, if we're evaluating a thunk, the thunk might
        evaluate to a function in which case we may have to adjust its CCS.
      
      * The interpreter has its own implementation of stg_ap_0_fast, so we
        have to do the same shenanigans with creating empty PAPs and copying
        PAPs there.
      
      * GHCi creates Cost Centres as children of CCS_MAIN, which enterFunCCS()
        wrongly assumed to imply that they were CAFs.  Now we use the is_caf
        flag for this, which we have to correctly initialise when we create a
        Cost Centre in GHCi.
      3a18baff
    • Ryan Scott's avatar
      Add performance test for #13056 · 50881100
      Ryan Scott authored
      This performance regression was fixed by commit
      517d03e4 (#12234). Let's add a performance test
      to ensure that it doesn't break again.
      50881100
    • Simon Peyton Jones's avatar
      Fix the implementation of the "push rules" · b4f2afe7
      Simon Peyton Jones authored
      Richard pointed out (comment:12 of Trac #13025) that my
      implementation of the coercion "push rules", newly added
      in exprIsConAppMaybe by commit b4c3a668, wasn't quite right.
      
      But in fact that means that the implementation of those same
      rules in Simplify.simplCast was wrong too.
      
      Hence this commit:
      
      * Refactor the push rules so they are implemented in just
        one place (CoreSubst.pushCoArgs, pushCoTyArg, pushCoValArg)
        The code in Simplify gets simpler, which is nice.
      
      * Fix the bug that Richard pointed out (to do with hetero-kinded
        coercions)
      
      Then compiler performance worsened, which led mt do discover
      two performance bugs:
      
      * The smart constructor Coercion.mkNthCo didn't have a case
        for ForAllCos, which meant we stupidly build a complicated
        coercion where a simple one would do
      
      * In OptCoercion there was one place where we used CoherenceCo
        (the data constructor) rather than mkCoherenceCo (the smart
        constructor), which meant that the the stupid complicated
        coercion wasn't optimised away
      
      For reasons I don't fully understand, T5321Fun did 2% less compiler
      allocation after all this, which is good.
      b4f2afe7
    • Simon Peyton Jones's avatar
      Avoid exponential blowup in FamInstEnv.normaliseType · 3540d1e1
      Simon Peyton Jones authored
      Trac #13035 showed up a nasty case where we took exponentially
      long to normalise a (actually rather simple) type.  Fortunately
      it was easy to fix: see Note [Normalisation and type synonyms].
      3540d1e1
    • Simon Peyton Jones's avatar
      Use the right in-scope set · e6aefd6e
      Simon Peyton Jones authored
      I tripped over these calls to substTyWith that didn't obey the
      precondition about in-scope variables.  Easily fixed, happily.
      e6aefd6e
  6. 05 Jan, 2017 3 commits