1. 29 Oct, 2020 5 commits
    • Sylvain Henry's avatar
      GC: Avoid data race (#18717, #17964) · 22f5d9a9
      Sylvain Henry authored
      22f5d9a9
    • Sylvain Henry's avatar
      Split GHC.Driver.Types · 0e9f6def
      Sylvain Henry authored
      I was working on making DynFlags stateless (#17957), especially by
      storing loaded plugins into HscEnv instead of DynFlags. It turned out to
      be complicated because HscEnv is in GHC.Driver.Types but LoadedPlugin
      isn't: it is in GHC.Driver.Plugins which depends on GHC.Driver.Types. I
      didn't feel like introducing yet another hs-boot file to break the loop.
      
      Additionally I remember that while we introduced the module hierarchy
      (#13009) we talked about splitting GHC.Driver.Types because it contained
      various unrelated types and functions, but we never executed. I didn't
      feel like making GHC.Driver.Types bigger with more unrelated Plugins
      related types, so finally I bit the bullet and split GHC.Driver.Types.
      
      As a consequence this patch moves a lot of things. I've tried to put
      them into appropriate modules but nothing is set in stone.
      
      Several other things moved to avoid loops.
      
      * Removed Binary instances from GHC.Utils.Binary for random compiler
        things
      * Moved Typeable Binary instances into GHC.Utils.Binary.Typeable: they
        import a lot of things that users of GHC.Utils.Binary don't want to
        depend on.
      * put everything related to Units/Modules under GHC.Unit:
        GHC.Unit.Finder, GHC.Unit.Module.{ModGuts,ModIface,Deps,etc.}
      * Created several modules under GHC.Types: GHC.Types.Fixity, SourceText,
        etc.
      * Split GHC.Utils.Error (into GHC.Types.Error)
      * Finally removed GHC.Driver.Types
      
      Note that this patch doesn't put loaded plugins into HscEnv. It's left
      for another patch.
      
      Bump haddock submodule
      0e9f6def
    • John Ericson's avatar
      Widen acceptance threshold for T10421a · 795908dc
      John Ericson authored
      Progress towards #18842. As @sgraf812 points out, widening the window is
      dangerous until the exponential described in #17658 is fixed. But this
      test has caused enough misery and is low stakes enough that we and
      @bgamari think it's worth it in this one case for the time being.
      795908dc
    • Alan Zimmerman's avatar
      c85eb372
    • Ben Gamari's avatar
      hadrian: Don't quote metric baseline argument · 60322f93
      Ben Gamari authored
      Previously this was quoted inappropriately.
      60322f93
  2. 27 Oct, 2020 11 commits
    • Sebastian Graf's avatar
      DmdAnal: Kill `is_thunk` case in `splitFV` · 28f98b01
      Sebastian Graf authored
      The `splitFV` function implements the highly dubious hack
      described in `Note [Lazy und unleashable free variables]` in
      GHC.Core.Opt.DmdAnal. It arranges it so that demand signatures only
      carry strictness info on free variables. Usage info is released through
      other means, see the Note. It's purely for analysis performance reasons.
      
      It turns out that `splitFV` has a quite involved case for thunks that
      produces slightly different usage signatures and it's not clear why we
      need it: `splitFV` is only relevant in the LetDown case and the only
      time we call it on thunks is for top-level or local recursive thunks.
      
      Since usage signatures of top-level thunks can only reference other
      top-level bindings and we completely discard demand info we have on
      top-level things (see the lack of `setIdDemandInfo` in
      `dmdAnalTopBind`), the `is_thunk` case is completely irrelevant here.
      
      For local, recursive thunks, the added benefit of the `is_thunk` test
      is marginal: We get used-multiple-times in some cases where previously
      we had used-once if a recursive thunk has multiple call sites. It's
      very unlikely and not a case to optimise for.
      
      So we kill the `is_thunk` case and inline `splitFV` at its call site,
      exposing `isWeakDmd` from `GHC.Types.Demand` instead.
      
      The NoFib summary supports this decision:
      
      ```
                  Min           0.0%     -0.0%
                  Max           0.0%     +0.0%
       Geometric Mean          -0.0%     -0.0%
      ```
      28f98b01
    • Ben Gamari's avatar
      gitlab-ci: Bump ci-images · d2a25f42
      Ben Gamari authored
      Bumps bootstrap compiler to 8.10.1.
      d2a25f42
    • Alan Zimmerman's avatar
      Api Annotations: Introduce AnnPercent for HsExplicitMult · e3fdd419
      Alan Zimmerman authored
      For the case
      
        foo :: a %p -> b
      
      The location of the '%' is captured, separate from the 'p'
      e3fdd419
    • David Eichmann's avatar
      78b52c88
    • Sergei Trofimovich's avatar
      ghc.mk: amend 'make sdist' · f76c5a08
      Sergei Trofimovich authored
      Noticed 'make sdist' failure seen as:
      
      ```
      "rm" -rf sdistprep/ghc/ghc-9.1.0.20201020/hadrian/_build/ (SRC_DIST_GHC_DIR)/hadrian/dist-newstyle/
      /bin/sh: -c: line 0: syntax error near unexpected token `('
      ```
      
      commit 9657f6f3
      ("sdist: Include hadrian sources in source distribution")
      added a new cleanup path without a variable expantion.
      
      The change adds variable reference. While at it move directory
      cleanup to a separate statement.
      
      Amends #18794Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      f76c5a08
    • Simon Peyton Jones's avatar
      Fix two constraint solving problems · 0b3d23af
      Simon Peyton Jones authored
      This patch fixes two problems in the constraint solver.
      
      * An actual bug #18555: we were floating out a constraint to eagerly,
        and that was ultimately fatal.  It's explained in
        Note [Do not float blocked constraints] in GHC.Core.Constraint.
      
        This is all very delicate, but it's all going to become irrelevant
        when we stop floating constraints (#17656).
      
      * A major performance infelicity in the flattener.  When flattening
        (ty |> co) we *never* generated Refl, even when there was nothing
        at all to do.  Result: we would gratuitously rewrite the constraint
        to exactly the same thing, wasting work.  Described in #18413, and
        came up again in #18855.
      
        Solution: exploit the special case by calling the new function
        castCoercionKind1.  See Note [castCoercionKind1] in
        GHC.Core.Coercion
      0b3d23af
    • Ben Gamari's avatar
      build system: Clean mingw tarballs · f3d8ab2e
      Ben Gamari authored
      Tamar noticed in !4293 that the build systems fail to clean up the mingw
      tarballs directory (`ghc-tarballs`). Fix this in both the make build
      system and Hadrian.
      f3d8ab2e
    • Ben Gamari's avatar
      hadrian: Suppress xelatex output unless it fails · 4950dd07
      Ben Gamari authored
      As noted in #18835, xelatex produces an absurd amount of output, nearly
      all of which is meaningless. Silence this.
      
      Fixes #18835.
      4950dd07
    • Tamar Christina's avatar
      412018c1
    • Vladislav Zavialov's avatar
      Version bump: base-4.16 (#18712) · eedec53d
      Vladislav Zavialov authored
      Also bumps upper bounds on base in boot libraries (incl. submodules).
      eedec53d
    • dbeacham's avatar
      Fix `instance Bounded a => Bounded (Down a)` (#18716) · 9ad51bc9
      dbeacham authored
      * Flip `minBound` and `maxBound` to respect the change in ordering
      * Remove awkward `Enum` (and hence `Integral`) instances for
        `Data.Ord.Down`
      * Update changelog
      9ad51bc9
  3. 23 Oct, 2020 2 commits
  4. 21 Oct, 2020 2 commits
  5. 20 Oct, 2020 5 commits
    • Alan Zimmerman's avatar
      API Annotations: Keep track of unicode for linear arrow notation · ea736839
      Alan Zimmerman authored
      The linear arrow can be parsed as `%1 ->` or a direct single token unicode
      equivalent.
      
      Make sure that this distinction is captured in the parsed AST by using
      IsUnicodeSyntax where it appears, and introduce a new API Annotation,
      AnnMult to represent its location when unicode is not used.
      
      Updated haddock submodule
      ea736839
    • Ben Gamari's avatar
      gitlab-ci: Rename FLAVOUR -> BUILD_FLAVOUR · 59b08a5d
      Ben Gamari authored
      Previously the Hadrian jobs used the `FLAVOUR` environment variable to
      communicate which flavour `ci.sh` should build whereas `make` used
      `BUILD_FLAVOUR`. This caused unnecessary confusion. Consolidate these
      two.
      59b08a5d
    • Alex D's avatar
      Compile modules with `-fobject-code` enabled to byte-code when loaded with `*`... · 58a1ca38
      Alex D authored
      Compile modules with `-fobject-code` enabled to byte-code when loaded with `*` prefix in ghci (#8042)
      
      The documentation states that when using :add and :load, the `*` prefix forces a module
      to be loaded as byte-code. However, this seems to be ignored when -fobject-code has been
      enabled. In that case, the compiled code is always used, regardless of whether the *-form
      is used.
      
      The idea is to consult the Targets in HscEnv and check the 'targetAllowObjCode' flag. If
      the flag for given module is set, then patch up DynFlags and select compilation backend
      accordingly.
      
      This would require a linear scan of course, but that shouldn't be too costly.
      58a1ca38
    • Krzysztof Gogolewski's avatar
      Minor comments, update linear types docs · 6c7a5c0c
      Krzysztof Gogolewski authored
      - Update comments: placeHolderTypeTc no longer exists
        "another level check problem" was a temporary comment from linear types
      - Use Mult type synonym (reported in #18676)
      - Mention multiplicity-polymorphic fields in linear types docs
      6c7a5c0c
    • Ben Gamari's avatar
      testsuite: Add test for #18346 · ee5dcdf9
      Ben Gamari authored
      This was fixed by 4291bdda.
      ee5dcdf9
  6. 19 Oct, 2020 2 commits
    • Sylvain Henry's avatar
      Remove pdocPrec · 9648d680
      Sylvain Henry authored
      pdocPrec was only used in GHC.Cmm.DebugBlock.pprUnwindExpr, so remove
      it. OutputableP becomes a one-function class which might be better for
      performance.
      9648d680
    • Vladislav Zavialov's avatar
      Implement -Woperator-whitespace (#18834) · b5b3e34e
      Vladislav Zavialov authored
      This patch implements two related warnings:
      
        -Woperator-whitespace-ext-conflict
            warns on uses of infix operators that would be parsed
            differently were a particular GHC extension enabled
      
        -Woperator-whitespace
            warns on prefix, suffix, and tight infix uses of infix
            operators
      
      Updates submodules: haddock, containers.
      b5b3e34e
  7. 18 Oct, 2020 8 commits
    • Hécate Moonlight's avatar
      Linting corrections · d858a3ae
      Hécate Moonlight authored
      * Bring back LANGUAGE pragmas in GHC.IO.Handle.Lock.Windows
      * Exclude some modules that are wrongfully reported
      d858a3ae
    • Sylvain Henry's avatar
      Don't get host RTS ways via settings (#18651) · a91dcb66
      Sylvain Henry authored
      To correctly perform a linking hack for Windows we need to link with the
      RTS GHC is currently using. We used to query the RTS ways via the
      "settings" file but it is fragile (#18651). The hack hasn't been fixed
      to take into account all the ways (Tracing) and it makes linking of GHC
      with another RTS more difficult (we need to link with another RTS and to
      regenerate the settings file).
      
      So this patch uses the ways reported by the RTS itself
      (GHC.Platform.Ways.hostWays) instead of the "settings" file.
      a91dcb66
    • DylanZA's avatar
      0b995759
    • Dylan Yudaken's avatar
      When using rts_setInCallCapability, lock incall threads · 50e9df49
      Dylan Yudaken authored
      This diff makes sure that incall threads, when using `rts_setInCallCapability`, will be created as locked.
      If the thread is not locked, the thread might end up being scheduled to a different capability.
      While this is mentioned in the docs for `rts_setInCallCapability,`, it makes the method significantly less useful as there is no guarantees on the capability being used.
      
      This commit also adds a test to make sure things stay on the correct capability.
      50e9df49
    • Sebastian Graf's avatar
      Testsuite: Add dead arity analysis tests · 451455fd
      Sebastian Graf authored
      We didn't seem to test these old tests at all, judging from their
      expected output.
      451455fd
    • Sebastian Graf's avatar
      Arity: Record arity types for non-recursive lets · 6b3eb06a
      Sebastian Graf authored
      In #18793, we saw a compelling example which requires us to look at
      non-recursive let-bindings during arity analysis and unleash their arity
      types at use sites.
      
      After the refactoring in the previous patch, the needed change is quite
      simple and very local to `arityType`'s defn for non-recurisve `Let`.
      
      Apart from that, we had to get rid of the second item of
      `Note [Dealing with bottoms]`, which was entirely a safety measure and
      hindered optimistic fixed-point iteration.
      
      Fixes #18793.
      
      The following metric increases are all caused by this commit and a
      result of the fact that we just do more work now:
      
      Metric Increase:
          T3294
          T12545
          T12707
      6b3eb06a
    • Sebastian Graf's avatar
      Arity: Refactor fixed-point iteration in GHC.Core.Opt.Arity · 7eb46a09
      Sebastian Graf authored
      Arity analysis used to propagate optimistic arity types during
      fixed-point interation through the `ArityEnv`'s `ae_cheap_fun` field,
      which is like `GHC.Core.Utils.exprIsCheap`, but also considers the
      current iteration's optimistic arity, for the binder in question only.
      
      In #18793, we have seen that this is a problematic design, because it
      doesn't allow us to look through PAP bindings of that binder.
      
      Hence this patch refactors to a more traditional form with an explicit
      signature environment, in which we record the optimistic `ArityType` of
      the binder in question (and at the moment is the *only* binder that is
      recorded in the arity environment).
      7eb46a09
    • John Ericson's avatar
      Skip type family defaults with hs-boot and hsig files · 59d7c9f4
      John Ericson authored
      Works around #17190, possible resolution for #17224. New design is is
      according to accepted [GHC Propoal 320].
      
      Instances in signatures currently unconditionally opt into associated
      family defaults if no explicit instance is given. This is bad for two
      reasons:
      
        1. It constrains possible instantiations to use the default, rather
        than possibly define the associated family differently.
      
        2. It breaks compilation as type families are unsupported in
        signatures.
      
      This PR simply turns off the filling in of defaults in those cases.
      Additionally, it squelches a missing definition warning for hs-boot too
      that was only squelched for hsig before.
      
      The downsides are:
      
        1. There is no way to opt into the default, other than copying its
        definition.
      
        2. If we fixed type classes in signatures, and wanted instances to
        have to explicitly *out of* rather than into the default, that would
        now be a breaking change.
      
      The change that is most unambiguously goood is harmonizing the warning
      squelching between hs-boot or hsig. Maybe they should have the warning
      (opt out of default) maybe they shouldn't (opt in to default), but
      surely it should be the same for both.
      
      Add hs-boot version of a backpack test regarding class-specified
      defaults in instances that appear in an hs-boot file.
      
      The metrics increase is very slight and makes no sense --- at least no
      one has figured anything out after this languishing for a while, so I'm
      just going to accept it.
      
      Metric Increase:
        T10421a
      
      [GHC proposal 320]: https://github.com/ghc-proposals/ghc-proposals/pull/320
      59d7c9f4
  8. 17 Oct, 2020 2 commits
  9. 16 Oct, 2020 3 commits