1. 18 Mar, 2019 1 commit
  2. 15 Mar, 2019 1 commit
  3. 07 Mar, 2019 1 commit
    • Phuong Trinh's avatar
      Fix #16392: revertCAFs in external interpreter when necessary · 7a68254a
      Phuong Trinh authored
      We revert CAFs when loading/adding modules in ghci (presumably to refresh
      execution states and to allow for object code to be unloaded from the runtime).
      However, with `-fexternal-interpreter` enabled, we are only doing it in the
      ghci process instead of the external interpreter process where the cafs are
      allocated and computed. This makes sure that revertCAFs is done in the
      appropriate process no matter if that flag is present or not.
      7a68254a
  4. 06 Mar, 2019 2 commits
    • Zejun Wu's avatar
      Move reifyGHCi function into GhciMonad type class · 3caeb443
      Zejun Wu authored
      This was the suggested change in !176 but missed the batch merge (!263).
      3caeb443
    • Ben Gamari's avatar
      Rip out object splitting · 37f257af
      Ben Gamari authored
      The splitter is an evil Perl script that processes assembler code.
      Its job can be done better by the linker's --gc-sections flag. GHC
      passes this flag to the linker whenever -split-sections is passed on
      the command line.
      
      This is based on @DemiMarie's D2768.
      
      Fixes Trac #11315
      Fixes Trac #9832
      Fixes Trac #8964
      Fixes Trac #8685
      Fixes Trac #8629
      37f257af
  5. 03 Feb, 2019 1 commit
  6. 31 Jan, 2019 1 commit
    • Zejun Wu's avatar
      Introduce GhciMonad and generalize types of functions in GHCi.UI · e08974e8
      Zejun Wu authored
      Summary:
      Introduce `GhciMonad`, which is bascially `GhcMonad` + `HasGhciState`.
      Generalize the commands and help functions defined in `GHCi.UI` so they
      can be used as both `GHCi a` and `InputT GHCi a`.
      
      The long term plan is to move reusable bits to ghci library and make it
      easier to build a customized interactive ui which carries customized state
      and provides customized commands.
      
      Most changes are trivial in this diff by relaxing the type constraint or
      add/remove lift as necessary. The non-trivial changes are:
      
      * Change `HasGhciState` to `GhciMonad` and expose it.
      * Implementation of `reifyGHCi`.
      
      Test Plan:
        ./validate
      
      Reviewers: simonmar, hvr, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5433
      e08974e8
  7. 28 Jan, 2019 1 commit
  8. 27 Jan, 2019 1 commit
  9. 16 Jan, 2019 3 commits
  10. 13 Jan, 2019 1 commit
    • Ömer Sinan Ağacan's avatar
      Refactor GHCi UI to fix #11606, #12091, #15721, #16096 · a34ee615
      Ömer Sinan Ağacan authored
      Instead of parsing and executing a statement or declaration directly we
      now parse them first and then execute in a separate step. This gives us
      the flexibility to inspect the parsed declaration before execution.
      Using this we now inspect parsed declarations, and if it's a single
      declaration of form `x = y` we execute it as `let x = y` instead, fixing
      a ton of problems caused by poor declaration support in GHCi.
      
      To avoid any users of the modules I left `execStmt` and `runDecls`
      unchanged and added `execStmt'` and `runDecls'` which work on parsed
      statements/declarations.
      a34ee615
  11. 06 Jan, 2019 1 commit
    • Zejun Wu's avatar
      Respect prompt in GhciSettings · 08b8ea2f
      Zejun Wu authored
      Summary:
      This was broken when PromptFunction was introduced that the settings are
      ignored and default values are always used.
      
      Test Plan: ./validate
      08b8ea2f
  12. 18 Dec, 2018 1 commit
  13. 17 Dec, 2018 1 commit
    • Zejun Wu's avatar
      Handle :cd in external interpreter in a more robust way · f99d898b
      Zejun Wu authored
      We used to enqueue another command to change directory in the external
      interpreter subprocess, this is not as robust as:
      
      * it can fail with -fno-implict-import-qualified;
      * it doesn't work when we `setGHCiMonad` to something other than `IO`.
      
      Neither of them works if `directory` package is hidden though.
      
      Test Plan:
      ```
      $ inplace/bin/ghc-stage2 --interactive # -fexternal-interpreter
      GHCi, version 8.7.20181213: http://www.haskell.org/ghc/  :? for help
      Prelude> :cd ..
      Prelude> System.Directory.getCurrentDirectory
      "/data/users/watashi"
      Prelude> :!pwd
      /data/users/watashi
      Prelude>
      Leaving GHCi.
      ```
      
        ./validate
      
      Reviewers: simonmar, bgamari, RyanGlScott
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5453
      f99d898b
  14. 15 Dec, 2018 1 commit
    • Ben Gamari's avatar
      Use https links in user-facing startup and error messages · a1c0b706
      Ben Gamari authored
      I consider myself lucky that in my circle of friends, `http` urls (as
      opposed to `https` urls) are frowned upon in that we generally
      apologize in the rase cases that we share an `http` url.
      
      This pull request changes `http` links into their `https` analogues in
      the following places:
      
      * In the GHCI startup message (and parts of the User's Guide, where
      there are verbatim transcripts of GHCi sessions).
      * In a couple of error messages, asking the user to report a bug.
      
      (I also took the liberty to change a single space before the reportabug
      url into two spaces, harmonizing this occurence with the others.)
      
      I'm not trying to start a war. I just had a moment to spare and felt
      like preparing this diff. Merge or don't merge as you wish!
      
      Reviewers: bgamari, erikd, simonmar
      
      Subscribers: goldfire, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5450
      a1c0b706
  15. 08 Dec, 2018 1 commit
    • Roland Senn's avatar
      Fix #15369: GHCi doesn't honor :set +c when loading for a second time · 57c9b1ae
      Roland Senn authored
      The decision to (re)collect the type info for a (re)loaded module is
      now taken only by comparing the file timestamps of the .hs file of the
      module. (Or form the .o file if the .hs file is missing).
      If the file timestamp changes, we (re)collect the type info.
      The timestamp of the processing time of the last collect is no longer
      used.
      
      Test Plan: make test TEST=T15369
      
      Reviewers: alanz, hvr, monoidal, osa1, thomie, bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15369
      
      Differential Revision: https://phabricator.haskell.org/D5376
      57c9b1ae
  16. 24 Nov, 2018 1 commit
  17. 22 Nov, 2018 2 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
    • 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
  18. 17 Nov, 2018 1 commit
  19. 02 Nov, 2018 1 commit
  20. 28 Oct, 2018 1 commit
    • Zejun Wu's avatar
      Rewrite FastString table in concurrent hashtable · 5126764b
      Zejun Wu authored
      Summary:
      Reimplement global FastString table using a concurrent hashatable with
      fixed size segments and dynamically growing buckets instead of fixed size
      buckets.
      
      This addresses the problem that `mkFastString` was not linear when the
      total number of entries was large.
      
      Test Plan:
      ./validate
      
      ```
      inplace/bin/ghc-stage2 --interactive -dfaststring-stats < /dev/null
      GHCi, version 8.7.20181005: http://www.haskell.org/ghc/  :? for help
      Prelude> Leaving GHCi.
      FastString stats:
          segments:          256
          buckets:           16384
          entries:           7117
          largest segment:   64
          smallest segment:  64
          longest bucket:    5
          has z-encoding:    0%
      ```
      
      Also comapre the two implementation using
      
      {P187}
      
      The new implementation is on a par with the old version with different
      conbination of parameters and perform better when the number of
      FastString's are large.
      
      {P188}
      
      Reviewers: simonmar, bgamari, niteria
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14854
      
      Differential Revision: https://phabricator.haskell.org/D5211
      5126764b
  21. 27 Oct, 2018 1 commit
    • mayac's avatar
      More explicit foralls (GHC Proposal 0007) · 512eeb9b
      mayac authored
      Allow the user to explicitly bind type/kind variables in type and data
      family instances (including associated instances), closed type family
      equations, and RULES pragmas. Follows the specification of GHC
      Proposal 0007, also fixes #2600. Advised by Richard Eisenberg.
      
      This modifies the Template Haskell AST -- old code may break!
      
      Other Changes:
      - convert HsRule to a record
      - make rnHsSigWcType more general
      - add repMaybe to DsMeta
      
      Includes submodule update for Haddock.
      
      Test Plan: validate
      
      Reviewers: goldfire, bgamari, alanz
      
      Subscribers: simonpj, RyanGlScott, goldfire, rwbarton,
                   thomie, mpickering, carter
      
      GHC Trac Issues: #2600, #14268
      
      Differential Revision: https://phabricator.haskell.org/D4894
      512eeb9b
  22. 01 Oct, 2018 1 commit
    • Alp Mestanogullari's avatar
      ghc-bin.cabal.in: add a 'threaded' flag for hadrian · 99eb4595
      Alp Mestanogullari authored
      Summary:
      hadrian will explicitly enable this flag, but more importantly needs it
      as otherwise we just never end up passing -threaded to GHC when building
      a new GHC binary. We could quite likely unconditionally pass -threaded,
      as the corresponding logic for GhcThreaded in mk/config.mk.in seems to
      always lead to it being set to True, but we instead leave a way out for
      anyone in need of a GHC linked against a non-threaded runtime system in
      the future.
      
      Test Plan: T8242 (with a GHC built by hadrian)
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5146
      99eb4595
  23. 07 Aug, 2018 1 commit
    • Herbert Valerio Riedel's avatar
      Turn on MonadFail desugaring by default · aab8656b
      Herbert Valerio Riedel authored
      Summary:
      This contains two commits:
      
      ----
      
      Make GHC's code-base compatible w/ `MonadFail`
      
      There were a couple of use-sites which implicitly used pattern-matches
      in `do`-notation even though the underlying `Monad` didn't explicitly
      support `fail`
      
      This refactoring turns those use-sites into explicit case
      discrimations and adds an `MonadFail` instance for `UniqSM`
      (`UniqSM` was the worst offender so this has been postponed for a
      follow-up refactoring)
      
      ---
      
      Turn on MonadFail desugaring by default
      
      This finally implements the phase scheduled for GHC 8.6 according to
      
      https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail#Transitionalstrategy
      
      This also preserves some tests that assumed MonadFail desugaring to be
      active; all ghc boot libs were already made compatible with this
      `MonadFail` long ago, so no changes were needed there.
      
      Test Plan: Locally performed ./validate --fast
      
      Reviewers: bgamari, simonmar, jrtc27, RyanGlScott
      
      Reviewed By: bgamari
      
      Subscribers: bgamari, RyanGlScott, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5028
      aab8656b
  24. 30 Jul, 2018 1 commit
  25. 27 Jul, 2018 1 commit
    • Michael Sloan's avatar
      Modifications to support loading GHC into GHCi · 60ecf43a
      Michael Sloan authored
      This change was previously part of
      [D4904](https://phabricator.haskell.org/D4904), but is being split off
      to aid in getting this reviewed and merged.
      
      * The compiler code is built with `NoImplicitPrelude`, but GHCi's
        modules are incompatible with it. So, this adds the pragma to all GHCi
        modules that didn't have it, and adds imports of Prelude.
      
      * In order to run GHC within itself, a `call of 'initGCStatistics`
        needed to be skipped. This uses CPP to skip it when
        `-DGHC_LOADED_INTO_GHCI` is set.
      
      * There is an environment variable workaround suggested by Ben Gamari
        [1], where `_GHC_TOP_DIR` can be used to specify GHC's top dir if `-B`
        isn't provided.  This can be used to solve a problem where the GHC being
        run within GHCi attempts to look in `inplace/lib/lib/` instead of
        `inplace/lib/`.
      
      [1]: https://phabricator.haskell.org/D4904#135438
      
      Reviewers: goldfire, bgamari, erikd, alpmestan
      
      Reviewed By: alpmestan
      
      Subscribers: alpmestan, lelf, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4986
      60ecf43a
  26. 16 Jul, 2018 1 commit
    • Simon Marlow's avatar
      Fix space leaks · 71f6b18b
      Simon Marlow authored
      Summary:
      All these were detected by -fghci-leak-check when GHC was
      compiled *without* optimisation (e.g. using the "quick" build flavour).
      
      Unfortunately I don't know of a good way to keep this working.  I'd like
      to just disable the -fghci-leak-check flag when the compiler is built
      without optimisation, but it doesn't look like we have an easy way to do
      that. And even if we could, it would be fragile anyway,
      
      Test Plan: `cd testsuite/tests/ghci; make`
      
      Reviewers: bgamari, hvr, erikd, tdammers
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      GHC Trac Issues: #15246
      
      Differential Revision: https://phabricator.haskell.org/D4872
      71f6b18b
  27. 27 Jun, 2018 2 commits
  28. 20 Jun, 2018 3 commits
  29. 14 Jun, 2018 1 commit
    • Tao He's avatar
      Disable `-fdefer-out-of-scope-variables` in ghci. · 4a931665
      Tao He authored
      We have already disabled `-fdefer-type-errors` and
      `-fdefer-typed-holes` in ghci.
      This patch disables `-fdefer-out-of-scope-variables` as well.
      
      Fixes Trac #15259, as well as #14963.
      
      Test Plan: make test TEST="T15259 T14963a T14963b T14963c"
      
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      GHC Trac Issues: #15259, #14963
      
      Differential Revision: https://phabricator.haskell.org/D4830
      4a931665
  30. 04 Jun, 2018 1 commit
    • Simon Jakobi's avatar
      Serialize docstrings to ifaces, display them with new GHCi :doc command · 85309a3c
      Simon Jakobi authored
      If `-haddock` is set, we now extract docstrings from the renamed ast
      and serialize them in the .hi-files.
      
      This includes some of the changes from D4749 with the notable
      exceptions of the docstring lexing and renaming.
      
      A currently limited and experimental GHCi :doc command can be used
      to display docstrings for declarations.
      
      The formatting of pretty-printed docstrings is changed slightly,
      causing some changes in testsuite/tests/haddock.
      
      Test Plan: ./validate
      
      Reviewers: alexbiehl, hvr, gershomb, harpocrates, bgamari
      
      Reviewed By: alexbiehl
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4758
      85309a3c
  31. 30 May, 2018 1 commit
    • Kavon Farvardin's avatar
      Extract hard-coded LLVM opt flags into a file · a4ae199c
      Kavon Farvardin authored
      To resolve ticket #11295, I think it makes sense to stop hard-coding
      the pass sequences used by GHC when compiling with LLVM into the
      compiler
      itself.
      
      This patchset introduces a companion to the existing `llvm-targets` file
      called `llvm-passes`. The passes file is a simple association list that
      holds the default LLVM `opt` pass sequence used by GHC. This allows end
      users to easily save their favorite optimization flags when compiling
      with LLVM.
      
      The main benefit for ticket #11295 is that when adding a custom pass
      sequence, it tends to be an extremely long string that would be
      unsightly in the code.
      
      This is essentially part 1 of 2 for ticket #11295.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, angerman
      
      Reviewed By: angerman
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4695
      a4ae199c
  32. 25 May, 2018 1 commit
    • Simon Marlow's avatar
      Add -fghci-leak-check to check for space leaks · 5b6ef59f
      Simon Marlow authored
      Summary:
      (re-applying this patch now that D4659 is committed)
      
      Space leaks in GHCi emerge from time to time and tend to come back again
      after they get fixed. This is an attempt to limit regressions by
      
      * adding a reliable detection for some classes of space leaks in GHCi
      * turning on leak checking for all GHCi tests in the test suite, so that
        we'll notice if the leak appears again.
      
      The idea for detecting space leaks is quite simple:
      
      * find some data that we expect to be GC'd later, make a weak pointer to it
      * when we expect the data to be dead, do a `performGC` and then check
        the status of the weak pointer.
      
      It would be nice to apply this trick to lots of things in GHC,
      e.g. ensuring that HsSyn is not retained after the desugarer, or
      ensuring that CoreSyn from the previous simplifier pass is not retained.
      
      Test Plan: validate
      
      Reviewers: bgamari, simonpj, erikd, niteria
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15111
      5b6ef59f
  33. 14 May, 2018 1 commit