1. 21 Aug, 2018 1 commit
    • Alec Theriault's avatar
      Explicitly tell 'getNameToInstances' mods to load · c971e119
      Alec Theriault authored
      Calculating which modules to load based on the InteractiveContext means
      maintaining a potentially very large GblRdrEnv.
      
      In Haddock's case, it is much cheaper (from a memory perspective) to
      just keep track of which modules interfaces we want loaded then hand
      these off explicitly to 'getNameToInstancesIndex'.
      
      Bumps haddock submodule.
      
      Reviewers: alexbiehl, bgamari
      
      Reviewed By: alexbiehl
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5003
      c971e119
  2. 20 Jul, 2018 1 commit
  3. 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
  4. 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
  5. 13 May, 2018 1 commit
    • Matthew Pickering's avatar
      Simplify -ddump-json implementation · 6ab7cf99
      Matthew Pickering authored
      This patch takes the much simpler route of whenever the compiler tries
      to output something. We just dump a JSON document there and then.
      
      I think this should be sufficient to work with and anything more refined
      quickly got complicated as it was necessary to demarcate message scopes
      and so on.
      
      Reviewers: bgamari, dfeuer
      
      Reviewed By: bgamari
      
      Subscribers: Phyx, dfeuer, rwbarton, thomie, carter
      
      GHC Trac Issues: #14078
      
      Differential Revision: https://phabricator.haskell.org/D4532
      6ab7cf99
  6. 26 Jan, 2018 1 commit
    • Alec Theriault's avatar
      Haddock needs to pass visible modules for instance filtering · 66961dc8
      Alec Theriault authored
      The GHC-side `getNameToInstancesIndex` filters out incorrectly some
      instances because it is not aware of what modules are visible. Using
      `runTcInteractive` means that `ie_visible` gets initialized to a one
      module set containing some dummy GHCi module. This is clearly not the
      module set we want to check against to see if a given orphan instance
      is visible or not.
      
      In fact, GHC has no way of knowing what we want that module set to be
      since it doesn't know ahead of time which modules Haddock is making its
      docs for. The fix is just to pass that set in as an argument.
      
      Bumps haddock submodule.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: duog, alexbiehl, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4290
      66961dc8
  7. 22 Sep, 2017 1 commit
    • Facundo Domínguez's avatar
      Implement TH addCorePlugin. · 17558690
      Facundo Domínguez authored
      This allows template-haskell code to add plugins to the compilation
      pipeline. Otherwise, the user would have to pass -fplugin=... to ghc.
      
      For now, plugin modules in the current package can't be used. This is
      because when TH runs, it is too late to let GHC know that the plugin
      modules needed to be compiled first.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, bgamari, austin, goldfire
      
      Reviewed By: bgamari
      
      Subscribers: angerman, rwbarton, mboes, thomie
      
      GHC Trac Issues: #13608
      
      Differential Revision: https://phabricator.haskell.org/D3821
      17558690
  8. 19 Sep, 2017 2 commits
  9. 06 Sep, 2017 1 commit
    • Moritz Angermann's avatar
      Clean up opt and llc · 22733532
      Moritz Angermann authored
      The LLVM backend shells out to LLVMs `opt` and `llc` tools. This clean
      up introduces a shared data structure to carry the arguments we pass to
      each tool so that corresponding flags are next to each other. It drops
      the hard coded data layouts in favor of using `-mtriple` and have LLVM
      infer them. Furthermore we add `clang` as a proper tool, so we don't
      rely on assuming that `clang` is called `clang` on the `PATH` when using
      `clang` as the assembler.  Finally this diff also changes the type of
      `optLevel` from `Int` to `Word`, as we do not have negative optimization
      levels.
      
      Reviewers: erikd, hvr, austin, rwbarton, bgamari, kavon
      
      Reviewed By: kavon
      
      Subscribers: michalt, Ericson2314, ryantrinkle, dfeuer, carter, simonpj,
      kavon, simonmar, thomie, erikd, snowleopard
      
      Differential Revision: https://phabricator.haskell.org/D3352
      22733532
  10. 05 Sep, 2017 1 commit
  11. 18 Jul, 2017 1 commit
    • niteria's avatar
      Make module membership on ModuleGraph faster · b8fec695
      niteria authored
      When loading/reloading with a large number of modules
      (>5000) the cost of linear lookups becomes significant.
      
      The changes here made `:reload` go from 6s to 1s on my
      test case.
      
      The bottlenecks were `needsLinker` in `DriverPipeline` and
      `getModLoop` in `GhcMake`.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, austin, bgamari
      
      Subscribers: thomie, rwbarton
      
      Differential Revision: https://phabricator.haskell.org/D3703
      b8fec695
  12. 03 Jul, 2017 1 commit
    • duog's avatar
      Fix -fno-code for modules that use -XQuasiQuotes · d55bea14
      duog authored
      In commit 53c78be0 object code is
      generated for modules depended on by modules that use -XTemplateHaskell.
      This turns the same logic on for modules that use -XQuasiQuotes.
      
      A test is added.
      
      Note that I've based this of D3646, as it has a function I want to use.
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, alexbiehl
      
      Reviewed By: alexbiehl
      
      Subscribers: alexbiehl, rwbarton, thomie
      
      GHC Trac Issues: #13863
      
      Differential Revision: https://phabricator.haskell.org/D3677
      d55bea14
  13. 27 Jun, 2017 2 commits
  14. 14 Jun, 2017 1 commit
  15. 12 Jun, 2017 2 commits
  16. 08 Jun, 2017 2 commits
    • duog's avatar
      Add tcRnGetNameToInstancesIndex · 56ef5444
      duog authored
      This function in tcRnDriver, retrieves an index by name of all Class and
      Family instances in the current environment.
      
      This is to be used by haddock which currently looks up instances for
      each name, which looks at every instance for every lookup.
      
      Using this function instead of tcRnGetInfo, the haddock.base performance
      test improves by 10%
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: alexbiehl, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3624
      56ef5444
    • duog's avatar
      Refactor temp files cleanup · 3ee3822c
      duog authored
      Remove filesToNotIntermediateClean from DynFlags, create a data type
      FilesToClean, and change filesToClean in DynFlags to be a FilesToClean.
      
      Modify SysTools.newTempName and the Temporary constructor of
      PipelineMonad.PipelineOutput to take a TempFileLifetime, which specifies
      whether a temp file should live until the end of GhcMonad.withSession,
      or until the next time cleanIntermediateTempFiles is called.
      
      These changes allow the cleaning of intermediate files in GhcMake to be
      much more efficient.
      
      HscTypes.hptObjs is removed as it is no longer used.
      
      A new performance test T13701 is added, which passes both with and
      without -keep-tmp-files.  The test fails by 25% without the patch, and
      passes when -keep-tmp-files is added.
      
      Note that there are still at two hotspots caused by
      algorithms quadratic in the number of modules, however neither of them
      allocate. They are:
      
      * DriverPipeline.compileOne'.needsLinker
      * GhcMake.getModLoop
      
      DriverPipeline.compileOne'.needsLinker is changed slightly to improve
      the situation.
      
      I don't like adding these Types to DynFlags, but they need to be seen by
      Dynflags, SysTools and PipelineMonad. The alternative seems to be to
      create a new module.
      
      Reviewers: austin, hvr, bgamari, dfeuer, niteria, simonmar, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13701
      
      Differential Revision: https://phabricator.haskell.org/D3620
      3ee3822c
  17. 05 Jun, 2017 1 commit
    • Alan Zimmerman's avatar
      Udate hsSyn AST to use Trees that Grow · 8e6ec0fa
      Alan Zimmerman authored
      Summary:
      See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
      
      This commit prepares the ground for a full extensible AST, by replacing the type
      parameter for the hsSyn data types with a set of indices into type families,
      
          data GhcPs -- ^ Index for GHC parser output
          data GhcRn -- ^ Index for GHC renamer output
          data GhcTc -- ^ Index for GHC typechecker output
      
      These are now used instead of `RdrName`, `Name` and `Id`/`TcId`/`Var`
      
      Where the original name type is required in a polymorphic context, this is
      accessible via the IdP type family, defined as
      
          type family IdP p
          type instance IdP GhcPs = RdrName
          type instance IdP GhcRn = Name
          type instance IdP GhcTc = Id
      
      These types are declared in the new 'hsSyn/HsExtension.hs' module.
      
      To gain a better understanding of the extension mechanism, it has been applied
      to `HsLit` only, also replacing the `SourceText` fields in them with extension
      types.
      
      To preserve extension generality, a type class is introduced to capture the
      `SourceText` interface, which must be honoured by all of the extension points
      which originally had a `SourceText`.  The class is defined as
      
          class HasSourceText a where
            -- Provide setters to mimic existing constructors
            noSourceText  :: a
            sourceText    :: String -> a
      
            setSourceText :: SourceText -> a
            getSourceText :: a -> SourceText
      
      And the constraint is captured in `SourceTextX`, which is a constraint type
      listing all the extension points that make use of the class.
      
      Updating Haddock submodule to match.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, shayan-najd, goldfire, austin, bgamari
      
      Subscribers: rwbarton, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D3609
      8e6ec0fa
  18. 15 May, 2017 1 commit
  19. 12 May, 2017 1 commit
  20. 01 Apr, 2017 1 commit
    • Simon Marlow's avatar
      Optimise common cases of GHC.setProgramDynFlags · 3b5f786c
      Simon Marlow authored
      * If the package flags haven't changed, don't do initPackages (which
        might take multiple seconds in extreme cases)
      
      * Provide a way to change the log_action without invalidating the
        summary cache.
      
      Test Plan: validate
      
      Reviewers: niteria, bgamari, austin, erikd, ezyang
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3392
      3b5f786c
  21. 02 Mar, 2017 1 commit
  22. 03 Feb, 2017 1 commit
    • Sylvain Henry's avatar
      Ditch static flags · bbd3c399
      Sylvain Henry authored
      This patch converts the 4 lasting static flags (read from the command
      line and unsafely stored in immutable global variables) into dynamic
      flags. Most use cases have been converted into reading them from a DynFlags.
      
      In cases for which we don't have easy access to a DynFlags, we read from
      'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'.
      It's not perfect (not thread-safe) but it is still better as we can
      set/unset these 4 flags before each run when using GHC API.
      
      Updates haddock submodule.
      
      Rebased and finished by: bgamari
      
      Test Plan: validate
      
      Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2839
      
      GHC Trac Issues: #8440
      bbd3c399
  23. 02 Feb, 2017 1 commit
    • Ben Gamari's avatar
      Add support for StaticPointers in GHCi · eedb3df0
      Ben Gamari authored
      Here we add support to GHCi for StaticPointers. This process begins by
      adding remote GHCi messages for adding entries to the static pointer
      table. We then collect binders needing SPT entries after linking and
      send the interpreter a message adding entries with the appropriate
      fingerprints.
      
      Test Plan: `make test TEST=StaticPtr`
      
      Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin,
      hvr, erikd
      
      Reviewed By: simonpj, simonmar
      
      Subscribers: RyanGlScott, simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2504
      
      GHC Trac Issues: #12356
      eedb3df0
  24. 30 Jan, 2017 1 commit
    • Matthew Pickering's avatar
      Add a flag to emit error messages as JSON · 91691117
      Matthew Pickering authored
      This patch adds the flag `-ddump-json` which dumps all the compiler
      output as a JSON array. This allows tooling to more easily parse GHC's
      output to display to users.
      
      The flag is currently experimental and will hopefully be refined for the
      next release.  In particular I have avoided any changes which involve
      significant refactoring and provided what is easy given the current
      infrastructure.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: DanielG, gracjan, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3010
      
      GHC Trac Issues: #13190
      91691117
  25. 10 Jan, 2017 1 commit
  26. 20 Dec, 2016 1 commit
  27. 19 Dec, 2016 1 commit
  28. 18 Dec, 2016 1 commit
  29. 12 Dec, 2016 1 commit
    • Alan Zimmerman's avatar
      Add infix flag for class and data declarations · 8f6d241a
      Alan Zimmerman authored
      Summary:
      At the moment, data and type declarations using infix formatting produce the
      same AST as those using prefix.
      
      So
      
          type a ++ b = c
      
      and
      
          type (++) a b = c
      
      cannot be distinguished in the parsed source, without looking at the OccName
      details of the constructor being defined.
      
      Having access to the OccName requires an additional constraint which explodes
      out over the entire AST because of its recursive definitions.
      
      In keeping with moving the parsed source to more directly reflect the source
      code as parsed, add a specific flag to the declaration to indicate the fixity,
      as used in a Match now too.
      
      Note: this flag is to capture the fixity used for the lexical definition of the
      type, primarily for use by ppr and ghc-exactprint.
      
      Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: mpickering, goldfire, bgamari, austin
      
      Reviewed By: mpickering
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2828
      
      GHC Trac Issues: #12942
      8f6d241a
  30. 13 Nov, 2016 1 commit
    • Ben Gamari's avatar
      Kill Type pretty-printer · 6c0f10fa
      Ben Gamari authored
      Here we consolidate the pretty-printing logic for types in IfaceType. We
      need IfaceType regardless and the printer for Type can be implemented in
      terms of that for IfaceType. See #11660.
      
      Note that this is very much a work-in-progress. Namely I still have yet
      to ponder how to ease the hs-boot file situation, still need to rip out
      more dead code, need to move some of the special cases for, e.g., `*` to
      the IfaceType printer, and need to get it to validate. That being said,
      it comes close to validating as-is.
      
      Test Plan: Validate
      
      Reviewers: goldfire, austin
      
      Subscribers: goldfire, thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2528
      
      GHC Trac Issues: #11660
      6c0f10fa
  31. 02 Nov, 2016 1 commit
    • Sylvain HENRY's avatar
      Uninstall signal handlers · 8a5960ad
      Sylvain HENRY authored
      GHC installs signal handlers in runGhc/runGhcT to handle ^C but it
      never uninstalls them.
      It can be an issue, especially when using GHC as a library.
      
      Test Plan: validate
      
      Reviewers: bgamari, erikd, austin, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2633
      
      GHC Trac Issues: #4162
      8a5960ad
  32. 08 Oct, 2016 1 commit
  33. 31 Aug, 2016 1 commit
  34. 23 Jun, 2016 1 commit
  35. 06 Jun, 2016 1 commit
    • niteria's avatar
      Use UniqDFM for HomePackageTable · 3042a9d8
      niteria authored
      This isn't strictly necessary for deterministic ABIs.
      The results of eltsHpt are consumed in two ways:
      1) they determine the order of linking
      2) if you track the data flow all the family instances get put in
         FamInstEnvs, so the nondeterministic order is forgotten.
      3) same for VectInfo stuff
      4) same for Annotations
      
      The problem is that I haven't found a nice way to do 2. in
      a local way and 1. is nice to have if we went for deterministic
      object files. Besides these maps are keyed on ModuleNames so they
      should be small relative to other things and the overhead should
      be negligible.
      
      As a bonus we also get more specific names.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, hvr, ezyang, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2300
      
      GHC Trac Issues: #4012
      3042a9d8
  36. 18 May, 2016 1 commit
    • Dave Laing's avatar
      Rework parser to allow use with DynFlags · 39a2faa0
      Dave Laing authored
      Split out the options needed by the parser from DynFlags, making the
      parser more friendly to standalone usage.
      
      Test Plan: validate
      
      Reviewers: simonmar, alanz, bgamari, austin, thomie
      
      Reviewed By: simonmar, alanz, bgamari, thomie
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2208
      
      GHC Trac Issues: #10961
      39a2faa0