1. 10 May, 2016 16 commits
    • niteria's avatar
      Make simplifyInstanceContexts deterministic · b58b0e18
      niteria authored
      simplifyInstanceContexts used cmpType which is nondeterministic
      for canonicalising typeclass constraints in derived instances.
      Following changes make it deterministic as explained by the
      Note [Deterministic simplifyInstanceContexts].
      
      Test Plan: ./validate
      
      Reviewers: simonmar, goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2173
      
      GHC Trac Issues: #4012
      b58b0e18
    • niteria's avatar
      Kill unnecessary cmpType in lhs_cmp_type · 4ac0e815
      niteria authored
      This is the only call site of `lhs_cmp_type` and we only
      care about equality.
      `cmpType` is nondeterministic (because `TyCon`s are compared
      with Uniques in `cmpTc`), so if we don't have to use it, it's
      better not to.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, goldfire, bgamari, austin, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2172
      
      GHC Trac Issues: #4012
      4ac0e815
    • Erik de Castro Lopo's avatar
      Comments only · bff6e1bb
      Erik de Castro Lopo authored
      [skip ci]
      bff6e1bb
    • Simon Marlow's avatar
      Fix a crash in requestSync() · ea3d1efb
      Simon Marlow authored
      It was possible for a thread to read invalid memory after a conflict
      when multiple threads were synchronising.
      
      I haven't been successful in constructing a test case that triggers
      this, but we have some internal code that ran into it.
      ea3d1efb
    • Ben Gamari's avatar
      RdrHsSyn: Only suggest `type` qualification when appropriate · e996e85f
      Ben Gamari authored
      This suggestion only applies to operators.
      e996e85f
    • Matthew Pickering's avatar
      Forbid variables to be parents in import lists. · 53f26f5a
      Matthew Pickering authored
      In the long discussion on #11432, it was decided that when a type
      constructor is parsed as a variable ((--.->) is one example) then in
      order to export the type constructor then the user should be required to
      use the ExplicitNamespaces keyword.
      
      This was implemented in quite an indirect manner in the renamer. It
      is much more direct to enforce this in the parser at the expense of
      slighty worse error messages. Further to this, the check in the
      renamer was actually slightly wrong. If the variable was in scope
      then no error was raised, this was causing panics, see #12026 for an
      example.
      
      Reviewers: austin, bgamari
      
      Subscribers: davean, skvadrik, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2181
      
      GHC Trac Issues: #12026
      53f26f5a
    • Ben Gamari's avatar
      stg/Types.h: Fix comment and #include · 3ca78062
      Ben Gamari authored
      3ca78062
    • Simon Peyton Jones's avatar
      Re-do the invariant for TcDepVars · 05974932
      Simon Peyton Jones authored
      Previously I had it so that dv_kvs and dv_tvs didn't
      overlap.  Now they can, and quantifyZonkedTyVars
      removes the former from the latter.  This is more
      economical, and in fact there was a bug where the
      invariant wasn't re-established.
      
      It's much easier to allow dv_kvs and dv_kvs to overlap,
      and to eliminate the overlap in TcMType.quantifyZonkedTyVars
      05974932
    • Simon Peyton Jones's avatar
      Error message wibbles, re partial type sigs · bb296bf1
      Simon Peyton Jones authored
      I committed three patches involving partial type sigs that
      are collectively responsible for these error message changes.
      The are all just changes to numbering in the pretty-printer.
      
      I didn't bother to partition them between patches -- sorry!
      bb296bf1
    • Simon Peyton Jones's avatar
      Tidy up partial-sig quantification · 9dbf5f5c
      Simon Peyton Jones authored
      There's a messy bit of tcSimplifyInfer which concerns how
      quantify when partial type signatures are involved. This
      patch tidies it up a lot.
      
      Notice that decideQuantification and quantify_tvs get
      much simpler.  And previously the inferred type of a
      function could be cluttered with phantom variables that
      were relevant only to the error messgas.
      
      See Note [Quantification and partial signatures].
      9dbf5f5c
    • Simon Peyton Jones's avatar
      Fix partial sigs and pattern bindings interaction · e1ff2b49
      Simon Peyton Jones authored
      It turns out that GHC 8.0 would accept entirely bogus
      programs like
      
         f2 :: (True, _) -> Char
         Just f2 = Just (\x->x)
      
      (which is now partial-sigs/should_fail/PatBind3)
      
      This also fixes Trac #9478, test `PatBind2`.
      e1ff2b49
    • Simon Peyton Jones's avatar
      Comments only · cc75a5d9
      Simon Peyton Jones authored
      cc75a5d9
    • Simon Peyton Jones's avatar
      Emit wild-card constraints in the right place · 76d9156f
      Simon Peyton Jones authored
      We were failing to emit wild-card hole constraints altogether
      in the case of pattern bindings.  Reason: it was done in
      tcExtendTyVarEnvFromSig, which isn't called for pattern bindings.
      
      This patch make it work right for both pattern and function
      bindings.  Mainly, there is a call to emitWildCardHolds in
      tcRhs for both PatBind and FunBind.
      
      I also killed off TcExpr.typeSigCtxt.
      76d9156f
    • Simon Peyton Jones's avatar
      White space only · 2593e204
      Simon Peyton Jones authored
      2593e204
    • wereHamster's avatar
      Use stdint types for Stg{Word,Int}{8,16,32,64} · 260a5648
      wereHamster authored
      We can't define Stg{Int,Word} in terms of {,u}intptr_t because STG
      depends on them being the exact same size as void*, and {,u}intptr_t
      does not make that guarantee. Furthermore, we also need to define
      StgHalf{Int,Word}, so the preprocessor if needs to stay. But we can at
      least keep it in a single place instead of repeating it in various
      files.
      
      Also define STG_{INT,WORD}{8,16,32,64}_{MIN,MAX} and use it in HsFFI.h,
      further reducing the need for CPP in other files.
      
      Reviewers: austin, bgamari, simonmar, hvr, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2182
      260a5648
    • Edward Z. Yang's avatar
      Documentation for simplifyDeriv. · dd3e8470
      Edward Z. Yang authored
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: docs only
      
      Reviewers: simonpj, austin, goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2180
      dd3e8470
  2. 08 May, 2016 1 commit
  3. 07 May, 2016 1 commit
  4. 06 May, 2016 5 commits
  5. 05 May, 2016 1 commit
  6. 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
  7. 03 May, 2016 2 commits
  8. 02 May, 2016 2 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