1. 19 Jul, 2021 1 commit
    • sheaf's avatar
      Add nontrivial type-checking plugin tests · e309cb76
      sheaf authored
        Three new tests for type-checking plugins:
      
          - TcPlugin_Nullary, solving a nullary class constraint
          - TcPlugin_Args, providing evidence for a (unary) class constraint
            using arguments supplied to the plugin
          - TcPlugin_TyFam, solving an equality constraint to rewrite
            a type-family application
      
        More extensive descriptions of the plugins can be found in their
        respective defining modules.
      e309cb76
  2. 16 Jul, 2021 2 commits
    • Sylvain Henry's avatar
      Add Word64#/Int64# primops · 41d6cfc4
      Sylvain Henry authored
      Word64#/Int64# are only used on 32-bit architectures. Before this patch,
      operations on these types were directly using the FFI. Now we use real
      primops that are then lowered into ccalls.
      
      The advantage of doing this is that we can now perform constant folding on
      Word64#/Int64# (#19024).
      
      Most of this work was done by John Ericson in !3658. However this patch
      doesn't go as far as e.g. changing Word64 to always be using Word64#.
      
      Noticeable performance improvements
      
                T9203(normal) run/alloc    89870808.0    66662456.0 -25.8% GOOD
        haddock.Cabal(normal) run/alloc 14215777340.8 12780374172.0 -10.1% GOOD
         haddock.base(normal) run/alloc 15420020877.6 13643834480.0 -11.5% GOOD
      
      Metric Decrease:
          T9203
          haddock.Cabal
          haddock.base
      41d6cfc4
    • Sylvain Henry's avatar
      Additional constant-folding rule for binary AND/OR · de98a0ce
      Sylvain Henry authored
      Add a constant folding rule allowing the subsumption of an application
      if the same argument is applied twice, e.g.
      
        (v .&. 0xFF) .&. 0xFF ~~> v .&. 0xFF
        (v .|. 0xFF) .|. 0xFF ~~> v .|. 0xFF
      de98a0ce
  3. 13 Jul, 2021 3 commits
  4. 12 Jul, 2021 1 commit
    • Alfredo Di Napoli's avatar
      Add proper GHCHints for most PsMessage constructors · a181313e
      Alfredo Di Napoli authored
      This commit adds proper hints to most diagnostic types in the
      `GHC.Parser.Errors.Types` module. By "proper" we mean that previous to
      this commit the hints were bundled together with the diagnostic message,
      whereas now we moved most of them as proper `[GhcHint]` in the
      implementation of `diagnosticHints`.
      
      More specifically, this is the list of constructors which now has
      proper hints:
      
      * PsErrIllegalBangPattern
      * PsWarnOperatorWhitespaceExtConflict
      * PsErrLambdaCase
      * PsErrIllegalPatSynExport
      * PsWarnOperatorWhitespace
      * PsErrMultiWayIf
      * PsErrIllegalQualifiedDo
      * PsErrNumUnderscores
      * PsErrLinearFunction
      * PsErrIllegalTraditionalRecordSyntax
      * PsErrIllegalExplicitNamespace
      * PsErrOverloadedRecordUpdateNotEnabled
      * PsErrIllegalDataTypeContext
      * PsErrSemiColonsInCondExpr
      * PsErrSemiColonsInCondCmd
      * PsWarnStarIsType
      * PsWarnImportPreQualified
      * PsErrImportPostQualified
      * PsErrEmptyDoubleQuotes
      * PsErrIllegalRoleName
      * PsWarnStarBinder
      
      For some reason, thi...
      a181313e
  5. 10 Jul, 2021 2 commits
  6. 09 Jul, 2021 15 commits
  7. 08 Jul, 2021 1 commit
    • Alfredo Di Napoli's avatar
      Rename getErrorMessages and getMessages function in parser code · 56eb57a6
      Alfredo Di Napoli authored
      This commit renames the `getErrorMessages` and
      `getMessages` function in the parser code to `getPsErrorMessages` and
      `getPsMessages`, to avoid import conflicts, as we have already
      `getErrorMessages` and `getMessages` defined in `GHC.Types.Error`.
      
      Fixes #19920.
      
      Update haddock submodule
      56eb57a6
  8. 07 Jul, 2021 2 commits
    • Matthew Pickering's avatar
      driver: Add test for #12983 · 5a31abe3
      Matthew Pickering authored
      This test has worked since 8.10.2 at least but was recently broken and
      is now working again after this patch.
      
      Closes #12983
      5a31abe3
    • Matthew Pickering's avatar
      driver: Convert runPipeline to use a free monad · 421beb3f
      Matthew Pickering authored
      This patch converts the runPipeline function to be implemented in terms
      of a free monad rather than the previous CompPipeline.
      
      The advantages of this are three-fold:
      
      1. Different parts of the pipeline can return different results, the
      limits of runPipeline were being pushed already by !5555, this opens up
      futher fine-grainedism of the pipeline.
      2. The same mechanism can be extended to build-plan at the module level
      so the whole build plan can be expressed in terms of one computation
      which can then be treated uniformly.
      3. The pipeline monad can now be interpreted in different ways, for
      example, you may want to interpret the `TPhase` action into the monad
      for your own build system (such as shake). That bit will probably
      require a bit more work, but this is a step in the right directin.
      
      There are a few more modules containing useful functions for interacting
      with the pipelines.
      
      * GHC.Driver.Pipeline: Functions for building pipelines at a high-level
      * GHC.Driver.Pipeline.Execute: Functions for providing the default
      interpretation of TPhase, in terms of normal IO.
      * GHC.Driver.Pipeline.Phases: The home for TPhase, the typed phase data
      type which dictates what the phases are.
      * GHC.Driver.Pipeline.Monad: Definitions to do with the TPipelineClass
      and MonadUse class.
      
      Hooks consumers may notice the type of the `phaseHook` has got
      slightly more restrictive, you can now no longer control the
      continuation of the pipeline by returning the next phase to execute but
      only override individual phases. If this is a problem then please open
      an issue and we will work out a solution.
      
      -------------------------
      Metric Decrease:
          T4029
      -------------------------
      421beb3f
  9. 06 Jul, 2021 6 commits
    • Andreas Klebinger's avatar
      Fix #19889 - Invalid BMI2 instructions generated. · 6618008b
      Andreas Klebinger authored
      When arguments are 8 *or 16* bits wide, then truncate before/after
      and use the 32bit operation.
      6618008b
    • CSEdd's avatar
      Fix issue 20038 - Change 'variable' -> 'variables' · 17091114
      CSEdd authored
      17091114
    • Sylvain Henry's avatar
      Use target platform in guessOutputFile · 354ac99d
      Sylvain Henry authored
      354ac99d
    • Ethan Kiang's avatar
      Pass '-x c++' and '-std=c++11' to `cc` for cpp files, in Hadrian · 4002bd1d
      Ethan Kiang authored
      '-x c++' was found to be required on Darwin Clang 11 and 12.
      '-std=c++' was found to be needed on Clang 12 but not 11.
      4002bd1d
    • Fraser Tweedale's avatar
      Add test for executablePath · a4e742c5
      Fraser Tweedale authored
      a4e742c5
    • Fraser Tweedale's avatar
      Implement improved "get executable path" query · 4b4c5e43
      Fraser Tweedale authored
      System.Environment.getExecutablePath has some problems:
      
      - Some system-specific implementations throw an exception in some
        scenarios, e.g. when the executable file has been deleted
      
      - The Linux implementation succeeds but returns an invalid FilePath
        when the file has been deleted.
      
      - The fallback implementation returns argv[0] which is not
        necessarily an absolute path, and is subject to manipulation.
      
      - The documentation does not explain any of this.
      
      Breaking the getExecutablePath API or changing its behaviour is not
      an appealing direction.  So we will provide a new API.
      
      There are two facets to the problem of querying the executable path:
      
      1. Does the platform provide a reliable way to do it?  This is
         statically known.
      
      2. If so, is there a valid answer, and what is it?  This may vary,
         even over the runtime of a single process.
      
      Accordingly, the type of the new mechanism is:
      
        Maybe (IO (Maybe FilePath))
      
      This commit implements this mechanism, ...
      4b4c5e43
  10. 03 Jul, 2021 2 commits
    • Sebastian Graf's avatar
      Arity: Handle shadowing properly · 9b1d9cbf
      Sebastian Graf authored
      In #20070, we noticed that `findRhsArity` copes badly with shadowing.
      A simple function like `g_123 x_123 = x_123`, where the labmda binder shadows,
      already regressed badly.
      Indeed, the whole `arityType` function wasn't thinking about shadowing *at all*.
      
      I rectified that and established the invariant that `ae_join` and `am_sigs`
      should always be disjoint. That entails deleting bindings from `ae_join`
      whenever we add something to `am_sigs` and vice versa, which would otherwise be
      a bug in the making.
      
      That *should* fix (but I don't want to close it) #20070.
      9b1d9cbf
    • Luite Stegeman's avatar
      Support unlifted datatypes in GHCi · 5e30451d
      Luite Stegeman authored
      fixes #19628
      5e30451d
  11. 02 Jul, 2021 5 commits