1. 22 Nov, 2018 18 commits
    • David Eichmann's avatar
      Fix unused-import warnings · 6353efc7
      David Eichmann authored
      This patch fixes a fairly long-standing bug (dating back to 2015) in
      RdrName.bestImport, namely
      
         commit 9376249b
         Author: Simon Peyton Jones <simonpj@microsoft.com>
         Date:   Wed Oct 28 17:16:55 2015 +0000
      
         Fix unused-import stuff in a better way
      
      In that patch got the sense of the comparison back to front, and
      thereby failed to implement the unused-import rules described in
        Note [Choosing the best import declaration] in RdrName
      
      This led to Trac #13064 and #15393
      
      Fixing this bug revealed a bunch of unused imports in libraries;
      the ones in the GHC repo are part of this commit.
      
      The two important changes are
      
      * Fix the bug in bestImport
      
      * Modified the rules by adding (a) in
           Note [Choosing the best import declaration] in RdrName
        Reason: the previosu rules made Trac #5211 go bad again.  And
        the new rule (a) makes sense to me.
      
      In unravalling this I also ended up doing a few other things
      
      * Refactor RnNames.ImportDeclUsage to use a [GlobalRdrElt] for the
        things that are used, rather than [AvailInfo]. This is simpler
        and more direct.
      
      * Rename greParentName to greParent_maybe, to follow GHC
        naming conventions
      
      * Delete dead code RdrName.greUsedRdrName
      
      Bumps a few submodules.
      
      Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5312
      6353efc7
    • Krzysztof Gogolewski's avatar
      Don't pass -no-pie when -pgmc is supplied · 8d008b71
      Krzysztof Gogolewski authored
      Test Plan: validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15319
      
      Differential Revision: https://phabricator.haskell.org/D5317
      8d008b71
    • Alec Theriault's avatar
      Simplify 'ExtBits' in the lexer · d2fbc33c
      Alec Theriault authored
      The main change is to export 'ExtBits' instead of defining/exporting a
      bunch of boilerplate functions that test for a particular 'ExtBits'.
      In the process, I also
      
        * cleaned up an unneeded special case for 'ITstatic'
        * made 'UsePosPrags' another variant of 'ExtBits'
        * made the logic in 'reservedSymsFM' match that of 'reservedWordsFM'
      
      Test Plan: make test
      
      Reviewers: bgamari, alanz
      
      Subscribers: sjakobi, rwbarton, mpickering, carter
      
      Differential Revision: https://phabricator.haskell.org/D5332
      d2fbc33c
    • Alec Theriault's avatar
      'DynFlag'-free version of 'mkParserFlags' · 5aa29231
      Alec Theriault authored
      Obtaining a `DynFlags` is difficult, making using the lexer/parser
      for pure parsing/lexing unreasonably difficult, even with
      `mkPStatePure`.
      This is despite the fact that we only really need
      
        * language extension flags
        * warning flags
        * a handful of boolean options
      
      The new `mkParserFlags'` function makes is easier to directly construct
      a `ParserFlags`. Furthermore, since `pExtsBitmap` is just a footgun,
      I've gone ahead and made `ParserFlags` an abstract type.
      
      Reviewers: bgamari, alanz, sjakobi
      
      Reviewed By: bgamari, sjakobi
      
      Subscribers: mpickering, sjakobi, rwbarton, carter
      
      GHC Trac Issues: #11301
      
      Differential Revision: https://phabricator.haskell.org/D5269
      5aa29231
    • Peter Trommler's avatar
      9f3e22b9
    • Gabor Greif's avatar
      llvmGen: Eliminate duplicate definition · d0fc7618
      Gabor Greif authored
      remove local
      d0fc7618
    • Jessica Clarke's avatar
      UNREG: PprC: Add support for adjacent floats · 35a89778
      Jessica Clarke authored
      When two 32-bit floats are adjacent for a 64-bit target, there is no
      padding between them to force alignment, so we must combine their bit
      representations into a single word.
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15853
      
      Differential Revision: https://phabricator.haskell.org/D5306
      35a89778
    • Ryan Scott's avatar
      Overhaul -fprint-explicit-kinds to use VKA · f5d20838
      Ryan Scott authored
      This patch changes the behavior of `-fprint-explicit-kinds`
      so that it displays kind argument using visible kind application.
      In other words, the flag now:
      
      1. Prints instantiations of specified variables with `@(...)`.
      2. Prints instantiations of inferred variables with `@{...}`.
      
      In addition, this patch removes the `Use -fprint-explicit-kinds to
      see the kind arguments` error message that often arises when a type
      mismatch occurs due to different kinds. Instead, whenever there is a
      kind mismatch, we now enable the `-fprint-explicit-kinds` flag
      locally to help cue to the programmer where the error lies.
      (See `Note [Kind arguments in error messages]` in `TcErrors`.)
      As a result, these funny `@{...}` things can now appear to the user
      even without turning on the `-fprint-explicit-kinds` flag explicitly,
      so I took the liberty of documenting them in the users' guide.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15871
      
      Differential Revision: https://phabricator.haskell.org/D5314
      f5d20838
    • Simon Jakobi's avatar
      Remove warnings-silencing flags for code generated by Alex · 699e5072
      Simon Jakobi authored
      Current versions of Alex don't seem to produce as many warnings any
      more.
      
      In order to silence a warning and to avoid overlong lines, I've taken
      the liberty of refactoring 'tok_num'.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: erikd, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5319
      699e5072
    • Roland Senn's avatar
      Calling gcc: Pass optc flags as last options (#14452) · f2d9fb0c
      Roland Senn authored
      Test Plan: make test TEST=T14452
      
      Reviewers: hvr, bgamari, monoidal, thomie, osa1
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14452
      
      Differential Revision: https://phabricator.haskell.org/D5318
      f2d9fb0c
    • Ryan Scott's avatar
      Fix #15852 by eta expanding data family instance RHSes, too · 014d6c1f
      Ryan Scott authored
      When I defined `etaExpandFamInstLHS`, I blatantly forgot
      to eta expand the RHSes of data family instances. (Actually, I
      claimed that they didn't //need// to be eta expanded. I'm not sure
      what I was thinking.)
      
      This fixes the issue by changing `etaExpandFamInstLHS` to
      `etaExpandFamInst` and, well, making it actually eta expand the RHS.
      
      Test Plan: make test TEST=T15852
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15852
      
      Differential Revision: https://phabricator.haskell.org/D5328
      014d6c1f
    • Simon Jakobi's avatar
      Refactor TcRnMonad.mapAndRecoverM · 66f0056a
      Simon Jakobi authored
      This version doesn't require the 'reverse' step after the monadic
      fold.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: monoidal, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5343
      66f0056a
    • Zejun Wu's avatar
      Fix deadlock bug when mkFastStringWith is duplicated · f088c2d4
      Zejun Wu authored
      In D5211, we use `withMVar` to guard writes to the same segment, this
      is unsafe to be duplicated. It can lead to deadlock if it is only run
      partially and `putMVar` is not called after `takeMVar`.
      
      Test Plan:
        ./validate
      
      We used to see deadlock when building stackage without this fix, and it
      no longer happens.
      
      Reviewers: simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5349
      f088c2d4
    • Simon Jakobi's avatar
      Don't reverse explicit export lists during renaming · 7cba71fc
      Simon Jakobi authored
      This will be useful for Hi Haddock / D5067.
      
      Previously any export list in 'tcg_rn_exports' would be in reverse
      order.
      
      Also remove a redundant setSrcSpan.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5347
      7cba71fc
    • Andreas Klebinger's avatar
      Fixup the new code layout patch for SplitObjs. · 6c26b3f8
      Andreas Klebinger authored
      When splitting objects we sometimes generate
      dummy CmmProcs containing bottom in some fields.
      
      Code introduced in the new code layout patch looked
      at these which blew up the compiler. Now we instead
      check first if the function actually contains code.
      
      Reviewers: bgamari
      
      Subscribers: simonpj, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5357
      6c26b3f8
    • Sylvain Henry's avatar
      Rename literal constructors · 13bb4bf4
      Sylvain Henry authored
      In a previous patch we replaced some built-in literal constructors
      (MachInt, MachWord, etc.) with a single LitNumber constructor.
      
      In this patch we replace the `Mach` prefix of the remaining constructors
      with `Lit` for consistency (e.g., LitChar, LitLabel, etc.).
      
      Sadly the name `LitString` was already taken for a kind of FastString
      and it would become misleading to have both `LitStr` (literal
      constructor renamed after `MachStr`) and `LitString` (FastString
      variant). Hence this patch renames the FastString variant `PtrString`
      (which is more accurate) and the literal string constructor now uses the
      least surprising `LitString` name.
      
      Both `Literal` and `LitString/PtrString` have recently seen breaking
      changes so doing this kind of renaming now shouldn't harm much.
      
      Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27, tdammers
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4881
      13bb4bf4
    • Gabor Greif's avatar
      Minor performance optimisation · 8707911a
      Gabor Greif authored
      only concat once
      8707911a
    • Gabor Greif's avatar
      another minor refactoring · 4343d5af
      Gabor Greif authored
      4343d5af
  2. 20 Nov, 2018 1 commit
  3. 19 Nov, 2018 1 commit
    • Sebastian Graf's avatar
      Don't track free variables in STG syntax by default · 47bbc709
      Sebastian Graf authored
      Summary:
      Currently, `CoreToStg` annotates `StgRhsClosure`s with their set of non-global
      free variables.  This free variable information is only needed in the final
      code generation step (i.e. `StgCmm.codeGen`), which leads to transformations
      such as `StgCse` and `StgUnarise` having to maintain this information.
      
      This is tiresome and unnecessary, so this patch introduces a trees-to-grow-like
      approach that only introduces the free variable set into the syntax tree in the
      code gen pass, along with a free variable analysis on STG terms to generate
      that information.
      
      Fixes #15754.
      
      Reviewers: simonpj, osa1, bgamari, simonmar
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15754
      
      Differential Revision: https://phabricator.haskell.org/D5324
      47bbc709
  4. 18 Nov, 2018 1 commit
    • Chris Done's avatar
      Fix typo in docs · ecfc7b46
      Chris Done authored
      I've been reading this line of docs for years and it ruffles my feathers.
      ecfc7b46
  5. 17 Nov, 2018 8 commits
    • Abhiroop Sarkar's avatar
      Introduce Int16# and Word16# · 36fcf9ed
      Abhiroop Sarkar authored
      This builds off of D4475.
      
      Bumps binary submodule.
      
      Reviewers: carter, AndreasK, hvr, goldfire, bgamari, simonmar
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D5006
      36fcf9ed
    • Chris Smith's avatar
      Fix trac #15702, as a followon to fix for #13704. · 0e7790ab
      Chris Smith authored
      Summary:
      The effect of this change is that -main-is changes the default
      export list for the main module, but does not apply the same
      change to non-main modules.  This fixes some cases where -main-is
      was used to wrap a module that expected that default behavior
      (exporting `main`, even when that wasn't the main entry point
      name).
      
      Reviewers: mpickering, monoidal, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #13704, #15702
      
      Differential Revision: https://phabricator.haskell.org/D5322
      0e7790ab
    • Gabor Greif's avatar
      798c9437
    • Sebastian Graf's avatar
      More compact Outputable instance for `Uniq(D)Set` · 17e771e1
      Sebastian Graf authored
      Summary:
      Until now, `UniqSet` and `UniqDSet` inherited their `Outputable`
      instances from `UniqFM` and `UniqDFM`.
      
      That made for verbose and redundant output. This patch rectifies
      that by pretty-printing these sets in common math notation.
      E.g., previously, we would render `UniqSet`s like this:
      
          [s2fE :-> x_s2fE, s2fF :-> y_s2fF, s2fG :-> z_s2fG, s2fH :-> g_s2fH]
      
      Now, they're are printed like this:
      
          {x_s2fE, y_s2fF, z_s2fG, g_s2fH}
      
      Reviewers: simonpj, bgamari, AndreasK, dfeuer, osa1
      
      Reviewed By: osa1
      
      Subscribers: osa1, rwbarton, carter
      
      GHC Trac Issues: #15879
      
      Differential Revision: https://phabricator.haskell.org/D5315
      17e771e1
    • Simon Jakobi's avatar
      Speed up MonadUtils.mapMaybeM · 5bf07866
      Simon Jakobi authored
      Summary: This version is nearly 2x faster according to a few small benchmarks.
      
      Reviewers: bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5344
      5bf07866
    • Roland Senn's avatar
      Fix #12906: GHC fails to typecheck Main module without main · 92f81841
      Roland Senn authored
      Summary: The function fail is no longer called immediately
      after adding the no-main error message to the TcM monad.
      The rest of the module will be typechecked.
      
      Test Plan: make test TEST=T12906
      
      Reviewers: dfeuer, RyanGlScott, ezyang, mpickering, bgamari
      
      Reviewed By: RyanGlScott
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #12906
      
      Differential Revision: https://phabricator.haskell.org/D5338
      92f81841
    • Krzysztof Gogolewski's avatar
      Building GHC with hadrian on FreeBSD · 65517979
      Krzysztof Gogolewski authored
      Summary: I'm currently trying to make `hadrian` work as a build system
      on FreeBSD (https://ghc.haskell.org/trac/ghc/ticket/15860).
      I'm still having some issues with `libgmp` but one can get a working
      `ghc` using `--integer-simple` and this patch.
      
      Reviewers: bgamari, erikd, alpmestan
      
      Reviewed By: alpmestan
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5335
      65517979
    • Andreas Klebinger's avatar
      NCG: New code layout algorithm. · 912fd2b6
      Andreas Klebinger authored
      Summary:
      This patch implements a new code layout algorithm.
      It has been tested for x86 and is disabled on other platforms.
      
      Performance varies slightly be CPU/Machine but in general seems to be better
      by around 2%.
      Nofib shows only small differences of about +/- ~0.5% overall depending on
      flags/machine performance in other benchmarks improved significantly.
      
      Other benchmarks includes at least the benchmarks of: aeson, vector, megaparsec, attoparsec,
      containers, text and xeno.
      
      While the magnitude of gains differed three different CPUs where tested with
      all getting faster although to differing degrees. I tested: Sandy Bridge(Xeon), Haswell,
      Skylake
      
      * Library benchmark results summarized:
        * containers: ~1.5% faster
        * aeson: ~2% faster
        * megaparsec: ~2-5% faster
        * xml library benchmarks: 0.2%-1.1% faster
        * vector-benchmarks: 1-4% faster
        * text: 5.5% faster
      
      On average GHC compile times go down, as GHC compiled with the new layout
      is faster than the overhead introduced by using the new layout algorithm,
      
      Things this patch does:
      
      * Move code responsilbe for block layout in it's own module.
      * Move the NcgImpl Class into the NCGMonad module.
      * Extract a control flow graph from the input cmm.
      * Update this cfg to keep it in sync with changes during
        asm codegen. This has been tested on x64 but should work on x86.
        Other platforms still use the old codelayout.
      * Assign weights to the edges in the CFG based on type and limited static
        analysis which are then used for block layout.
      * Once we have the final code layout eliminate some redundant jumps.
      
        In particular turn a sequences of:
            jne .foo
            jmp .bar
          foo:
        into
            je bar
          foo:
            ..
      
      Test Plan: ci
      
      Reviewers: bgamari, jmct, jrtc27, simonmar, simonpj, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, trommler, jmct, carter, thomie, rwbarton
      
      GHC Trac Issues: #15124
      
      Differential Revision: https://phabricator.haskell.org/D4726
      912fd2b6
  6. 15 Nov, 2018 4 commits
    • Simon Peyton Jones's avatar
      Smarter HsType pretty-print for promoted datacons · ae2c9b40
      Simon Peyton Jones authored
      Fix Trac #15898, by being smarter about when to print
      a space before a promoted data constructor, in a HsType.
      I had to implement a mildly tiresome function
          HsType.lhsTypeHasLeadingPromotionQuote
      It has multiple cases, of course, but it's very simple.
      
      The patch improves the error-message output in a bunch of
      cases, and (to my surprise) actually fixes a bug in the
      output of T14343 (Trac #14343), thus
      
        -  In the expression: _ :: Proxy '('( 'True,  'False),  'False)
        +  In the expression: _ :: Proxy '( '( 'True, 'False), 'False)
      
      I discovered that there were two copies of the PromotionFlag
      type (a boolean, with helpfully named data cons), one in
      IfaceType and one in HsType.  So I combined into one,
      PromotionFlag, and moved it to BasicTypes.  That's why
      quite a few files are touched, but it's all routine.
      ae2c9b40
    • Simon Peyton Jones's avatar
      0ce66be9
    • Simon Peyton Jones's avatar
      Comments only, about polykinded TyConApps · fe057642
      Simon Peyton Jones authored
      See Trac #15704 comment:8ff
      fe057642
    • Simon Marlow's avatar
      Fix a bug in SRT generation (#15892) · eb46345d
      Simon Marlow authored
      Summary:
      The logic in `Note [recursive SRTs]` was correct. However, my
      implementation of it wasn't: I got the associativity of
      `Set.difference` wrong, which led to an extremely subtle and difficult
      to find bug.
      
      Fortunately now we have a test case. I was able to cut down the code
      to something manageable, and I've added it to the test suite.
      
      Test Plan:
      Before (using my stage 1 compiler without the fix):
      
      ```
      ====> T15892(normal) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
      T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output  -O
      cd "T15892.run" && ./T15892  +RTS -G1 -A32k -RTS
      Wrong exit code for T15892(normal)(expected 0 , actual 134 )
      Stderr ( T15892 ):
      T15892: internal error: evacuate: strange closure type 0
          (GHC version 8.7.20181113 for x86_64_unknown_linux)
          Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      Aborted (core dumped)
      *** unexpected failure for T15892(normal)
      =====> T15892(g1) 1 of 1 [0, 1, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
      T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output  -O
      cd "T15892.run" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS
      Wrong exit code for T15892(g1)(expected 0 , actual 134 )
      Stderr ( T15892 ):
      T15892: internal error: evacuate: strange closure type 0
          (GHC version 8.7.20181113 for x86_64_unknown_linux)
          Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      Aborted (core dumped)
      ```
      
      After (using my stage 2 compiler with the fix):
      
      ```
      =====> T15892(normal) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
      -o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output
      cd "T15892.run" && ./T15892  +RTS -G1 -A32k -RTS
      =====> T15892(g1) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
      -o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output
      cd "T15892.run" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS
      ```
      
      Reviewers: bgamari, osa1, erikd
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15892
      
      Differential Revision: https://phabricator.haskell.org/D5334
      eb46345d
  7. 13 Nov, 2018 1 commit
    • Sebastian Graf's avatar
      Make `UniqDSet` a newtype · 5b98a38a
      Sebastian Graf authored
      Summary:
      This brings the situation of `UniqDSet` in line with `UniqSet`.
      
      @dfeuer said in D3146#92820 that he would do this, but probably
      never got around to it.
      
      Validated locally.
      
      Reviewers: AndreasK, mpickering, bgamari, dfeuer, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter, dfeuer
      
      GHC Trac Issues: #15879, #13114
      
      Differential Revision: https://phabricator.haskell.org/D5313
      5b98a38a
  8. 12 Nov, 2018 3 commits
    • Alp Mestanogullari's avatar
      compareByPreference: handle the integer-gmp vs -simple case · 86ee74dc
      Alp Mestanogullari authored
      Currently, it assumes the package names are identical and this
      breaks in the case where integer-gmp is in one package db and
      integer-simple in another. This became a problem with
      the commit: fc2ff6dd.
      
      Instead of following the precedence information, leading to
      the right choice, the current code would compare the
      integer-gmp and integer-simple versions and pick integer-gmp
      because it happened to have a greater version, despite having
      a lower precedence. See
      https://github.com/snowleopard/hadrian/issues/702 for
      a comprehensive report about the problem.
      
      This effectively un-breaks integer-simple builds with hadrian.
      
      Test Plan: hadrian/build.sh --integer-simple
      
      Reviewers: snowleopard, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: snowleopard, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5266
      86ee74dc
    • Ömer Sinan Ağacan's avatar
      Remove StgBinderInfo and related computation in CoreToStg · d30352ad
      Ömer Sinan Ağacan authored
      - The StgBinderInfo type was never used in the code gen, so the type, related
        computation in CoreToStg, and some comments about it are removed. See #15770
        for more details.
      
      - Simplified CoreToStg after removing the StgBinderInfo computation: removed
        StgBinderInfo arguments and mfix stuff.
      
      The StgBinderInfo values were not used in the code gen, but I still run nofib
      just to make sure: 0.0% change in allocations and binary sizes.
      
      Test Plan: Validated locally
      
      Reviewers: simonpj, simonmar, bgamari, sgraf
      
      Reviewed By: sgraf
      
      Subscribers: AndreasK, sgraf, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5232
      d30352ad
    • Edward Z. Yang's avatar
      Fix #15594 (--abi-hash with Backpack sometimes fails) · 13ff0b7c
      Edward Z. Yang authored
      Summary:
      For holes, its necessary to "see through" the instantiation
      of the hole to get accurate family instance dependencies.
      For example, if B imports <A>, and <A> is instantiated with
      F, we must grab and include all of the dep_finsts from
      F to have an accurate transitive dep_finsts list.
      
      However, we MUST NOT do this for regular modules.
      First, for efficiency reasons, doing this
      bloats the the dep_finsts list, because we *already* had
      those modules in the list (it wasn't a hole module, after
      all). But there's a second, more important correctness
      consideration: we perform module renaming when running
      --abi-hash.  In this case, GHC's contract to the user is that
      it will NOT go and read out interfaces of any dependencies
      (https://github.com/haskell/cabal/issues/3633); the point of
      --abi-hash is just to get a hash of the on-disk interfaces
      for this *specific* package.  If we go off and tug on the
      interface for /everything/ in dep_finsts, we're gonna have a
      bad time.  (It's safe to do do this for hole modules, though,
      because the hmap for --abi-hash is always trivial, so the
      interface we request is local.  Though, maybe we ought
      not to do it in this case either...)
      Signed-off-by: default avatarEdward Z. Yang <ezyang@fb.com>
      
      Test Plan: validate
      
      Reviewers: alexbiehl, goldfire, bgamari
      
      Subscribers: ppk, shlevy, rwbarton, carter
      
      GHC Trac Issues: #15594
      
      Differential Revision: https://phabricator.haskell.org/D5123
      13ff0b7c
  9. 11 Nov, 2018 2 commits
  10. 08 Nov, 2018 1 commit
    • Ryan Scott's avatar
      Fix #15845 by defining etaExpandFamInstLHS and using it · 63a81707
      Ryan Scott authored
      Summary:
      Both #9692 and #14179 were caused by GHC being careless
      about using eta-reduced data family instance axioms. Each of those
      tickets were fixed by manually whipping up some code to eta-expand
      the axioms. The same sort of issue has now caused #15845, so I
      figured it was high time to factor out the code that each of these
      fixes have in common.
      
      This patch introduces the `etaExpandFamInstLHS` function, which takes
      a family instance's type variables, LHS types, and RHS type, and
      returns type variables and LHS types that have been eta-expanded if
      necessary, in the case of a data family instance. (If it's a type
      family instance, `etaExpandFamInstLHS` just returns the supplied type
      variables and LHS types unchanged).
      
      Along the way, I noticed that many references to
      `Note [Eta reduction for data families]` (in `FamInstEnv`) had
      slightly bitrotted (they either referred to a somewhat different
      name, or claimed that the Note lived in a different module), so
      I took the liberty of cleaning those up.
      
      Test Plan: make test TEST="T9692 T15845"
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15845
      
      Differential Revision: https://phabricator.haskell.org/D5294
      63a81707