1. 21 Jul, 2016 2 commits
    • Ömer Sinan Ağacan's avatar
      Fix and document Unique generation for sum TyCon and DataCons · 8265c783
      Ömer Sinan Ağacan authored
      Test Plan: validate
      
      Reviewers: bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2420
      8265c783
    • Ömer Sinan Ağacan's avatar
      Implement unboxed sum primitive type · 714bebff
      Ömer Sinan Ağacan authored
      Summary:
      This patch implements primitive unboxed sum types, as described in
      https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes.
      
      Main changes are:
      
      - Add new syntax for unboxed sums types, terms and patterns. Hidden
        behind `-XUnboxedSums`.
      
      - Add unlifted unboxed sum type constructors and data constructors,
        extend type and pattern checkers and desugarer.
      
      - Add new RuntimeRep for unboxed sums.
      
      - Extend unarise pass to translate unboxed sums to unboxed tuples right
        before code generation.
      
      - Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
        code generation when sum values are involved.
      
      - Add user manual section for unboxed sums.
      
      Some other changes:
      
      - Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
        `MultiValAlt` to be able to use those with both sums and tuples.
      
      - Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
        wrong, given an `Any` `TyCon`, there's no way to tell what its kind
        is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.
      
      - Fix some bugs on the way: #12375.
      
      Not included in this patch:
      
      - Update Haddock for new the new unboxed sum syntax.
      
      - `TemplateHaskell` support is left as future work.
      
      For reviewers:
      
      - Front-end code is mostly trivial and adapted from unboxed tuple code
        for type checking, pattern checking, renaming, desugaring etc.
      
      - Main translation routines are in `RepType` and `UnariseStg`.
        Documentation in `UnariseStg` should be enough for understanding
        what's going on.
      
      Credits:
      
      - Johan Tibell wrote the initial front-end and interface file
        extensions.
      
      - Simon Peyton Jones reviewed this patch many times, wrote some code,
        and helped with debugging.
      
      Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
                 simonmar, hvr, erikd
      
      Reviewed By: simonpj
      
      Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
                   thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2259
      714bebff
  2. 20 Jul, 2016 5 commits
    • Ben Gamari's avatar
      Add another testcase for #12082 · 93acc02f
      Ben Gamari authored
      Test Plan: Validate, should pass.
      
      Reviewers: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2399
      
      GHC Trac Issues: #12082
      93acc02f
    • Ben Gamari's avatar
      testsuite: Add regression test for #12381 · a4f2b766
      Ben Gamari authored
      Test Plan: Validate
      
      Reviewers: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2408
      
      GHC Trac Issues: #12381, #11348
      a4f2b766
    • Ben Gamari's avatar
      InstEnv: Ensure that instance visibility check is lazy · ed480981
      Ben Gamari authored
      Previously instIsVisible had completely broken the laziness of
      lookupInstEnv' since it would examine is_dfun_name to check the name of
      the defining module (to know whether it is an interactive module). This
      resulted in the visibility check drawing in an interface file
      unnecessarily. This contributed to the unnecessary regression in
      compiler allocations reported in #12367.
      
      Test Plan: Validate, check nofib changes
      
      Reviewers: simonpj, ezyang, austin
      
      Reviewed By: ezyang
      
      Subscribers: thomie, ezyang
      
      Differential Revision: https://phabricator.haskell.org/D2411
      
      GHC Trac Issues: #12367
      ed480981
    • seraphime's avatar
      Fix bytecode generator panic · 8de6e13f
      seraphime authored
      This fixes #12128.
      
      The bug was introduced in 1c9fd3f1.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, austin, hvr, simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2374
      
      GHC Trac Issues: #12128
      8de6e13f
    • Ömer Sinan Ağacan's avatar
      Support SCC pragmas in declaration context · 98b2c508
      Ömer Sinan Ağacan authored
      Not having SCCs at the top level is becoming annoying real quick. For
      simplest cases, it's possible to do this transformation:
      
          f x y = ...
          =>
          f = {-# SCC f #-} \x y -> ...
      
      However, it doesn't work when there's a `where` clause:
      
          f x y = <t is in scope>
            where t = ...
          =>
          f = {-# SCC f #-} \x y -> <t is out of scope>
            where t = ...
      
      Or when we have a "equation style" definition:
      
          f (C1 ...) = ...
          f (C2 ...) = ...
          f (C3 ...) = ...
          ...
      
      (usual solution is to rename `f` to `f'` and define a new `f` with a
      `SCC`)
      
      This patch implements support for SCC annotations in declaration
      contexts. This is now a valid program:
      
          f x y = ...
            where
              g z = ...
              {-# SCC g #-}
          {-# SCC f #-}
      
      Test Plan: This passes slow validate (no new failures added).
      
      Reviewers: goldfire, mpickering, austin, bgamari, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: simonmar, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2407
      98b2c508
  3. 18 Jul, 2016 4 commits
    • Ryan Scott's avatar
      Make okConIdOcc recognize unboxed tuples · 1fc41d32
      Ryan Scott authored
      Summary:
      `okConIdOcc`, which validates that a type or constructor name is valid
      for splicing using Template Haskell, has a special case for tuples, but
      neglects to look for unboxed tuples, causing some sensible Template Haskell
      code involving unboxed tuples to be rejected.
      
      Fixes #12407.
      
      Test Plan: make test TEST=T12407
      
      Reviewers: austin, bgamari, hvr, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2410
      
      GHC Trac Issues: #12407
      1fc41d32
    • Ryan Scott's avatar
      Fix Template Haskell reification of unboxed tuple types · 514c4a47
      Ryan Scott authored
      Summary:
      Previously, Template Haskell reified unboxed tuple types as boxed
      tuples with twice the appropriate arity.
      
      Fixes #12403.
      
      Test Plan: make test TEST=T12403
      
      Reviewers: hvr, goldfire, austin, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2405
      
      GHC Trac Issues: #12403
      514c4a47
    • Ryan Scott's avatar
      Make DeriveFunctor work with unboxed tuples · 3fa3fe8a
      Ryan Scott authored
      Summary:
      Unboxed tuples have `RuntimeRep` arguments which `-XDeriveFunctor` was
      mistaking for actual data constructor arguments. As a result, a derived
      `Functor` instance for a datatype that contained an unboxed tuple would
      generate twice as many arguments as it needed for an unboxed tuple pattern
      match or expression. The solution is to simply put `dropRuntimeRepArgs` in the
      right place.
      
      Fixes #12399.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, osa1
      
      Differential Revision: https://phabricator.haskell.org/D2404
      
      GHC Trac Issues: #12399
      3fa3fe8a
    • Ryan Scott's avatar
      Fix misspellings of the word "instance" in comments · d213ab3f
      Ryan Scott authored
      [ci skip]
      d213ab3f
  4. 16 Jul, 2016 3 commits
  5. 14 Jul, 2016 1 commit
  6. 13 Jul, 2016 1 commit
  7. 12 Jul, 2016 1 commit
    • Joachim Breitner's avatar
      Demand analyser: Implement LetUp rule (#12370) · 45d8f4eb
      Joachim Breitner authored
      This makes the implementation match the description in the paper more
      closely: There, a let binding that is not a function has first its body
      analised, and then the binding’s RHS. This way, the demand on the bound
      variable by the body can be fed into the RHS, yielding more precise
      results.
      
      Performance measurements do unfortunately not show significant
      improvements or regessions.
      
      Differential Revision: https://phabricator.haskell.org/D2395
      45d8f4eb
  8. 10 Jul, 2016 1 commit
  9. 09 Jul, 2016 1 commit
  10. 08 Jul, 2016 1 commit
    • niteria's avatar
      Use UniqDFM for InstEnv · 04813246
      niteria authored
      Rationale in the comment.
      Also updates submodule array with test output changes.
      
      GHC Trac: #4012
      04813246
  11. 07 Jul, 2016 2 commits
  12. 06 Jul, 2016 1 commit
    • Facundo Domínguez's avatar
      Have addModFinalizer expose the local type environment. · 567dbd9b
      Facundo Domínguez authored
      Summary:
      This annotates the splice point with 'HsSpliced ref e' where 'e' is the
      result of the splice. 'ref' is a reference that the typechecker will fill with
      the local type environment.
      
      The finalizer then reads the ref and uses the local type environment, which
      causes 'reify' to find local variables when run in the finalizer.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, simonmar, bgamari, austin, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: simonmar, thomie, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2286
      
      GHC Trac Issues: #11832
      567dbd9b
  13. 05 Jul, 2016 3 commits
    • Simon Peyton Jones's avatar
      Test Trac #12133 · 6cedef01
      Simon Peyton Jones authored
      6cedef01
    • Simon Peyton Jones's avatar
      Make unique auxiliary function names in deriving · 895eefa8
      Simon Peyton Jones authored
      In deriving for Data, we make some auxiliary functions, but they
      didn't always get distinct names (Trac #12245).  This patch fixes
      it by using the same mechanism as for dictionary functions, namely
      chooseUniqueOccTc.
      
      Some assocated refactoring came along for the ride.
      895eefa8
    • Simon Peyton Jones's avatar
      Check generic-default method for ambiguity · 85aa6ef0
      Simon Peyton Jones authored
      Fixes Trac #7497 and #12151.   In some earlier upheaval I introduced
      a bug in the ambiguity check for genreric-default method.
      
      This patch fixes it.  But in fixing it I realised that the
      sourc-location of any such error message was bogus, so I fixed
      that too, which involved a slightly wider change; see the
      comments with TcMethInfo.
      85aa6ef0
  14. 04 Jul, 2016 2 commits
    • seraphime's avatar
      Treat duplicate pattern synonym signatures as an error · 2a3af152
      seraphime authored
      Fixes issue T12165 by banning duplicate pattern synonyms
      signatures. This seems to me the best solution because:
      
         1) it is coherent with the way we treat other duplicate signatures
      
         2) the typechecker currently doesn't try to apply a second
             signature to a pattern to see if it matches, probably because
             it assumes there is no more than one signature per object.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, mpickering, bgamari
      
      Reviewed By: mpickering, bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2361
      
      GHC Trac Issues: #12165
      2a3af152
    • Ben Gamari's avatar
      testsuite: Add testcase for #12355 · afec447c
      Ben Gamari authored
      Test Plan: Validate
      
      Reviewers: austin, osa1
      
      Reviewed By: osa1
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2377
      
      GHC Trac Issues: #12355
      afec447c
  15. 01 Jul, 2016 1 commit
  16. 30 Jun, 2016 3 commits
  17. 29 Jun, 2016 2 commits
    • thomie's avatar
      Testsuite: use ignore_stderr/stdout instead of ignore_output · 1084d375
      thomie authored
      The problem with ignore_output is that it hides errors for WAY=ghci.
      GHCi always returns with exit code 0 (unless it is broken itself).
      
      For example: ghci015 must have been failing with compile errors for
      years, but we didn't notice because all output was ignored.
      
      Therefore, replace all uses of ignore_output with either ignore_stderr
      or ignore_stdout. In some cases I opted for adding the expected output.
      
      Update submodule hpc and stm.
      
      Reviewed by: simonmar
      
      Differential Revision: https://phabricator.haskell.org/D2367
      1084d375
    • Simon Peyton Jones's avatar
      Test Trac #12185 · 2e9079ff
      Simon Peyton Jones authored
      2e9079ff
  18. 28 Jun, 2016 6 commits
    • Facundo Domínguez's avatar
      Stop the simplifier from removing StaticPtr binds. · dd92c67b
      Facundo Domínguez authored
      Summary:
      We have the FloatOut pass create exported ids for floated StaticPtr
      bindings. The simplifier doesn't try to remove those.
      
      This patch also improves on 7fc20b by making a common definition
      collectStaticPtrSatArgs to test for StaticPtr binds.
      
      Fixes #12207.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, austin, bgamari, simonmar, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2366
      
      GHC Trac Issues: #12207
      dd92c67b
    • Simon Peyton Jones's avatar
      Wibble error message for #11471 · dc62a222
      Simon Peyton Jones authored
      I'm not quite sure why this changed with my two recent commits,
      but it /has/ changed (in a benign way) so I'm accepting it.
      Maybe it wasn't me anyway... but life is short and I'm not inclined
      to dig further.
      dc62a222
    • Simon Peyton Jones's avatar
      Deal correctly with unused imports for 'coerce' · 23b80ac4
      Simon Peyton Jones authored
      We only do newtype unwrapping for Coercible constraints if
      the newtype's data constructor is in scope.  We were trying to
      record the fact that the data constructor was thereby 'used', so
      that an import statement would not be flagged as unnecsssary
      (by -Wunused-imports).
      
      But the code was simply wrong. It was wrong because it assumed
      that only one level of unwrapping happened, whereas
      tcTopNormaliseNewTypeTF_maybe actually unwraps multiple layers.
      So we need to return a /list/ of data constructors that are used.
      
      This entailed a bit of refactoring, as usual.
      
      Fixes Trac #12067
      23b80ac4
    • Simon Peyton Jones's avatar
      Don't omit any evidence bindings · af21e388
      Simon Peyton Jones authored
      This fixes Trac #12156, where we were omitting to make an
      evidence binding (because cec_suppress was on), but yet the
      program was compiled and run.
      
      The fix is easy, and involves deleting code :-).
      af21e388
    • thomie's avatar
      Testsuite: mark tests expect_broken · 3fb9837f
      thomie authored
      * T7837 is still broken for prof_ways (#9406)
      * T11627b is broken on Windows for WAY=prof_hc_hb (#12236)
      * T8089 is also broken for WAY=profasm on Windows
      3fb9837f
    • thomie's avatar
      Testsuite: do not add -debug explicitly in .T file · 0eb03781
      thomie authored
      This prevents `cannot find -lHSrts_debug_p` when running `make
      TEST=T9078 WAY=profasm` (#9078).
      0eb03781