1. 12 Feb, 2017 10 commits
  2. 11 Feb, 2017 1 commit
  3. 10 Feb, 2017 6 commits
    • Ryan Scott's avatar
      Refactor DeriveAnyClass's instance context inference · 639e702b
      Ryan Scott authored
      Summary:
      Currently, `DeriveAnyClass` has two glaring flaws:
      
      * It only works on classes whose argument is of kind `*` or `* -> *` (#9821).
      * The way it infers constraints makes no sense. It basically co-opts the
        algorithms used to infer contexts for `Eq` (for `*`-kinded arguments) or
        `Functor` (for `(* -> *)`-kinded arguments). This tends to produce overly
        constrained instances, which in extreme cases can lead to legitimate things
        failing to typecheck (#12594). Or even worse, it can trigger GHC panics
        (#12144 and #12423).
      
      This completely reworks the way `DeriveAnyClass` infers constraints to fix
      these two issues. It now uses the type signatures of the derived class's
      methods to infer constraints (and to simplify them). A high-level description
      of how this works is included in the GHC users' guide, and more technical notes
      on what is going on can be found as comments (and a Note) in `TcDerivInfer`.
      
      Fixes #9821, #12144, #12423, #12594.
      
      Test Plan: ./validate
      
      Reviewers: dfeuer, goldfire, simonpj, austin, bgamari
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2961
      639e702b
    • Facundo Domínguez's avatar
      Relax test TH_addCStub2 so it succeeds on travis. · e79ef75d
      Facundo Domínguez authored
      Test Plan: ./validate
      
      Reviewers: bgamari, nomeata, austin, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, rwbarton, mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3124
      e79ef75d
    • Ryan Scott's avatar
      Prevent Template Haskell splices from throwing a spurious TypeInType error · 283a3465
      Ryan Scott authored
      Summary:
      There was a rather annoying corner case where splicing poly-kinded
      Template Haskell declarations could trigger an error muttering about
      `TypeInType` not being enabled, whereas the equivalent non-TH code would
      compile without issue. This was causing by overzealous validity check in the
      renamer, wherein failed to distinguish between two different `Exact` names
      with the same `OccName`. As a result, it mistakenly believed some type
      variables were being used as both type and kind variables simultaneously! Ack.
      
      This avoids the issue by simply disabling the aforementioned validity check
      for Exact names. Fixes #12503.
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3022
      283a3465
    • Simon Peyton Jones's avatar
      Change rewritableTyVarsOfType to anyRewritableTyVar · 76244ec2
      Simon Peyton Jones authored
      This fixes the regression in FrozenErrorTests, eliminates the
      awkward "crash on forall" in rewritableTyVars, and makes it more
      efficient too.
      76244ec2
    • Gabor Greif's avatar
      Spelling in comments [ci skip] · 3211fa06
      Gabor Greif authored
      3211fa06
    • Alan Zimmerman's avatar
      TH-spliced class instances are pretty-printed incorrectly post-#3384 · 258c7195
      Alan Zimmerman authored
      Summary:
      The HsSyn prettyprinter tests patch 499e4382
      broke the pretty-printing of Template Haskell-spliced class instances.
      
      Test Plan: ./validate
      
      Reviewers: RyanGlScott, austin, goldfire, bgamari
      
      Reviewed By: RyanGlScott, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3043
      258c7195
  4. 09 Feb, 2017 9 commits
  5. 08 Feb, 2017 14 commits
    • Ben Gamari's avatar
    • Alan Zimmerman's avatar
      Add dump flags for the renamed and typechecked hsSyn ASTs · 7e4e6a73
      Alan Zimmerman authored
      Summary:
      D2958 brought in the "dump-parsed-ast" functionality.
      
      Extend it to include "dump-rn-ast" and "dump-tc-ast"
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3107
      7e4e6a73
    • Simon Peyton Jones's avatar
      Back-pedal the fix for Trac #8155 · a94b4847
      Simon Peyton Jones authored
      I implemented a rather elaborate fix for #8155 ages ago, which
      which turns out to be
        a) unnecesssary in this particular case
        b) harmful to the defaulting story; see comment:15 of #12923.
      
      So this patch reverts the elaborate bit. The bit I removed is
      described in "Historical note" under Note [approximateWC].
      a94b4847
    • Simon Peyton Jones's avatar
      Kill inaccessible-branch complaints in record update · 3cfef763
      Simon Peyton Jones authored
      Trac #12957 (the original case in the Description) showed a record
      update that yielded an "inaccessible code" warning. This should not
      happen; it's just some redundant code generated by the desugarer (later
      pruned away) and it's not the user's fault.
      
      This patch suppresses the warning.  See Check.hs
      Note [Inaccessible warnings for record updates]
      3cfef763
    • Simon Peyton Jones's avatar
      9f3c1e67
    • Ben Gamari's avatar
      Fix stop_thread unwinding information · 34e35233
      Ben Gamari authored
      This corrects the unwind information for `stg_stop_thread`, which
      allows us to unwind back to the C stack after reaching the end of the 
      STG stack.
      
      Test Plan: Validate
      
      Reviewers: simonmar, austin, erikd
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2746
      34e35233
    • Ben Gamari's avatar
      CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information · 5279b08b
      Ben Gamari authored
      Test Plan: Validate
      
      Reviewers: austin, simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3104
      5279b08b
    • Ben Gamari's avatar
      Cmm: Add support for undefined unwinding statements · 3328ddb8
      Ben Gamari authored
      And use to mark `stg_stack_underflow_frame`, which we are unable to
      determine a caller from.
      
      To simplify parsing at the moment we steal the `return` keyword to
      indicate an undefined unwind value. Perhaps this should be revisited.
      
      Reviewers: scpmw, simonmar, austin, erikd
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2738
      3328ddb8
    • Ben Gamari's avatar
      CmmLayoutStack: Add unwind information on stack fixups · 733e845d
      Ben Gamari authored
      Currently stack fixup blocks don't include unwinding information,
      leaving a small window where our unwinding information is incorrect. Fix
      this by adding unwinding information to emitted fixup blocks.
      
      Reviewers: scpmw, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2742
      733e845d
    • Ben Gamari's avatar
      Generalize CmmUnwind and pass unwind information through NCG · 3eb737ee
      Ben Gamari authored
      As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack
      unwinding information produced by GHC is currently quite approximate.
      Essentially we assume that register values do not change at all within a
      basic block. While this is somewhat true in normal Haskell code, blocks
      containing foreign calls often break this assumption. This results in
      unreliable call stacks, especially in the code containing foreign calls.
      This is worse than it sounds as unreliable unwinding information can at
      times result in segmentation faults.
      
      This patch set attempts to improve this situation by tracking unwinding
      information with finer granularity. By dispensing with the assumption of
      one unwinding table per block, we allow the compiler to accurately
      represent the areas surrounding foreign calls.
      
      Towards this end we generalize the representation of unwind information
      in the backend in three ways,
      
       * Multiple CmmUnwind nodes can occur per block
      
       * CmmUnwind nodes can now carry unwind information for multiple
         registers (while not strictly necessary; this makes emitting
         unwinding information a bit more convenient in the compiler)
      
       * The NCG backend is given an opportunity to modify the unwinding
         records since it may need to make adjustments due to, for instance,
         native calling convention requirements for foreign calls (see
         #11353).
      
      This sets the stage for resolving #11337 and #11338.
      
      Test Plan: Validate
      
      Reviewers: scpmw, simonmar, austin, erikd
      
      Subscribers: qnikst, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2741
      3eb737ee
    • Simon Peyton Jones's avatar
      Improve -dsuppress-coercions · 421308ef
      Simon Peyton Jones authored
      The -dsuppress-coercions flag was being ignored when printing the
      CastIt constructor in SimplUtils.SimplCont.  This fixes ths problem,
      and improves what is printed when suppressing coercions, to show the
      size of the suppressed coercion.
      421308ef
    • Simon Peyton Jones's avatar
      Improve the simple optimiser · 8e9593fb
      Simon Peyton Jones authored
      The previous version of the simple optimiser would leave
      beta-redexes, which was bad for join points.  E.g.
      
        join j x = ....   -- a join point
        in (\x. j x) y
      
      This would be ok if we beta-reduced the (\x) but not if
      we don't.
      
      This patch improves the simple optimiser, to follow the plan
      described in "Secrets of the GHC inliner", and implemented in
      the Mighty Simplifier.  It turns out not to be too hard to
      use the same plan here, and we get slightly better code as
      a result.
      8e9593fb
    • Gabor Greif's avatar
      More typos in comments [skip ci] · b990f656
      Gabor Greif authored
      b990f656
    • Ben Gamari's avatar
      Update hoopl submodule · 512f157c
      Ben Gamari authored
      This is in preparation for an upcoming bump of the containers submodule.
      512f157c