1. 09 May, 2015 2 commits
    • Edward Z. Yang's avatar
      Revert stage 1 template-haskell. This is a combination of 5 commits. · 5c459eef
      Edward Z. Yang authored
      Revert "Quick fix: drop base bound on template-haskell."
      
      This reverts commit 3c70ae03.
      
      Revert "Always do polymorphic typed quote check, c.f. #10384"
      
      This reverts commit 9a43b2c1.
      
      Revert "RnSplice's staging test should be applied for quotes in stage1."
      
      This reverts commit eb0ed403.
      
      Revert "Split off quotes/ from th/ for tests that can be done on stage1 compiler."
      
      This reverts commit 21c72e7d.
      
      Revert "Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382."
      
      This reverts commit 28257cae.
      5c459eef
    • Edward Z. Yang's avatar
      Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382. · 28257cae
      Edward Z. Yang authored
      Summary:
      This commit adds stage 1 support for Template Haskell
      quoting, e.g. [| ... expr ... |], which is useful
      for authors of quasiquoter libraries that do not actually
      need splices.  The TemplateHaskell extension now does not
      unconditionally fail; it only fails if the renamer encounters
      a splice that it can't run.
      
      In order to make sure the referenced data structures
      are consistent, template-haskell is now a boot library.
      
      In the following patches, there are:
      
          - A few extra safety checks which should be enabled
            in stage1
          - Separation of the th/ testsuite into quotes/ which
            can be run on stage1
      
      Note for reviewer: big diff changes are simply code
      being moved out of an ifdef; there was no other substantive
      change to that code.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, goldfire
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D876
      
      GHC Trac Issues: #10382
      28257cae
  2. 06 May, 2015 2 commits
    • Javran Cheng's avatar
      rts: add "-no-rtsopts-suggestions" option · 477f514f
      Javran Cheng authored
      Depends on D767
      
      Setting this flag prevents RTS from giving RTS suggestions like "Use
      `+RTS -Ksize -RTS' to increase it."
      
      According to the comment @rwbarton made in #9579, sometimes "+RTS"
      suggestions don't make sense (e.g. when the program is precompiled and
      installed through package managers), we can encourage people to
      distribute binaries with either "-no-rtsopts-suggestions" or "-rtsopts".
      
      Reviewed By: erikd, austin
      
      Differential Revision: https://phabricator.haskell.org/D809
      
      GHC Trac Issues: #9579
      477f514f
    • Zejun Wu's avatar
      Retain ic_monad and ic_int_print from external packages after load · 03c4893e
      Zejun Wu authored
      Retain ic_monad and ic_int_print in InteractiveContext after load
      when they are defined in external packages. This is supposed to be
      the desired behavior that the interactive-print and setGHCiMonad
      will survive after :cd, :add, :load, :reload and :set in GHCi.
      
      Test Plan:
      Install a interactive-print function and GHCi monad from extenal
      pacakge. Try :cd, :load and other commands, make sure that the
      interactive-print function and GHCi monad always keep the same.
      
      Reviewed By: simonmar
      
      Differential Revision: https://phabricator.haskell.org/D867
      03c4893e
  3. 04 May, 2015 2 commits
    • Edward Z. Yang's avatar
      Give a hint when a TH splice has a bad package key, partially fixes #10279 · bf4f3e65
      Edward Z. Yang authored
      Previously, if we got a package key in our splice, we'd give
      a very unhelpful error message saying we couldn't find
      a package 'base-4.7.0.1', despite there being a package with
      that source package ID.  Really, we couldn't find a package with
      that *key*, so clarify, and also tell the user what the real
      package key is.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      bf4f3e65
    • Adam Gundry's avatar
      Permit empty closed type families · 4efa4213
      Adam Gundry authored
      Fixes #9840 and #10306, and includes an alternative resolution to #8028.
      This permits empty closed type families, and documents them in the user
      guide. It updates the Haddock submodule to support the API change.
      
      Test Plan: Added `indexed-types/should_compile/T9840` and updated
      `indexed-types/should_fail/ClosedFam4` and `th/T8028`.
      
      Reviewers: austin, simonpj, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: bgamari, jstolarek, thomie, goldfire
      
      Differential Revision: https://phabricator.haskell.org/D841
      
      GHC Trac Issues: #9840, #10306
      4efa4213
  4. 30 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Tidy up treatment of FlexibleContexts · b83160d0
      Simon Peyton Jones authored
      Previously (Trac #10351) we could get
      
          Non type-variable argument in the constraint: C [t]
          (Use FlexibleContexts to permit this)
          When checking that `f' has the inferred type
            f :: forall t. C [t] => t -> ()
      
      which is a bit stupid: we have *inferred* a type that we
      immediately *reject*.  This patch arranges that that the
      generalisation mechanism (TcSimplify.decideQuantification)
      doesn't pick a predicate that will be rejected by the
      subsequent validity check.
      
      This forced some minor refactoring, as usual.
      b83160d0
  5. 17 Apr, 2015 1 commit
  6. 14 Apr, 2015 3 commits
  7. 08 Apr, 2015 1 commit
  8. 07 Apr, 2015 5 commits
    • Edward Z. Yang's avatar
      Axe one-shot sig-of · 1d5c887c
      Edward Z. Yang authored
      Summary:
      We're getting rid of -sig-of foo:A usage, because
      it doesn't make sense in any compilation mode besides one-shot,
      and we don't expect users to use it anyway.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D789
      1d5c887c
    • Edward Z. Yang's avatar
      Support for multiple signature files in scope. · a7524eae
      Edward Z. Yang authored
      Summary:
      A common pattern when programming with signatures is to combine multiple
      signatures together (signature linking).  We achieve this by making it
      not-an-error to have multiple, distinct interface files for the same module
      name, as long as they have the same backing implementation.  When a user
      imports a module name, they get ALL matching signatures dumped into their
      scope.
      
      On the way, I refactored the module finder code, which now distinguishes
      between exact finds (when you had a 'Module') and regular finds (when
      you had a 'ModuleName').  I also refactored the package finder code to
      use a Monoid instance on LookupResult to collect together various results.
      
      ToDo: At the moment, if a signature is declared in the local package,
      it completely overrides any remote signatures.  Eventually, we'll want
      to also pull in the remote signatures (or even override the local signature,
      if the full implementation is available.)  There are bunch of ToDos in the
      code for what to do once this is done.
      
      ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
      would have seen a signature, we instead continue and return the Module
      for the backing implementation.  This is correct for most cases, but there
      might be some situations where we want something a little more fine-grained
      (e.g. :browse should only list identifiers which are available through
      the in-scope signatures, and not ALL of them.)
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, hvr, austin
      
      Subscribers: carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D790
      
      GHC Trac Issues: #9252
      a7524eae
    • Edward Z. Yang's avatar
      cf1d9751
    • Simon Peyton Jones's avatar
      Reduce module qualifiers in pretty-printing · 547c5971
      Simon Peyton Jones authored
      The change is in HscTypes.mkPrintUnqualified, and suppresses the
      module qualifier on Names from ghc-prim, base, and template-haskell,
      where no ambiguity can aries.  It's somewhat arbitrary, but helps
      with things like 'Constraint' which are often not in scope, but
      occasionally show up in error messages.
      547c5971
    • Simon Marlow's avatar
      Replace hooks by callbacks in RtsConfig (#8785) · a7ab1616
      Simon Marlow authored
      Summary:
      Hooks rely on static linking semantics, and are broken by -Bsymbolic
      which we need when using dynamic linking.
      
      Test Plan: Built it
      
      Reviewers: austin, hvr, tibbe
      
      Differential Revision: https://phabricator.haskell.org/D8
      a7ab1616
  9. 06 Apr, 2015 1 commit
  10. 03 Apr, 2015 2 commits
  11. 01 Apr, 2015 1 commit
    • thomie's avatar
      Change which files --make thinks are 'Haskellish' (#10220) · 7cec6c7b
      thomie authored
      `.hspp` and `.hscpp` are haskell files that have already been preprocessed.
      
      Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
      commit a10e1990. This way, ghc --make will load their imports.
      
      Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
      by moving them out of `haskell_src_suffixes` (but still keeping them in
      haskellish_suffixes, though I'm not sure what the purpose of that group
      is).
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D778
      7cec6c7b
  12. 31 Mar, 2015 2 commits
  13. 30 Mar, 2015 2 commits
    • thomie's avatar
      Delete unused field `PipeEnv.pe_isHaskellishFile` · b1d6a608
      thomie authored
      Differential Revision: https://phabricator.haskell.org/D774
      b1d6a608
    • Joachim Breitner's avatar
      Refactor the story around switches (#10137) · de1160be
      Joachim Breitner authored
      This re-implements the code generation for case expressions at the Stg →
      Cmm level, both for data type cases as well as for integral literal
      cases. (Cases on float are still treated as before).
      
      The goal is to allow for fancier strategies in implementing them, for a
      cleaner separation of the strategy from the gritty details of Cmm, and
      to run this later than the Common Block Optimization, allowing for one
      way to attack #10124. The new module CmmSwitch contains a number of
      notes explaining this changes. For example, it creates larger
      consecutive jump tables than the previous code, if possible.
      
      nofib shows little significant overall improvement of runtime. The
      rather large wobbling comes from changes in the code block order
      (see #8082, not much we can do about it). But the decrease in code size
      alone makes this worthwhile.
      
      ```
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
                  Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
                  Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
       Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%
      ```
      
      Compilation time increases slightly:
      ```
              -1 s.d.                -----            -2.0%
              +1 s.d.                -----            +2.5%
              Average                -----            +0.3%
      ```
      
      The test case T783 regresses a lot, but it is the only one exhibiting
      any regression. The cause is the changed order of branches in an
      if-then-else tree, which makes the hoople data flow analysis traverse
      the blocks in a suboptimal order. Reverting that gets rid of this
      regression, but has a consistent, if only very small (+0.2%), negative
      effect on runtime. So I conclude that this test is an extreme outlier
      and no reason to change the code.
      
      Differential Revision: https://phabricator.haskell.org/D720
      de1160be
  14. 29 Mar, 2015 1 commit
  15. 28 Mar, 2015 1 commit
  16. 27 Mar, 2015 1 commit
    • thomie's avatar
      Rename driver phases C(obj)cpp to C(obj)cplusplus · abde5da4
      thomie authored
      Before:
      Cpp     = Pre-process C
      Ccpp    = Compile C++
      Cobjcpp = Compile Objective-C++
      CmmCpp  = Pre-process Cmm
      
      Quite confusing! This commit renames `Ccpp` to `Ccplusplus`, and
      `Cobjcpp` to `Cobjcplusplus`. The two letters `p-p` keep standing for
      `pre-processing` throughout the compiler.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D756
      abde5da4
  17. 24 Mar, 2015 1 commit
  18. 23 Mar, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Do proper depth checking in the flattener to avoid looping. · c1edbdfd
      eir@cis.upenn.edu authored
      This implements (roughly) the plan put forward in comment:14:ticket:7788,
      fixing #7788, #8550, #9554, #10139, and addressing concerns raised in #10079.
      There are some regressions w.r.t. GHC 7.8, but only with pathological type
      families (like F a = F a). This also (hopefully -- don't have a test case)
      fixes #10158. Unsolved problems include #10184 and #10185, which are both
      known deficiencies of the approach used here.
      
      As part of this change, the plumbing around detecting infinite loops has
      changed. Instead of -fcontext-stack and -ftype-function-depth, we now have
      one combined -freduction-depth parameter. Setting it to 0 disbales the
      check, which is now the recommended way to get (terminating) code to
      typecheck in releases. (The number of reduction steps may well change between
      minor GHC releases!)
      
      This commit also introduces a new IntWithInf type in BasicTypes
      that represents an integer+infinity. This type is used in a few
      places throughout the code.
      
      Tests in
        indexed-types/should_fail/T7788
        indexed-types/should_fail/T8550
        indexed-types/should_fail/T9554
        indexed-types/should_compile/T10079
        indexed-types/should_compile/T10139
        typecheck/should_compile/T10184  (expected broken)
        typecheck/should_compile/T10185  (expected broken)
      
      This commit also changes performance testsuite numbers, for the better.
      c1edbdfd
  19. 19 Mar, 2015 1 commit
  20. 17 Mar, 2015 2 commits
  21. 16 Mar, 2015 1 commit
    • thomie's avatar
      Dont call unsafeGlobalDynFlags if it is not set · 5166ee94
      thomie authored
      Parsing of static and mode flags happens before any session is started,
      i.e., before the first call to 'GHC.withGhc'. Therefore, to report
      errors for invalid usage of these two types of flags, we can not call
      any function that needs DynFlags, as there are no DynFlags available yet
      (unsafeGlobalDynFlags is not set either). So we always print "on the
      commandline" as the location, which is true except for Api users, which
      is probably ok.
      
      When reporting errors for invalid usage of dynamic flags we /can/ make
      use of DynFlags, and we do so explicitly in
      DynFlags.parseDynamicFlagsFull.
      
      Before, we called unsafeGlobalDynFlags when an invalid (combination of)
      flag(s) was given on the commandline, resulting in panics (#9963). This
      regression was introduced in 1d6124de.
      
      Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this
      from happening again.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D730
      
      GHC Trac Issues: #9963
      5166ee94
  22. 14 Mar, 2015 1 commit
    • Peter Trommler's avatar
      Link temporary shared objects with `--no-as-needed` · 1b7f5976
      Peter Trommler authored
      Some ELF link editors default to `--as-needed` and record only
      those libraries in DT_NEEDED tags that are needed to resolve
      undefined symbols in the shared object to be created.
      
      In Template Haskell we rely on all symbols that were defined
      in modules compiled so far to be available in the current
      temporary shared object. To prevent the link editor from
      dropping the DT_NEEDED tag for the previously linked temporary
      shared object we need to override the link editors default and
      specify `--no-as-needed` on the command line. This is for GNU ld
      and GOLD ld.
      
      This addresses #10110
      
      TODO: regression test
      
      Reviewed By: hvr
      
      Differential Revision: https://phabricator.haskell.org/D731
      1b7f5976
  23. 10 Mar, 2015 1 commit
  24. 09 Mar, 2015 2 commits
  25. 07 Mar, 2015 2 commits
    • Edward Z. Yang's avatar
      Store renamings as (ModuleName, ModuleName) pairs. · 68d4f472
      Edward Z. Yang authored
      Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: austin, simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D710
      68d4f472
    • Iavor S. Diatchki's avatar
      Custom `Typeable` solver, that keeps track of kinds. · b359c886
      Iavor S. Diatchki authored
      Summary:
      This implements the new `Typeable` solver: when GHC sees `Typeable` constraints
      it solves them on the spot.
      
      The current implementation creates `TyCon` representations on the spot.
      
      Pro: No overhead at all in code that does not use `Typeable`
      Cons: Code that uses `Typeable` may create multipe `TyCon` represntations.
      
      We have discussed an implementation where representations of `TyCons` are
      computed once, in the module, where a datatype is declared.  This would
      lead to more code being generated:  for a promotable datatype we need to
      generate `2 + number_of_data_cons` type-constructro representations,
      and we have to do that for all programs, even ones that do not intend to
      use typeable.
      
      I added code to emit warning whenevar `deriving Typeable` is encountered---
      the idea being that this is not needed anymore, and shold be fixed.
      
      Also, we allow `instance Typeable T` in .hs-boot files, but they result
      in a warning, and are ignored.  This last one was to avoid breaking exisitng
      code, and should become an error, eventually.
      
      Test Plan:
      1. GHC can compile itself.
      2. I compiled a number of large libraries, including `lens`.
          - I had to make some small changes:
            `unordered-containers` uses internals of `TypeReps`, so I had to do a 1 line fix
          - `lens` needed one instance changed, due to a poly-kinded `Typeble` instance
      
      3. I also run some code that uses `syb` to traverse a largish datastrucutre.
      I didn't notice any signifiant performance difference between the 7.8.3 version,
      and this implementation.
      
      Reviewers: simonpj, simonmar, austin, hvr
      
      Reviewed By: austin, hvr
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D652
      
      GHC Trac Issues: #9858
      b359c886