1. 04 May, 2016 12 commits
    • Erik de Castro Lopo's avatar
      rts: Replace `nat` with `uint32_t` · db9de7eb
      Erik de Castro Lopo authored
      The `nat` type was an alias for `unsigned int` with a comment saying
      it was at least 32 bits. We keep the typedef in case client code is
      using it but mark it as deprecated.
      
      Test Plan: Validated on Linux, OS X and Windows
      
      Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20
      
      Differential Revision: https://phabricator.haskell.org/D2166
      db9de7eb
    • niteria's avatar
      Kill non-deterministic foldUFM in TrieMap and TcAppMap · ad4392c1
      niteria authored
      Summary:
      foldUFM introduces unnecessary non-determinism that actually
      leads to different generated code as explained in
      Note [TrieMap determinism].
      
      As we're switching from UniqFM to UniqDFM here you might be
      concerned about performance. There's nothing that ./validate
      detects. nofib reports no change in Compile Allocations, but
      Compile Time got better on some tests and worse on some,
      yielding this summary:
      
              -1 s.d.                -----            -3.8%
              +1 s.d.                -----            +5.4%
              Average                -----            +0.7%
      
      This is not a fair comparison as the order of Uniques
      changes what GHC is actually doing. One benefit from making
      this deterministic is also that it will make the
      performance results more stable.
      
      Full nofib results: P108
      
      Test Plan: ./validate, nofib
      
      Reviewers: goldfire, simonpj, simonmar, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2169
      
      GHC Trac Issues: #4012
      ad4392c1
    • Ben Gamari's avatar
      base: Export runRW# from GHC.Exts · 763610e9
      Ben Gamari authored
      Seems like this should be available in GHC.Exts. Thanks for @carter
      for pointing this out.
      
      Test Plan: Validate
      
      Reviewers: rwbarton, hvr, austin
      
      Reviewed By: austin
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D2171
      763610e9
    • Ben Gamari's avatar
      testsuite: Add test for #11959 · 4f2afe1e
      Ben Gamari authored
      Test Plan: Validate, expected to fail
      
      Reviewers: goldfire, austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2132
      
      GHC Trac Issues: #11959
      4f2afe1e
    • Iavor S. Diatchki's avatar
      Be more aggressive when checking constraints for custom type errors. · b75d1940
      Iavor S. Diatchki authored
      This fixes #11990.
      
      The current rule is simpler than before: if we encounter an unsolved
      constraint that contains any mentions of properly applied `TypeError`,
      then we report the type error.
      
      If there are multiple `TypeErrors`, then we just report one of them.
      
      Reviewers: simonpj, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2151
      
      GHC Trac Issues: #11990
      b75d1940
    • Simon Marlow's avatar
      Make 'make fast' work for the User Guide · aa5e2ddc
      Simon Marlow authored
      If you already have mkUserGuidePart compiled.
      aa5e2ddc
    • Simon Marlow's avatar
      Don't STATIC_INLINE giveCapabilityToTask · dbcaa8c2
      Simon Marlow authored
      This causes errors with some versions of gcc (4.4.7 here).
      dbcaa8c2
    • Simon Marlow's avatar
      schedulePushWork: avoid unnecessary wakeups · 1fa92ca9
      Simon Marlow authored
      This function had some pathalogically bad behaviour: if we had 2 threads
      on the current capability and 23 other idle capabilities, we would
      
      * grab all 23 capabilities
      * migrate one Haskell thread to one of them
      * wake up a worker on *all* 23 other capabilities.
      
      This lead to a lot of unnecessary wakeups when using large -N values.
      
      Now, we
      
      * Count how many capabilities we need to wake up
      * Start from cap->no+1, so that we don't overload low-numbered capabilities
      * Only wake up capabilities that we migrated a thread to (unless we have
        sparks to steal)
      
      This results in a pretty dramatic improvement in our production system.
      1fa92ca9
    • Simon Marlow's avatar
      Add +RTS -AL<size> · f703fd6b
      Simon Marlow authored
      +RTS -AL<size> controls the total size of large objects that can be
      allocated before a GC is triggered.  Previously this was always just the
      value of -A, and the limit mainly existed to prevent runaway allocation
      in pathalogical programs that allocate a lot of large objects.  However,
      since the limit is shared between all cores, on a large multicore the
      default becomes more restrictive, and can end up triggering GC well
      before it would normally have been.
      
      Arguably a better default would be A*N, but this is probably excessive.
      Adding a flag lets you choose, and I've left the default as it was.
      
      See docs for usage.
      f703fd6b
    • Simon Marlow's avatar
      Allow limiting the number of GC threads (+RTS -qn<n>) · 76ee2607
      Simon Marlow authored
      This allows the GC to use fewer threads than the number of capabilities.
      At each GC, we choose some of the capabilities to be "idle", which means
      that the thread running on that capability (if any) will sleep for the
      duration of the GC, and the other threads will do its work.  We choose
      capabilities that are already idle (if any) to be the idle capabilities.
      
      The idea is that this helps in the following situation:
      
      * We want to use a large -N value so as to make use of hyperthreaded
        cores
      * We use a large heap size, so GC is infrequent
      * But we don't want to use all -N threads in the GC, because that
        thrashes the memory too much.
      
      See docs for usage.
      76ee2607
    • Joachim Breitner's avatar
      Adjust testsuite output to bytestring-0.10.8.0 · f9d93751
      Joachim Breitner authored
      This is a band-aid; the test suite should not be sensitive to these
      messages.
      f9d93751
    • Joachim Breitner's avatar
      Export oneShot from GHC.Exts · 50e70559
      Joachim Breitner authored
      as suggested by carter in #12011.
      50e70559
  2. 03 May, 2016 2 commits
  3. 02 May, 2016 7 commits
    • Simon Marlow's avatar
      Cleanups related to MAX_FREE_LIST · ef446066
      Simon Marlow authored
      - Rename to the (more correct) NUM_FREE_LISTS
      
      - NUM_FREE_LISTS should be derived from the block and mblock sizes, not
        defined manually.  It was actually too large by one, which caused a
        little bit of (benign) extra work in the form of a redundant loop
        iteration in some cases.
      
      - Add some ASSERTs for input preconditions to log_2() and log_2_ceil()
      
      - Fix some comments
      
      - Fix usage in allocLargeChunk, to account for the fact that
        log_2_ceil() can return NUM_FREE_LISTS.
      ef446066
    • U-THEFACEBOOK\smarlow's avatar
      Revert "Revert "Use __builtin_clz() to implement log_1()"" · 5f8c0b84
      U-THEFACEBOOK\smarlow authored
      This reverts commit 546f24e4.
      
      And adds a fix for Windows: we need to use __builtin_clzll() rather than
      __builtin_clzl(), because StgWord is unsigned long long on Windows.
      5f8c0b84
    • 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
    • Ryan Scott's avatar
      Make validDerivPred ignore non-visible arguments to a class type constructor · fa86ac7c
      Ryan Scott authored
      Summary:
      GHC choked when trying to derive the following:
      
      ```
      {-# LANGUAGE GeneralizedNewtypeDeriving #-}
      {-# LANGUAGE PolyKinds #-}
      module Example where
      
      class Category (cat :: k -> k -> *) where
        catId   :: cat a a
        catComp :: cat b c -> cat a b -> cat a c
      
      newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category
      ```
      
      Unlike in #8865, where we were deriving `Category` for a concrete type like
      `Either`, in the above example we are attempting to derive an instance of the
      form:
      
      ```
      instance Category * c => Category (T * c) where ...
      ```
      
      (using `-fprint-explicit-kinds` syntax). But `validDerivPred` is checking if
      `sizePred (Category * c)` equals the number of free type variables in
      `Category * c`. But note that `sizePred` counts both type variables //and//
      type constructors, and `*` is a type constructor! So `validDerivPred`
      erroneously rejects the above instance.
      
      The fix is to make `validDerivPred` ignore non-visible arguments to the class
      type constructor (e.g., ignore `*` is `Category * c`) by using
      `filterOutInvisibleTypes`.
      
      Fixes #11833.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, hvr, simonpj, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2112
      
      GHC Trac Issues: #11833
      fa86ac7c
    • Sergei Trofimovich's avatar
    • Sergei Trofimovich's avatar
      glasgow_exts.rst: fix quoting · 81d8a23e
      Sergei Trofimovich authored
      glasgow_exts.rst:6525: WARNING: Inline literal start-string without end-string.
      Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
      81d8a23e
    • Sergei Trofimovich's avatar
      db2bfe00
  4. 01 May, 2016 17 commits
    • Matthew Pickering's avatar
      Make sure record pattern synonym selectors are in scope in GHCi. · cd85dc84
      Matthew Pickering authored
      Beforehand, when a record pattern synonym was defined in GHCi
      the selectors would not be in scope. This is because of `is_sub_bndr`
      in `HscTypes.icExtendGblRdrEnv` was throwing away the selectors.
      
      This was broken by the fix to #10520 but it is easy to resolve.
      
      Reviewers: austin, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2147
      
      GHC Trac Issues: #11985
      cd85dc84
    • niteria's avatar
      Remove unused equivClassesByUniq · ea34f565
      niteria authored
      It uses `eltsUFM` so it can introduce nondeterminism, but it isn't used
      so we can delete it.
      
      Test Plan: it builds
      
      Reviewers: simonpj, goldfire, simonmar, austin, bgamari
      
      Reviewed By: austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2161
      
      GHC Trac Issues: #4012
      ea34f565
    • Ryan Scott's avatar
      Export constructors for IntPtr and WordPtr · a28611b1
      Ryan Scott authored
      This finishes what #5529 started by exporting the constructors for
      `IntPtr` and `WordPtr` from `Foreign.Ptr`, allowing them to be used in
      `foreign` declarations.
      
      Fixes #11983.
      
      Test Plan: `make TEST=T11983`
      
      Reviewers: simonpj, hvr, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2142
      
      GHC Trac Issues: #11983
      a28611b1
    • Ben Gamari's avatar
      deriveConstants: Fix nm advice one last time · ecc06030
      Ben Gamari authored
      Missing a close paren.
      ecc06030
    • Ömer Sinan Ağacan's avatar
      Add T11747 as a test · 11619322
      Ömer Sinan Ağacan authored
      Reviewers: bgamari, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2163
      
      GHC Trac Issues: #11747
      11619322
    • niteria's avatar
      Remove unused getScopedTyVarBinds · 116d3fe6
      niteria authored
      Test Plan: it compiles
      
      Reviewers: simonpj, austin, goldfire, bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D2160
      
      GHC Trac Issues: #4012
      116d3fe6
    • Ben Gamari's avatar
      rts/itimer/pthread: Stop timer when ticker is stopped · 999c464d
      Ben Gamari authored
      This reworks the pthread-based itimer implementation to disarm the timer
      when events aren't needed. Thanks to hsyl20 for the nice design.
      
      Test Plan: Validate
      
      Reviewers: hsyl20, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2131
      
      GHC Trac Issues: #1623, #11965
      999c464d
    • Ben Gamari's avatar
      Kill Itimer.h · 55f4009e
      Ben Gamari authored
      It declared nothing.
      55f4009e
    • Ben Gamari's avatar
      Catch errors from timerfd_settime · df9b772a
      Ben Gamari authored
      df9b772a
    • Ben Gamari's avatar
      rts: Split up Itimer.c · 65e13f66
      Ben Gamari authored
      This shouldn't have any functional changes. It merely splits up what are
      essentially three distinct codepaths which are melding together with
      CPP.
      
      At the moment I merely #include the implementation to use with CPP
      although this really feels very yucky.
      
      Reviewers: erikd, austin, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2130
      65e13f66
    • Ben Gamari's avatar
      rts: Close livelock window due to rapid ticker enable/disable · 16a51a6c
      Ben Gamari authored
      This fixes #11830, where the RTS would livelock if run with `-I0` due
      to a regression introduced by bbdc52f3.
      The reason for this is that the new codepath introduced a subtle race
      condition:
      
       1. one thread could request that the ticker stop and would block until
          the ticker in fact stopped
       2. meanwhile, another thread could sneak in and restart the ticker
      
      this was implemented in such a way where thread (1) would end up
      blocked forever. The solution here is to simply not block. The worst
      that will happen is that timer fires again, but is ignored since the
      ticker is stopped.
      
      Test Plan:
      Validate, try reproduction case in #11830. Need to find a nice
      testcase.
      
      Reviewers: simonmar, erikd, hsyl20, austin
      
      Reviewed By: erikd, hsyl20
      
      Subscribers: erikd, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2129
      
      GHC Trac Issues: #11830
      16a51a6c
    • niksaz's avatar
      Greater customization of GHCi prompt · 533037cc
      niksaz authored
      This patch is trying to redesign the :set prompt option to take not a
      String but a Haskell function, like [String] -> Int -> IO String, where
      [String] is the list of the names of the currently loaded modules and
      Int is the line number. Currently you may set prompt function with
      **:set promt-function [String] -> Int -> IO String** option and old
      version is also available - :set prompt String.
      
      So, it looks like I've almost completed this patch:
      
      1) Now we have a lot of escape sequences - 13 to be exact. Most of them
         are similar to bash prompt escape sequences. Thus they are quite handy.
      
      2) We may use the special escape sequence to call shell functions, for
         example "%call(ls -l -a)".
      
      3) We may use :set prompt-function to set PFunction to handle prompt.
         It is just [String] -> Int -> IO String.
      
      Reviewers: erikd, austin, mpickering, bgamari
      
      Reviewed By: mpickering, bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2084
      
      GHC Trac Issues: #5850
      533037cc
    • Ben Gamari's avatar
      Bump haddock submodule · 18676a4a
      Ben Gamari authored
      Fixes documentation installation.
      18676a4a
    • Ben Gamari's avatar
      eac69673
    • Erik de Castro Lopo's avatar
      rts: Remove deprecated C type `lnat` · 868d2c47
      Erik de Castro Lopo authored
      Summary:
      The `lnat` type was deprecated in 2012 in commit 41737f12 with
      a note to use `StgWord` instead.
      
      Test Plan: Validate on Linux and OS X
      
      Reviewers: simonmar, austin, Phyx, hvr, bgamari
      
      Reviewed By: simonmar, Phyx, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2164
      868d2c47
    • Tamar Christina's avatar
      Fix aggressive cleanup of T1407 · e6627d1f
      Tamar Christina authored
      Summary:
      The aggressive cleanup routine of T1407 is removing files that don't belong to it.
      Constrain the test to only removing files it should by putting all it's generated
      binaries in it's own output folder.
      
      Test Plan: make test -C testsuite/tests/ghci/linking/dyn
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2165
      
      GHC Trac Issues: #1407
      e6627d1f
    • Ömer Sinan Ağacan's avatar
      Typos in DmdAnal · f69e7078
      Ömer Sinan Ağacan authored
      f69e7078
  5. 30 Apr, 2016 2 commits