1. 22 Nov, 2018 37 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
    • Alec Theriault's avatar
      Doc-only fixes · a1bbb56f
      Alec Theriault authored
      * laws are capitalized definition lists, no emphasis on the labels
      * adds missing hyperlinks
      * fixes other misc. Haddock markup issues.
      a1bbb56f
    • Peter Trommler's avatar
      9f3e22b9
    • Dario Bertini's avatar
      25489085
    • Dario Bertini's avatar
      rts/MachO: A bit of refactoring in ocGetNames · b2f6f896
      Dario Bertini authored
      Eliminates a bit of repetition.
      b2f6f896
    • Dario Bertini's avatar
      9e0a23b9
    • Dario Bertini's avatar
      circleci: Actually build with in-tree GMP on Darwin · 3584bd42
      Dario Bertini authored
      Fixes #15404.
      3584bd42
    • 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
    • Alec Theriault's avatar
      Hadrian: Misc. fixes in Haddock rules · ff619555
      Alec Theriault authored
      * Pass 'GHC/Prim.hs' to Haddock when processing 'ghc-prim'. This
        file is autogenerated for the sole purpose of giving Haddock
        something to process, so we really should make sure it gets
        through to Haddock!
      
      * Add a "docs-haddock" build rule, which should build all Haddock docs
        that the Makefile builds by default (all libs + index for libs + ghc)
      
      * Prune some unnecessary rules (esp. `gen_contents_index`)
      
      Reviewers: bgamari, snowleopard
      
      Reviewed By: snowleopard
      
      Subscribers: alpmestan, snowleopard, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5316
      ff619555
    • 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 uninformative hp2ps error when the cmdline contains double quotes · 390df8b5
      Zejun Wu authored
      The format of hp file didn't allow double quotes inside strings, and
      under prof build, we include args in JOB, which may have double quotes.
      When this happens, the error message is confusing to the user. This can
      also happen under normal build if the executable name contains double
      quite, which is unlikely though.
      
      We fix this issue by introducing escaping for double quotes inside a
      string by repeating it twice.
      
      We also fix a buffer overflow bug when the length of the string happen
      to be multiple of 5000.
      
      Test Plan:
      new tests, which used to fail with error message:
      
      ```
      hp2ps: "T15904".hp, line 2: integer must follow identifier
      ```
      
      use new ghc and hp2ps to profile a simple program.
      
      Reviewers: simonmar, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15904
      
      Differential Revision: https://phabricator.haskell.org/D5346
      390df8b5
    • Christiaan Baaij's avatar
      Load plugins in interactive session · 599eaada
      Christiaan Baaij authored
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: monoidal, rwbarton, carter
      
      GHC Trac Issues: #15633
      
      Differential Revision: https://phabricator.haskell.org/D5348
      599eaada
    • 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
    • Christiaan Baaij's avatar
      plugins10 no longer broken · 1f74f7dd
      Christiaan Baaij authored
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15216
      
      Differential Revision: https://phabricator.haskell.org/D5350
      1f74f7dd
    • Alp Mestanogullari's avatar
      rts.cabal.in: force inclusion of findPtr/_findPtr symbol only with debug flag · 561748cb
      Alp Mestanogullari authored
      The previous strategy caused problems on Windows, as pointed out
      at [1]
      
      [1]: https://phabricator.haskell.org/rGHC900c47f88784#133905
      
      Reviewers: Phyx, bgamari, erikd, simonmar
      
      Reviewed By: Phyx
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15671
      
      Differential Revision: https://phabricator.haskell.org/D5356
      561748cb
    • Alec Theriault's avatar
      Hadrian: work around Cabal's/GHC's different Arch/OS strings · 19ffddc1
      Alec Theriault authored
      The path to the 'include' subdirectory of 'rts' includes a folder that
      whose name is generated by Cabal and mentiones the architecture and OS.
      For example:
      
          _build/stage1/lib/x86_64-osx-ghc-8.7.20181120/rts-1.0/include
      
      Hadrian needs to be aware that Cabal renders architectures and OSes in
      a slightly different way than GHC. There is already symmetric logic in
      Cabal (for working with GHC environment files, which follow GHC's naming
      conventions).
      
      Test Plan: ./hadrian/build.sh -c "binary-dist" # on mac
      
      Reviewers: snowleopard, alpmestan, bgamari
      
      Reviewed By: snowleopard
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15922
      
      Differential Revision: https://phabricator.haskell.org/D5361
      19ffddc1
    • Tamar Christina's avatar
      rts: fix Windows megablock allocator · 676f1f2d
      Tamar Christina authored
      The megablock allocator does not currently check that after aligning the
      free region if it still has enough space to actually do the allocation.
      
      This causes it to return a memory region which it didn't fully allocate
      itself.  Even worse, it can cause it to return a block with a region
      that will be present in two allocation pools.
      
      This causes if you're lucky an error from the OS that you're committing
      memory that has never been reserved, or causes random heap corruption.
      
      This change makes it consider the alignment as well.
      
      Test Plan: ./validate , testcase testmblockalloc
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5363
      676f1f2d
    • 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
    • Tamar Christina's avatar
      testuite: update more windows tests outputs · 67277e7c
      Tamar Christina authored
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5362
      67277e7c
    • Tamar Christina's avatar
      rts: Fix bss initialization on Windows · 06a09a5b
      Tamar Christina authored
      This patch fixes BSS initialization such that it is
      initialized to 0 as you'd expect.
      
      Test Plan: ./validate, test T7040_ghci
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15669
      
      Differential Revision: https://phabricator.haskell.org/D5364
      06a09a5b
    • Ben Gamari's avatar
      rts/M32Alloc: Abort if m32 linker mmap fails · 86f6890e
      Ben Gamari authored
      Previously we should just blinding dereference a NULL pointer.
      86f6890e
    • Matthew Pickering's avatar
      Add test for #15437 · ea015172
      Matthew Pickering authored
      Reviewers: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15437
      
      Differential Revision: https://phabricator.haskell.org/D5291
      ea015172
    • Ben Gamari's avatar
      base: Mention openFile throwing does-not-exist-errors on FIFOs · 4ba3fa31
      Ben Gamari authored
      As discussed in #15715, the POSIX specification specifies that
      attempting to open a FIFO in write-only mode when the FIFO has no
      readers will fail with -ENOENT.
      
      [skip ci]
      
      Test Plan: Read it
      
      Reviewers: hvr
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15715
      
      Differential Revision: https://phabricator.haskell.org/D5295
      4ba3fa31
    • Krzysztof Gogolewski's avatar
      Fix GhostScript detection (Trac #15856) · 011e39d7
      Krzysztof Gogolewski authored
      The option `confdir` (used in GhostScript test) was set correctly
      via `--config` in `test.mk` and incorrectly via `config/ghc`.
      AFAICT, some time ago this was working because the
      incorrect assignment was done first, and later it broke.
      
      Hardian doesn't pass `confdir`. I removed `confdir` and use
      `config.top` to determine the directory of the
      `good.ps` and `bad.ps` files. This is simpler.
      
      I also removed some redundant assignments in `config/ghc`.
      
      Test Plan: manually set config.have_profiling and make test
      
      Reviewers: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15856
      
      Differential Revision: https://phabricator.haskell.org/D5298
      011e39d7
    • 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
    • Ben Gamari's avatar
      users guide: We no longer build libraries with -split-objs · f5fbecc8
      Ben Gamari authored
      We now generally use split-sections instead.
      f5fbecc8
    • 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. 21 Nov, 2018 1 commit
    • Ömer Sinan Ağacan's avatar
      Fix heap corruption during stable name allocation · 691aa715
      Ömer Sinan Ağacan authored
      See #15906 for the problem. To fix we simply call `allocate()` instead of
      `ALLOC_PRIM()`. `allocate()` does not trigger GC when the nursery is full,
      instead it extends it.
      
      Test Plan:
      This validates. memo001 now passes with `-debug` compile parameter. I'll add
      another test that runs memo001 with `-debug` once I figure out how to use
      stdout files for multiple tests.
      
      Reviewers: simonmar, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15906
      
      Differential Revision: https://phabricator.haskell.org/D5342
      691aa715
  3. 20 Nov, 2018 1 commit
  4. 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