1. 15 Oct, 2018 5 commits
    • Ben Gamari's avatar
      Deprecate -fllvm-pass-vectors-in-regs · 58dffa0a
      Ben Gamari authored
      Summary:
      The behavior previously enabled by this flag is as been the default
      since 8.6.1.
      
      Reviewers: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5193
      58dffa0a
    • Nathan van Doorn's avatar
    • Ondra Pelech's avatar
    • Tobias Dammers's avatar
      Use an accumulator version of tyCoVarsOfType · 08b3db7e
      Tobias Dammers authored
      Summary:
      This is part 1 from #14880: factor out a worker for the tyCoVarsOf... family of
      function, implementing them in terms of VarSet, but with accumulator-style
      (like in `FV`) built in, and with the same kind of pre-insert lookup; this
      has shown to perform better than either FV or plain VarSet in this particular
      scenario.
      
      Original notes from simonpj:
      
      In TyCoRep we now have tyCoVarsOfType implemented
      
      1) Using FV -- this is the baseline version in GHC today
      
      2) Using VarSets via unionVarSet
      
      3) Using VarSets in accumulator-style
      
      In this patch (3) is enabled.
      
      When compiling perf/compiler/T5631 we get
      
               Compiler allocs
         (1)   1,144M
         (2)   1,175M
         (3)   1,142M
      
      The key new insight in (3) is this:
      
        ty_co_vars_of_type (TyVarTy v) is acc
          | v `elemVarSet` is  = acc
          | v `elemVarSet` acc = acc   <---- NB!
          | otherwise          = ty_co_vars_of_type (tyVarKind v) is (extendVarSet acc v)
      
      Notice the second line! If the variable is already in the
      accumulator, don't re-add it.  This makes big difference.
      Without it, allocation is 1,169M or so.
      
      One cause is that we only take the free vars of its kind once;
      that problem will go away when we do the main part of #14088 and
      close over kinds /afterwards/.  But still, another cause is perhaps
      that every insert into a set overwrites the previous item, and so
      allocates a new path to the item; it's not a no-op even if the
      item is there already.
      
      Why use (3) rather than (1)?  Becuase it just /has/ to
      be better;
      
      * FV carries around an InterestingVarFun, which does nothing
        useful here, but is tested at every variable
      
      * FV carries around a [Var] for the deterministic version.
      
      For this very hot operation (finding free vars) I think it
      makes sense to have speical purpose code.
      
      On the way I also simplified the (less used) coVarsOfType/Co family
      to use FV, by making serious use of the InterestingVarFun!
      
      Test Plan: validate, nofib
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14880
      
      Differential Revision: https://phabricator.haskell.org/D5141
      08b3db7e
    • Ryan Scott's avatar
      Fix #15725 with an extra Sym · 48efbc04
      Ryan Scott authored
      Summary:
      We were adding a `Sym` to one argument in the `InstCo`
      case of `optCoercion` but not another, leading to the two arguments
      to misaligned when combined via `Trans`. This fixes the issue with
      a well targeted use of `wrapSym`.
      
      Test Plan: make test TEST=T15725
      
      Reviewers: goldfire, ningning, bgamari
      
      Reviewed By: goldfire, ningning
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15725
      
      Differential Revision: https://phabricator.haskell.org/D5217
      48efbc04
  2. 14 Oct, 2018 4 commits
  3. 12 Oct, 2018 3 commits
  4. 11 Oct, 2018 1 commit
    • Piyush P Kurur's avatar
      Support builtin classes like KnownNat in backpack · ce7a1c4a
      Piyush P Kurur authored
      This commit allows backpack signatures to enforce constraints like
      KnownNat
      on data types.  Thus it fixes #15379.  There were two important
      differences in the
      way GHC used to handle classes like KnowNat
      
      1.  Hand crafted instances of `KnownNat` were  forbidden, and
      
      2. The dictionary for an  instance `KnownNat T` was generated on the
      fly.
      
      For supporting backpack both these points have to be revisited.
      
      Disallowing instances of KnownNat
      --------------------------------------------
      
      Users were disallowed to declare instances of certain builtin classes
      like KnownNat for obvious safety reasons --- when we use the
      constraint like `KnownNat T`, we want T to be associated to a natural
      number. However, due to the reuse of this code while processing backpack
      signatures, `instance KnownNat T` were being disallowed even in module
      signature files.
      
      There is an important difference when it comes to instance declarations
      in a signature file. Consider the signature `Abstract` given below
      
      ```
      signature Abstract where
        data T :: Nat
        instance KnownNat T
      
      ```
      
      Inside a signature like `Abstract`, the `instance Known T` is not really
      creating an instance but rather demanding any module that implements
      this signature to enforce the constraint `KnownNat` on its type
      T.  While hand crafted KnownNat instances continued to be prohibited in
      modules,
      this commit ensures that it is not forbidden while handling signatures.
      
      Resolving Dictionaries
      ----------------------------
      
      Normally GHC expects any instance `T` of class `KnownNat` to eventually
      resolve
      to an integer and hence used to generate the evidence/dictionary for
      such instances
      on the fly as in when it is required. However, when backpack module and
      signatures are involved
      It is not always possible to resolve the type to a concrete integer
      utill the mixin stage. To illustrate
      consider again the  signature `Abstract`
      
      > signature Abstract where
      >   data T :: Nat
      >   instance KnownNat T
      
      and a module `Util` that depends on it:
      
      > module Util where
      >     import Abstract
      >     printT :: IO ()
      >     printT = do print $ natVal (Proxy :: Proxy T)
      
      Clearly, we need to "use" the dictionary associated with `KnownNat T`
      in the module `Util`, but it is too early for the compiler to produce
      a real dictionary as we still have not fixed what `T` is. Only when we
      mixin a concrete module
      
      > module Concrete where
      >   type T = 42
      
      do we really get hold of the underlying integer.
      
      In this commit, we make the following changes in the resolution of
      instance dictionary
      for constraints like `KnownNat T`
      
      1. If T is indeed available as a type alias for an integer constant,
         generate the dictionary on the fly as before, failing which
      
      2. Do not give up as before but look up the type class environment for
      the evidence.
      
      This was enough to make the resolution of `KnownNat` dictionaries work
      in the setting of Backpack as
      when actual code is generated, the signature Abstract (due to the
      `import Abstract` ) in `Util` gets
      replaced by an actual module like Concrete, and resolution happens as
      before.
      
      Everything that we said for `KnownNat` is applicable for `KnownSymbol`
      as well.
      
      Reviewers: bgamari, ezyang, goldfire, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, ezyang, rwbarton, thomie, carter
      
      GHC Trac Issues: #15379
      
      Differential Revision: https://phabricator.haskell.org/D4988
      ce7a1c4a
  5. 10 Oct, 2018 2 commits
    • Ömer Sinan Ağacan's avatar
      Re-enable test T14251 · 2f693b3e
      Ömer Sinan Ağacan authored
      (This change was accidentally reverted with the previous commit)
      2f693b3e
    • Ömer Sinan Ağacan's avatar
      Fix dataToTag# argument evaluation · ac977688
      Ömer Sinan Ağacan authored
      See #15696 for more details. We now always enter dataToTag# argument (done in
      generated Cmm, in StgCmmExpr). Any high-level optimisations on dataToTag#
      applications are done by the simplifier. Looking at tag bits (instead of
      reading the info table) for small types is left to another diff.
      
      Incorrect test T14626 is removed. We no longer do this optimisation (see
      comment:44, comment:45, comment:60).
      
      Comments and notes about special cases around dataToTag# are removed. We no
      longer have any special cases around it in Core.
      
      Other changes related to evaluating primops (seq# and dataToTag#) will be
      pursued in follow-up diffs.
      
      Test Plan: Validates with three regression tests
      
      Reviewers: simonpj, simonmar, hvr, bgamari, dfeuer
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15696
      
      Differential Revision: https://phabricator.haskell.org/D5201
      ac977688
  6. 09 Oct, 2018 2 commits
  7. 07 Oct, 2018 5 commits
  8. 06 Oct, 2018 2 commits
    • Sergei Trofimovich's avatar
      UNREG: don't prefix asm prefixes in via-C mode · 4e3562c0
      Sergei Trofimovich authored
      commit 64c54fff
      ("Mark system and internal symbols as private symbols in asm")
      
      Added `internalNamePrefix` helper. Unfortunately it
      generates invalid label in unregisterised mode:
      
      ```
      $ ./configure --enable-unregisterised
      /tmp/ghc19372_0/ghc_4.hc:2831:22: error:
           error: expected identifier or '(' before '.' token
           static const StgWord .Lcl3_info[]__attribute__((aligned(8)))= {
                                ^
      ```
      
      Here asm-style prefix is applied to C symbol.
      The fix is simple: apply asm-style labels only to assembly code.
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      
      Reviewers: simonmar, last_g, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5207
      4e3562c0
    • Ömer Sinan Ağacan's avatar
      Add a missing write barrier to small array writes · 8be27c03
      Ömer Sinan Ağacan authored
      Write barriers for large array writes were added in D2525, as a part of #12469.
      However it seems we forgot about small arrays. This patch adds the same write
      barrier to small array writes.
      
      Reviewers: simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #12469
      
      Differential Revision: https://phabricator.haskell.org/D5209
      8be27c03
  9. 05 Oct, 2018 8 commits
    • David Feuer's avatar
      Stable name type role · 22872574
      David Feuer authored
      Make the `StableName#` parameter phantom:
      
      There is actually never any reason to care about the type of
      the underlying object of a `StableName#`. The underlying object
      type shouldn't really even *be* a parameter. But at least we
      can mark it as phantom.
      
      Reviewers: hvr, bgamari, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: ekmett, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5117
      22872574
    • Krzysztof Gogolewski's avatar
      Make TcRnMonad independent of TcSplice (#14391) · e5013a56
      Krzysztof Gogolewski authored
      Test Plan: validate
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14391
      
      Differential Revision: https://phabricator.haskell.org/D5135
      e5013a56
    • Tamar Christina's avatar
      Fix PE linker wibbles · 98daa34c
      Tamar Christina authored
      Fix some various issues that popped up because the linker now doesn't
      load import libraries for longer than it needs to.
      
      These are all use after free issues.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5175
      98daa34c
    • Tamar Christina's avatar
      Update performance numbers on Windows · baec3586
      Tamar Christina authored
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5176
      baec3586
    • Kavon Farvardin's avatar
      Multiple fixes / improvements for LLVM backend · adcb5fb4
      Kavon Farvardin authored
      - Fix for #13904 -- stop "trashing" callee-saved registers, since it is
        not actually doing anything useful.
      
      - Fix for #14251 -- fixes the calling convention for functions passing
        raw SSE-register values by adding padding as needed to get the values
        in the right registers. This problem cropped up when some args were
        unused an dropped from the live list.
      
      - Fixed a typo in 'readnone' attribute
      
      - Added 'lower-expect' pass to level 0 LLVM optimization passes to
        improve block layout in LLVM for stack checks, etc.
      
      Test Plan: `make test WAYS=optllvm` and `make test WAYS=llvm`
      
      Reviewers: bgamari, simonmar, angerman
      
      Reviewed By: angerman
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #13904, #14251
      
      Differential Revision: https://phabricator.haskell.org/D5190
      adcb5fb4
    • Vladislav Zavialov's avatar
      Add -Wstar-is-type to the User's Guide · 07083fc4
      Vladislav Zavialov authored
      The -Wstar-is-type flag was added without documentation.
      Now it has documentation.
      
      Test Plan: Validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5203
      07083fc4
    • Ben Gamari's avatar
      testsuite: Skip T3171 for now · 817ba0cf
      Ben Gamari authored
      This test is remarkably flaky, failing regularly on i386/Linux,
      amd64/Fedora, and amd64/Darwin. I've opened #15383 to track this and am
      disabling the test for now until we have a chance to investigate.
      
      Test Plan: Validate
      
      Reviewers: alpmestan
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15383
      
      Differential Revision: https://phabricator.haskell.org/D5202
      817ba0cf
    • Ben Gamari's avatar
      Bump Cabal submodule · fa1c8279
      Ben Gamari authored
      fa1c8279
  10. 04 Oct, 2018 8 commits
    • Ryan Scott's avatar
      Don't leak internal commentary into HasField's Haddocks · 89656c21
      Ryan Scott authored
      In commit 2f09753f, some internal comments about the kind
      signature of the HasField class accidentially leaked into its
      publicly exported Haddocks.
      89656c21
    • Alec Theriault's avatar
      Set `infixr -1 ->` · 251e3424
      Alec Theriault authored
      Summary:
      This simply makes explicit what is already the case. Due to special
      treatment in the parser, `->` has the lowest fixity. This patch propagates
      that information to:
      
        * GHCi, where `:info ->` now return the right fixity
        * TH, where `reifyFixity` returns the right fixity
        * the generated sources for `GHC.Prim`
      
      See #15235.
      
      Test Plan: make test
      
      Reviewers: bgamari, alanz, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: int-index, RyanGlScott, rwbarton, mpickering, carter
      
      GHC Trac Issues: #15235
      
      Differential Revision: https://phabricator.haskell.org/D5199
      251e3424
    • Alec Theriault's avatar
      Don't drop arguments in TH type arguments · ba163c3b
      Alec Theriault authored
      Summary:
      When converting from TH AST back to HsType, we were occasionally
      dropping type arguments. This resulted in incorrectly accepted programs
      as well as incorrectly rejected programs.
      
      Test Plan: make TEST=T15360a && make TEST=T15360b
      
      Reviewers: goldfire, bgamari, tdammers
      
      Reviewed By: bgamari, tdammers
      
      Subscribers: RyanGlScott, rwbarton, carter
      
      GHC Trac Issues: #15360
      
      Differential Revision: https://phabricator.haskell.org/D5188
      ba163c3b
    • Alec Theriault's avatar
      Allow (unparenthesized) kind signatures · bace26aa
      Alec Theriault authored
      Summary: This allows for things like `[t :: MyKind]`, `(a :: k, b)`, and so on.
      
      Test Plan: make TEST=T11622 && make TEST=T8708
      
      Reviewers: RyanGlScott, bgamari, simonpj, goldfire, alanz
      
      Reviewed By: RyanGlScott, simonpj
      
      Subscribers: alanz, simonpj, rwbarton, mpickering, carter
      
      GHC Trac Issues: #11622, #8708
      
      Differential Revision: https://phabricator.haskell.org/D5173
      bace26aa
    • Alec Theriault's avatar
      Documentation fixes in 'template-haskell' · 85376570
      Alec Theriault authored
      Summary:
       * Clarify the non-presence of derived classes in reified decls (#15167)
       * Clarify the shallowness of "reifyInstances" (#7066)
       * Mention that 'Typeable' instances are not found by reifyInstances (#11251)
       * Various Haddock markup issues fixed
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15167, #7066, #11251
      
      Differential Revision: https://phabricator.haskell.org/D5197
      85376570
    • Alec Theriault's avatar
      Improve generated `GHC.Prim` docs · feb8a671
      Alec Theriault authored
      Summary:
      * Extended `genprimcode` to generate Haddock-compatible deprecations,
        as well as displaying information about which functions are LLVM-only
        and which functions can fail with an unchecked exception.
      
      * Ported existing deprecations to the new format, and also added a
        deprecation on `par#` (see Trac #15227).
      
      * Emit an error on fixity/deprecation of builtins, unless we are
        processing the module in which that name is defined (see Trac #15233).
        That means the following is no longer accepted (outside of `GHC.Types`):
      
      ```
      infixr 7 :
      {-# DEPRECATED (:) "cons is deprecated" #-}
      ```
      
      * Generate `data (->) a b` with docs and fixity in `GHC.Prim`. This
        means: GHC can now parse `data (->) a b` and `infixr 0 ->` (only in
        `GHC.Prim`) and `genprimcode` can digest `primtype (->) a b` (See Trac
        #4861)
      
      as well as some misc fixes along the way.
      
      Reviewers: bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, mpickering, carter
      
      GHC Trac Issues: #15227, #15233, #4861
      
      Differential Revision: https://phabricator.haskell.org/D5167
      feb8a671
    • Alec Theriault's avatar
      Document the list data type · 60b547b5
      Alec Theriault authored
      Summary: Also qualified some identifier hyperlinks along the way.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #4861
      
      Differential Revision: https://phabricator.haskell.org/D5158
      60b547b5
    • Simon Peyton Jones's avatar
      tc-trace changes only · d25519e1
      Simon Peyton Jones authored
      d25519e1