1. 03 Feb, 2017 2 commits
    • Sylvain Henry's avatar
      Ditch static flags · bbd3c399
      Sylvain Henry authored
      This patch converts the 4 lasting static flags (read from the command
      line and unsafely stored in immutable global variables) into dynamic
      flags. Most use cases have been converted into reading them from a DynFlags.
      
      In cases for which we don't have easy access to a DynFlags, we read from
      'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'.
      It's not perfect (not thread-safe) but it is still better as we can
      set/unset these 4 flags before each run when using GHC API.
      
      Updates haddock submodule.
      
      Rebased and finished by: bgamari
      
      Test Plan: validate
      
      Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2839
      
      GHC Trac Issues: #8440
      bbd3c399
    • Ben Gamari's avatar
  2. 02 Feb, 2017 10 commits
    • Matthew Pickering's avatar
      Remove INLINE pragma on loopbreaker · 5728f4b8
      Matthew Pickering authored
      5728f4b8
    • Ben Gamari's avatar
      Bump haskeline submodule · 895aa6d1
      Ben Gamari authored
      895aa6d1
    • Georgios Karachalias's avatar
      Exhaustiveness check for EmptyCase (Trac #10746) · b1035321
      Georgios Karachalias authored
      Empty case expressions have strict semantics so the problem boils down
      to inhabitation checking for the type of the scrutinee. 3 main functions
      added:
      
      - pmTopNormaliseType_maybe for the normalisation of the scrutinee type
      
      - inhabitationCandidates for generating the possible patterns of the
        appropriate type
      
      - checkEmptyCase' to filter out the candidates that give rise to
        unsatisfiable constraints.
      
      See Note [Checking EmptyCase Expressions] in Check
      and Note [Type normalisation for EmptyCase] in FamInstEnv
      
      Test Plan: validate
      
      Reviewers: simonpj, goldfire, dfeuer, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2105
      
      GHC Trac Issues: #10746
      b1035321
    • Joachim Breitner's avatar
      Add a testcase for #13227 · d8ac64e7
      Joachim Breitner authored
      where an expected float-out is not happening.
      d8ac64e7
    • Gabor Greif's avatar
      Spelling fixes · 8dd82ead
      Gabor Greif authored
      8dd82ead
    • Ben Gamari's avatar
      Add support for StaticPointers in GHCi · eedb3df0
      Ben Gamari authored
      Here we add support to GHCi for StaticPointers. This process begins by
      adding remote GHCi messages for adding entries to the static pointer
      table. We then collect binders needing SPT entries after linking and
      send the interpreter a message adding entries with the appropriate
      fingerprints.
      
      Test Plan: `make test TEST=StaticPtr`
      
      Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin,
      hvr, erikd
      
      Reviewed By: simonpj, simonmar
      
      Subscribers: RyanGlScott, simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2504
      
      GHC Trac Issues: #12356
      eedb3df0
    • Matthew Pickering's avatar
      Make interface loading for COMPLETE pragmas lazy · b16239a9
      Matthew Pickering authored
      Without this additional laziness we will loop forever trying
      to find the definitions of the conlikes referenced in the pragma.
      
      Fixes #13188
      
      Reviewers: austin, RyanGlScott, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3058
      
      GHC Trac Issues: #13188
      b16239a9
    • Oleg Grenrus's avatar
      Introduce GHC.TypeNats module, change KnownNat evidence to be Natural · 1fcede43
      Oleg Grenrus authored
      Reviewers: dfeuer, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3024
      
      GHC Trac Issues: #13181
      1fcede43
    • Ben Gamari's avatar
      Don't tick top-level string literals · f5b275a2
      Ben Gamari authored
      This fixes a regression due to D2605 (see #8472) wherein top-level primitive
      strings would fail to be noticed by CoreToStg as they were wrapped in a
      tick. This resulted in a panic in CoreToStg due to inconsistent CAF information
      (or a Core Lint failure, if enabled). Here we document the invariant that
      unlifted expressions can only sit at top-level if of the form `Lit (MachStr
      ...)` with no ticks or other embellishments. Moreover, we fix instance of
      this in `Simplify.prepareRhs` and `FloatOut.wrapTick` where this
      invariant was being broken.
      
      Test Plan: Validate with `-g`. Run testsuite with `WAY=ghci`.
      
      Reviewers: austin, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, akio, scpmw, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3051
      f5b275a2
    • Ben Gamari's avatar
      base: Derive Enum, Bounded for VecCount, VecElem · 5cb5b7a5
      Ben Gamari authored
      
      Test Plan: Validate
      
      Reviewers: RyanGlScott, austin, hvr
      
      Reviewed By: RyanGlScott
      
      Subscribers: goldfire, RyanGlScott, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3059
      5cb5b7a5
  3. 01 Feb, 2017 6 commits
  4. 31 Jan, 2017 9 commits
    • Ben Gamari's avatar
      Export callStackDoc · 25e0cfc6
      Ben Gamari authored
      It's generally a pretty useful thing to have around.
      
      [skip ci]
      
      Test Plan: Build it
      
      Reviewers: austin, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3048
      25e0cfc6
    • Takenobu Tani's avatar
      user-guide: fix links and file names (fixes #13198) · b15136af
      Takenobu Tani authored
      There are some incorrect links and file names in GHC user's guide.
      
        * docs/users_guide/glasgow_exts.rst
          - GHC/Base.lhs
          - GHC/List.lhs
      
        * docs/users_guide/ffi-chap.rst
          - :base-ref:`Foreign`
          - :base-ref:`Control.Concurrent`
      
      I fixed them.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3035
      
      GHC Trac Issues: #13198
      b15136af
    • alexbiehl's avatar
      Abstract over the way eventlogs are flushed · 4dfc6d1c
      alexbiehl authored
      Currently eventlog data is always written to a file `progname.eventlog`.
      This patch introduces the `flushEventLog` field in `RtsConfig` which
      allows to customize the writing of eventlog data.
      
      One possible scenario is the ongoing live-profile-monitor effort by
      @NCrashed which slurps all eventlog data through `fluchEventLog`.
      
      `flushEventLog` takes a buffer with eventlog data and its size and
      returns `false` (0) in case eventlog data could not be procesed.
      
      Reviewers: simonmar, austin, erikd, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: qnikst, thomie, NCrashed
      
      Differential Revision: https://phabricator.haskell.org/D2934
      4dfc6d1c
    • Ben Gamari's avatar
      FloatOut: Allow floating through breakpoint ticks · 44f079f7
      Ben Gamari authored
      I believe this is actually a completely valid thing to do, despite the
      arguments put forth in #10052. All that was missing was logic in
      SetLevels to correctly substitute the cloned binders into the
      breakpoint's free variable list.
      
      This is a prerequisite for enabling StaticPointer support in the
      interpreter.
      
      Test Plan: Validate
      
      Reviewers: austin, scpmw
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3049
      44f079f7
    • Ben Gamari's avatar
      afc05c76
    • Ben Gamari's avatar
      cb4b4fe9
    • David Feuer's avatar
      Mark reallyUnsafePtrEquality# as can_fail · b3576ed2
      David Feuer authored
      As described in the note, floating `reallyUnsafePtrEquality#`
      out can make it much less precise. Marking it `can_fail` will
      prevent it from floating out, which I believe is particularly
      important in light of 5a9a1738,
      and should also help prevent let/app invariant failures as seen
      in #11444 and #13027.
      
      Reviewers: simonpj, austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2987
      
      GHC Trac Issues: #13027, #11444
      b3576ed2
    • Daniel Haraj's avatar
      Use top-level instances to solve superclasses where possible · 748b7974
      Daniel Haraj authored
      This patch introduces a new flag `-fsolve-constant-dicts` which makes the
      constraint solver solve super class constraints with available dictionaries if
      possible. The flag is enabled by `-O1`.
      
      The motivation of this patch is that the compiler can produce more efficient
      code if the constraint solver used top-level instance declarations to solve
      constraints that are currently solved givens and their superclasses. In
      particular, as it currently stands, the compiler imposes a performance penalty
      on the common use-case where superclasses are bundled together for user
      convenience. The performance penalty applies to constraint synonyms as
      well. This example illustrates the issue:
      
      ```
      {-# LANGUAGE ConstraintKinds, MultiParamTypeClasses, FlexibleContexts #-}
      module B where
      
      class M a b where m :: a -> b
      
      type C a b = (Num a, M a b)
      
      f :: C Int b => b -> Int -> Int
      f _ x = x + 1
      ```
      
      Output without the patch, notice that we get the instance for `Num Int` by
      using the class selector `p1`.
      
      ```
      f :: forall b_arz. C Int b_arz => b_arz -> Int -> Int
      f =
        \ (@ b_a1EB) ($d(%,%)_a1EC :: C Int b_a1EB) _ (eta1_B1 :: Int) ->
          + @ Int
            (GHC.Classes.$p1(%,%) @ (Num Int) @ (M Int b_a1EB) $d(%,%)_a1EC)
            eta1_B1
            B.f1
      ```
      
      Output with the patch, nicely optimised code!
      
      ```
      f :: forall b. C Int b => b -> Int -> Int
      f =
        \ (@ b) _ _ (x_azg :: Int) ->
          case x_azg of { GHC.Types.I# x1_a1DP ->
          GHC.Types.I# (GHC.Prim.+# x1_a1DP 1#)
          }
      ```
      
      Reviewers: simonpj, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: mpickering, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2714
      
      GHC Trac Issues: #12791, #5835
      748b7974
    • alexbiehl's avatar
      Fix binary instance for SrcStrictness · c71f0c4e
      alexbiehl authored
      Summary: Found while revisiting the binary serialization for interface files.
      
      Test Plan: Building and validating currently
      
      Reviewers: austin, bgamari, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3050
      c71f0c4e
  5. 30 Jan, 2017 12 commits
    • rwbarton's avatar
      Turn libraries/integer-gmp/gmp/tarball into a submodule · 32729d35
      rwbarton authored
      The submodule repository contains the latest version of the GMP source
      distribution (6.1.2) with the doc/ subdirectory removed, as described
      in gmp/ghc.mk. Rather than applying the old patch from gmp/tarball/patch
      I moved its contents into gmp/gmpsrc.patch, canceling a patch related to
      memory management there. Experimentally, the PIC-related patch for OS X
      is still necessary.
      
      The upgrade to GMP 6.1.2 fixes #7655.
      
      Test Plan:
      Built on OS X with in-tree gmp and tested that the command
      `ghc -e 'length (show (2^(5*10^6) :: Integer))'` no longer segfaults.
      
      Reviewers: mpickering, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3044
      
      GHC Trac Issues: #7655
      32729d35
    • Takenobu Tani's avatar
      Fix minor typo in README.md · e9a239ce
      Takenobu Tani authored
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3040
      e9a239ce
    • Takenobu Tani's avatar
      Fix links to building guides in MAKEHELP.md · 9af1fb28
      Takenobu Tani authored
      MAKEHELP.md has an old link to 'Building/Hacking'.  I updated it to
      suitable links for new contributors.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3039
      9af1fb28
    • rwbarton's avatar
      Simplify minusInteger in integer-gmp slightly · f984bf2e
      rwbarton authored
      These two special cases were created in D2278 by mechanically
      inlining negateInteger into plusInteger. They aren't needed
      (the `minusInteger (S# x#) (S# y#)` case already handles all values
      correctly), and they can never help by avoiding an allocation,
      unlike the original special case in plusInteger, since we still
      have to allocate the result.
      
      Removing these special cases will save a couple comparisons and
      conditional branches in the common case of subtracting two small
      Integers.
      
      Test Plan:
      Existing test `plusMinusInteger` already tests
      the values in question.
      
      Reviewers: bgamari, goldfire, austin, hvr
      
      Reviewed By: bgamari, hvr
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3034
      f984bf2e
    • Matthew Pickering's avatar
      Print COMPLETE pragmas in --show-iface · 5f8e2344
      Matthew Pickering authored
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3032
      5f8e2344
    • Tamar Christina's avatar
      Slighly clean up symbol loading error. · f41c27d3
      Tamar Christina authored
      The symbol not found error that is triggered
      during lazy-loading was a bit chaotic before.
      
      This reformats it a bit to:
      
      ```
      ghc-stage2.exe:  | E:\...\libLLVMSupport.a: unknown symbol `_ZN4llvm5APIntC1Ejyb'
      ghc-stage2.exe:  | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm5APInt14AssignSlowCaseERKS0_'
      ghc-stage2.exe:  | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm13ConstantRangeC1ENS_5APIntES1_'
      ghc-stage2.exe:  | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm14FoldingSetImplC2Ej'
      ghc-stage2.exe:  | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm15LLVMContextImplD1Ev'
      ghc-stage2.exe:  | E:\...\libLLVMLTO.a: unknown symbol `_ZN4llvm11LLVMContextD1Ev'
      ghc-stage2.exe:  | E:\...\libLLVMCore.a: unknown symbol `_ZNK4llvm5Value10getContextEv'
      ghc-stage2.exe: ^^ Could not load 'LLVMIsMultithreaded', dependency unresolved.
      See top entry above.
      ```
      
      I have also thought about also showing the demangled names, as it may
      be useful for the end user.
      
      `libgcc` seems to provide a method for this so we wouldn't need any
      extra dependency.
      
      Any thoughts on this or would it not be useful?
      
      Reviewers: austin, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D3027
      
      GHC Trac Issues: #13093, #13113
      f41c27d3
    • Iavor S. Diatchki's avatar
      Fixes bug #11046 · 55935738
      Iavor S. Diatchki authored
      For some time now, type-level operators such as '+' have been treated as
      type constructors, rahter than type variables.  This pathc fixes TH's
      `lookupName` function to account for this behavior.
      
      Reviewers: bgamari, austin, goldfire, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: Phyx, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3025
      
      GHC Trac Issues: #11046
      55935738
    • Matthew Pickering's avatar
      Add a flag to emit error messages as JSON · 91691117
      Matthew Pickering authored
      This patch adds the flag `-ddump-json` which dumps all the compiler
      output as a JSON array. This allows tooling to more easily parse GHC's
      output to display to users.
      
      The flag is currently experimental and will hopefully be refined for the
      next release.  In particular I have avoided any changes which involve
      significant refactoring and provided what is easy given the current
      infrastructure.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: DanielG, gracjan, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3010
      
      GHC Trac Issues: #13190
      91691117
    • Ryan Scott's avatar
      Check that a default type signature aligns with the non-default signature · 7363d538
      Ryan Scott authored
      Before, GHC was extremely permissive about the form a default type
      signature could take on in a class declaration. Notably, it would accept
      garbage like this:
      
        class Monad m => MonadSupply m where
          fresh :: m Integer
          default fresh :: MonadTrans t => t m Integer
          fresh = lift fresh
      
      And then give an extremely confusing error message when you actually
      tried to declare an empty instance of MonadSupply. We now do extra
      validity checking of default type signatures to ensure that they align
      with their non-default type signature counterparts. That is, a default
      type signature is allowed to differ from the non-default one only in its
      context - they must otherwise be alpha-equivalent.
      
      Fixes #12918.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2983
      
      GHC Trac Issues: #12918
      7363d538
    • Rufflewind's avatar
      Fix broken tests · 2ec1c834
      Rufflewind authored
      1. DoParamM requires the FlexibleContexts pragma now.
      
      2. topHandler02 and topHandler03 were broken as timeout.py failed to
         translate signals to exit codes.
      
      3. topHandler03 does not produce a consistent stderr, as it depends on
         what the user has /bin/sh set to.  dash writes "Terminated" whereas
         bash and zsh produce nothing in non-interactive mode.
      
      4. The remaining tests are broken due to changes in the error message
         formatting.
      
      Test Plan: validate
      
      Reviewers: thomie, dfeuer, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: Phyx, dfeuer
      
      Differential Revision: https://phabricator.haskell.org/D2807
      2ec1c834
    • Erik de Castro Lopo's avatar
      Fix deprecation warnings from containers · d2cf5dea
      Erik de Castro Lopo authored
      The functions that were causing warnings were deprecated in containers
      0.5 and GHC is already using containers 0.5.9.1.
      
      Test Plan: validate
      
      Reviewers: rwbarton, bgamari, hsyl20, austin, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3036
      d2cf5dea
    • Ryan Scott's avatar
      Fix mismatched tick in GHC.Generics documentation · f60287c4
      Ryan Scott authored
      [ci skip]
      
      A Generic derivation example in the documentation of GHC.Generics put a tick
      (used for datatype promotion) in the wrong place.
      
      Fixes #13206.
      f60287c4
  6. 29 Jan, 2017 1 commit