1. 26 Jan, 2017 1 commit
    • Matthew Pickering's avatar
      COMPLETE pragmas for enhanced pattern exhaustiveness checking · 1a3f1eeb
      Matthew Pickering authored
      This patch adds a new pragma so that users can specify `COMPLETE` sets of
      `ConLike`s in order to sate the pattern match checker.
      
      A function which matches on all the patterns in a complete grouping
      will not cause the exhaustiveness checker to emit warnings.
      
      ```
      pattern P :: ()
      pattern P = ()
      
      {-# COMPLETE P #-}
      
      foo P = ()
      ```
      
      This example would previously have caused the checker to warn that
      all cases were not matched even though matching on `P` is sufficient to
      make `foo` covering. With the addition of the pragma, the compiler
      will recognise that matching on `P` alone is enough and not emit
      any warnings.
      
      Reviewers: goldfire, gkaracha, alanz, austin, bgamari
      
      Reviewed By: alanz
      
      Subscribers: lelf, nomeata, gkaracha, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2669
      
      GHC Trac Issues: #8779
      1a3f1eeb
  2. 23 Jan, 2017 1 commit
  3. 13 Jan, 2017 1 commit
  4. 06 Jan, 2017 2 commits
  5. 23 Dec, 2016 1 commit
  6. 16 Dec, 2016 1 commit
  7. 29 Nov, 2016 1 commit
  8. 14 Oct, 2016 1 commit
    • Ben Gamari's avatar
      Clean up handling of known-key Names in interface files · 34d933d6
      Ben Gamari authored
      Previously BinIface had some dedicated logic for handling tuple names in
      the symbol table. As it turns out, this logic was essentially dead code
      as it was superceded by the special handling of known-key things. Here
      we cull the tuple code-path and use the known-key codepath for all
      tuple-ish things.
      
      This had a surprising number of knock-on effects,
      
       * constraint tuple datacons had to be made known-key (previously they
         were not)
      
       * IfaceTopBndr was changed from being a synonym of OccName to a
         synonym of Name (since we now need to be able to deserialize Names
         directly from interface files)
      
       * the change to IfaceTopBndr complicated fingerprinting, since we need
         to ensure that we don't go looking for the fingerprint of the thing
         we are currently fingerprinting in the fingerprint environment (see
         notes in MkIface). Handling this required distinguishing between
         binding and non-binding Name occurrences in the Binary serializers.
      
       * the original name cache logic which previously lived in IfaceEnv has
         been moved to a new NameCache module
      
       * I ripped tuples and sums out of knownKeyNames since they introduce a
         very large number of entries. During interface file deserialization
         we use static functions (defined in the new KnownUniques module) to
         map from a Unique to a known-key Name (the Unique better correspond
         to a known-key name!) When we need to do an original name cache
         lookup we rely on the parser implemented in isBuiltInOcc_maybe.
      
       * HscMain.allKnownKeyNames was folded into PrelInfo.knownKeyNames.
      
       * Lots of comments were sprinkled about describing the new scheme.
      
      Updates haddock submodule.
      
      Test Plan: Validate
      
      Reviewers: niteria, simonpj, austin, hvr
      
      Reviewed By: simonpj
      
      Subscribers: simonmar, niteria, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2467
      
      GHC Trac Issues: #12532, #12415
      34d933d6
  9. 21 Aug, 2016 1 commit
  10. 05 Jul, 2016 2 commits
    • Simon Peyton Jones's avatar
      Tidy up tidying · cbe30fda
      Simon Peyton Jones authored
      This is a tiny refactor, replacing an ad-hoc local function
      (TidyPgm.loookup_aux_id) with a solid global one (tidyVarOcc).
      cbe30fda
    • niteria's avatar
      Use DVarEnv for vectInfoVar · 55e43a6f
      niteria authored
      This makes sure that we don't introduce unnecessary
      nondeterminism from vectorization.
      
      Also updates dph submodule to reflect the change in types.
      
      GHC Trac: #4012
      55e43a6f
  11. 01 Jul, 2016 1 commit
  12. 28 Jun, 2016 1 commit
    • 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
  13. 09 Jun, 2016 1 commit
    • Edward Z. Yang's avatar
      Fix #12076 by inlining trivial expressions in CorePrep. · 11ff1df8
      Edward Z. Yang authored
      Summary:
      This mostly follows the plan detailed by the discussion
      Simon and I had, with one difference: instead of grabbing
      the free variables of the trivial expressions to get the
      embedded Ids, we just use getIdFromTrivialExpr_maybe to extract
      out the Id.  If there is no Id, the expression cannot
      refer to a function (as there are no literal functions)
      and thus we do not need to saturate.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2309
      
      GHC Trac Issues: #12076
      11ff1df8
  14. 07 Jun, 2016 1 commit
    • niteria's avatar
      Make vectInfoParallelVars a DVarSet · 5db93d2e
      niteria authored
      We dump it in the interface file, so we need to do it in a
      deterministic order. I haven't seen any problems with this
      during my testing, but that's probably because it's unused.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2313
      
      GHC Trac Issues: #4012
      5db93d2e
  15. 10 May, 2016 1 commit
  16. 02 May, 2016 1 commit
    • Facundo Domínguez's avatar
      StaticPointers: Allow closed vars in the static form. · 36d29f7c
      Facundo Domínguez authored
      Summary:
      With this patch closed variables are allowed regardless of whether
      they are bound at the top level or not.
      
      The FloatOut pass is always performed. When optimizations are
      disabled, only expressions that go to the top level are floated.
      Thus, the applications of the StaticPtr data constructor are always
      floated.
      
      The CoreTidy pass makes sure the floated applications appear in the
      symbol table of object files. It also collects the floated bindings
      and inserts them in the static pointer table.
      
      The renamer does not check anymore if free variables appearing in the
      static form are top-level. Instead, the typechecker looks at the
      tct_closed flag to decide if the free variables are closed.
      
      The linter checks that applications of StaticPtr only occur at the
      top of top-level bindings after the FloatOut pass.
      
      The field spInfoName of StaticPtrInfo has been removed. It used to
      contain the name of the top-level binding that contains the StaticPtr
      application. However, this information is no longer available when the
      StaticPtr is constructed, as the binding name is determined now by the
      FloatOut pass.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, mpickering, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2104
      
      GHC Trac Issues: #11656
      36d29f7c
  17. 15 Apr, 2016 1 commit
    • niteria's avatar
      Kill some unnecessary varSetElems · 928d7473
      niteria authored
      When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to
      `tyCoVarsOfTypeList x`.
      
      Why? If you look at the implementation:
      ```
      tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty
      tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty
      ```
      they use the same helper function. The helper function returns a
      deterministically ordered list and a set. The only difference
      between the two is which part of the result they take. It is redundant
      to take the set and then immediately convert it to a list.
      
      This helps with determinism and we eventually want to replace the uses
      of `varSetElems` with functions that don't leak the values of uniques.
      This change gets rid of some instances that are easy to kill.
      
      I chose not to annotate every place where I got rid of `varSetElems`
      with a comment about non-determinism, because once we get rid of
      `varSetElems` it will not be possible to do the wrong thing.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, simonmar, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2115
      
      GHC Trac Issues: #4012
      928d7473
  18. 29 Mar, 2016 1 commit
    • Joachim Breitner's avatar
      Rename isNopSig to isTopSig · e6e17a09
      Joachim Breitner authored
      to be consistent with the other uses of nop vs. top in Demand.hs. Also,
      stop prettyprinting top strictness signatures in Core dumps.
      e6e17a09
  19. 24 Mar, 2016 1 commit
    • Ben Gamari's avatar
      ErrUtils: Add timings to compiler phases · 8048d51b
      Ben Gamari authored
      This adds timings and allocation figures to the compiler's output when
      run with `-v2` in an effort to ease performance analysis.
      
      Todo:
        * Documentation
        * Where else should we add these?
        * Perhaps we should remove some of the now-arguably-redundant
          `showPass` occurrences where they are
        * Must we force more?
        * Perhaps we should place this behind a `-ftimings` instead of `-v2`
      
      Test Plan: `ghc -v2 Test.hs`, look at the output
      
      Reviewers: hvr, goldfire, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: angerman, michalt, niteria, ezyang, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1959
      8048d51b
  20. 25 Feb, 2016 1 commit
    • barrucadu's avatar
      Print which warning-flag controls an emitted warning · bb5afd3c
      barrucadu authored
      Both gcc and clang tell which warning flag a reported warning can be
      controlled with, this patch makes ghc do the same. More generally, this
      allows for annotated compiler output, where an optional annotation is
      displayed in brackets after the severity.
      
      This also adds a new flag `-f(no-)show-warning-groups` to control
      whether to show which warning-group (such as `-Wall` or `-Wcompat`)
      a warning belongs to. This flag is on by default.
      
      This implements #10752
      
      Reviewed By: quchen, bgamari, hvr
      
      Differential Revision: https://phabricator.haskell.org/D1943
      bb5afd3c
  21. 11 Feb, 2016 2 commits
  22. 08 Feb, 2016 1 commit
  23. 18 Jan, 2016 1 commit
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  24. 31 Dec, 2015 1 commit
  25. 17 Oct, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Make Monad/Applicative instances MRP-friendly · e8ed2136
      Herbert Valerio Riedel authored
      This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e.
      such that the explicit definitions for `return` and `(>>)` match the
      MRP-style default-implementation, i.e.
      
        return = pure
      
      and
      
        (>>) = (*>)
      
      This way, e.g. all `return = pure` definitions can easily be grepped and
      removed in GHC 8.1;
      
      Test Plan: Harbormaster
      
      Reviewers: goldfire, alanz, bgamari, quchen, austin
      
      Reviewed By: quchen, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1312
      e8ed2136
  26. 15 Oct, 2015 1 commit
  27. 10 Oct, 2015 1 commit
  28. 21 Aug, 2015 1 commit
    • thomie's avatar
      Delete FastBool · 3452473b
      thomie authored
      This reverses some of the work done in Trac #1405, and assumes GHC is
      smart enough to do its own unboxing of booleans now.
      
      I would like to do some more performance measurements, but the code
      changes can be reviewed already.
      
      Test Plan:
      With a perf build:
      ./inplace/bin/ghc-stage2 nofib/spectral/simple/Main.hs -fforce-recomp
      +RTS -t --machine-readable
      
      before:
      ```
        [("bytes allocated", "1300744864")
        ,("num_GCs", "302")
        ,("average_bytes_used", "8811118")
        ,("max_bytes_used", "24477464")
        ,("num_byte_usage_samples", "9")
        ,("peak_megabytes_allocated", "64")
        ,("init_cpu_seconds", "0.001")
        ,("init_wall_seconds", "0.001")
        ,("mutator_cpu_seconds", "2.833")
        ,("mutator_wall_seconds", "4.283")
        ,("GC_cpu_seconds", "0.960")
        ,("GC_wall_seconds", "0.961")
        ]
      ```
      
      after:
      ```
        [("bytes allocated", "1301088064")
        ,("num_GCs", "310")
        ,("average_bytes_used", "8820253")
        ,("max_bytes_used", "24539904")
        ,("num_byte_usage_samples", "9")
        ,("peak_megabytes_allocated", "64")
        ,("init_cpu_seconds", "0.001")
        ,("init_wall_seconds", "0.001")
        ,("mutator_cpu_seconds", "2.876")
        ,("mutator_wall_seconds", "4.474")
        ,("GC_cpu_seconds", "0.965")
        ,("GC_wall_seconds", "0.979")
        ]
      ```
      
      CPU time seems to be up a bit, but I'm not sure. Unfortunately CPU time
      measurements are rather noisy.
      
      Reviewers: austin, bgamari, rwbarton
      
      Subscribers: nomeata
      
      Differential Revision: https://phabricator.haskell.org/D1143
      
      GHC Trac Issues: #1405
      3452473b
  29. 16 Jul, 2015 1 commit
  30. 01 Jun, 2015 1 commit
  31. 22 May, 2015 1 commit
  32. 10 Feb, 2015 1 commit
  33. 28 Jan, 2015 1 commit
  34. 17 Dec, 2014 2 commits
    • Simon Peyton Jones's avatar
      Improve TidyPgm.hasCafRefs to account for Integer literals (Trac #8525) · 6b11bab6
      Simon Peyton Jones authored
      See Note [Disgusting computation of CafRefs] in TidyPgm.
      
      Also affects CoreUtils.rhsIsStatic.
      
      The real solution here is to compute CAF and arity information
      from the STG-program, and feed it back to tidied program for
      the interface file and later GHCi clients.  A battle for another
      day.
      
      But at least this commit reduces the number of gratuitous CAFs, and
      hence SRT entries.  And kills off a batch of ASSERT failures.
      6b11bab6
    • Simon Peyton Jones's avatar
      Fix GHCi/GHC-API tidying and modules (Trac #9424, #9426) · 67a0cab6
      Simon Peyton Jones authored
      There were two related bugs here
      
      Trac #9426
         We must increment the ic_mod_index field of the InteractiveContext
         if we have new instances, because we maek DFunIds that should be
         distinct from previous ones.  Previously we were only incrementing
         when defining new user-visible Ids.
      
         The main change is in HscTypes.extendInteractiveContext, which now
         alwyas bumps the ic_mod_index.  I also added a specialised
         extendInteractiveContextWithIds for the case where we are *only*
         adding new user-visible Ids.
      
      Trac #9424
         In HscMain.hscDeclsWithLocations we were failing to use the
         *tidied* ClsInsts; but the un-tidied ones are LocalIds which
         causes a later ASSERT error.
      
         On the way I realised that, to behave consistently, the tcg_insts
         and tcg_fam_insts field of TcGblEnv should really only contain
         instances from the current GHCi command, not all the ones to date.
         That in turn meant I had to move the code for deleting replacement
         instances from addLocalInst, addLocalFamInst to
         HscTypes.extendInteractiveContext
      67a0cab6
  35. 15 Dec, 2014 1 commit
    • Simon Peyton Jones's avatar
      Make Core Lint check for locally-bound GlobalIds · d59c59f4
      Simon Peyton Jones authored
      There should be no bindings in this module for a GlobalId;
      except after CoreTidy, when top-level bindings are globalised.
      
      To check for this, I had to make the CoreToDo pass part of the
      environment that Core Lint caries.  But CoreToDo is defined in
      CoreMonad, which (before this patch) called CoreLint.
      
      So I had to do quite a bit of refactoring, moving some
      lint-invoking code into CoreLint itself.  Crucially, I also
      more tcLookupImported_maybe, importDecl, and checkwiredInTyCon
      from TcIface (which use CoreLint) to LoadIface (which doesn't).
      This is probably better structure anyway.
      
      So most of this patch is refactoring. The actual check for
      GlobalIds is in CoreLint.lintAndScopeId
      d59c59f4
  36. 03 Dec, 2014 1 commit