Skip to content
Snippets Groups Projects
  1. Nov 03, 2023
    • Vladislav Zavialov's avatar
      T2T in Expressions (#23738) · 0dfb1fa7
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements the T2T (term-to-type) transformation in
      expressions. Given a function with a required type argument
      	vfun :: forall a -> ...
      
      the user can now call it as
      	vfun (Maybe Int)
      
      instead of
      	vfun (type (Maybe Int))
      
      The Maybe Int argument is parsed and renamed as a term (HsExpr), but then
      undergoes a conversion to a type (HsType).
      See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs
      and Note [RequiredTypeArguments and the T2T mapping]
      
      Left as future work: checking for puns.
      0dfb1fa7
    • Jaro Reinders's avatar
      Add NCG support for common 64bit operations to the x86 backend. · 6755d833
      Jaro Reinders authored and Andreas Klebinger's avatar Andreas Klebinger committed
      These used to be implemented via C calls which was obviously quite bad
      for performance for operations like simple addition.
      
      Co-authored-by: Andreas Klebinger
      6755d833
  2. Nov 01, 2023
    • Ryan Scott's avatar
      More robust checking for DataKinds · 9f9c9227
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      As observed in #22141, GHC was not doing its due diligence in catching code
      that should require `DataKinds` in order to use. Most notably, it was allowing
      the use of arbitrary data types in kind contexts without `DataKinds`, e.g.,
      
      ```hs
      data Vector :: Nat -> Type -> Type where
      ```
      
      This patch revamps how GHC tracks `DataKinds`. The full specification is
      written out in the `DataKinds` section of the GHC User's Guide, and the
      implementation thereof is described in `Note [Checking for DataKinds]` in
      `GHC.Tc.Validity`. In brief:
      
      * We catch _type_-level `DataKinds` violations in the renamer. See
        `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in
        `GHC.Rename.Pat`.
      
      * We catch _kind_-level `DataKinds` violations in the typechecker, as this
        allows us to catch things that appear beneath type synonyms. (We do *not*
        want to do this in type-level contexts, as it is perfectly fine for a type
        synonym to mention something that requires DataKinds while still using the
        type synonym in a module that doesn't enable DataKinds.) See `checkValidType`
        in `GHC.Tc.Validity`.
      
      * There is now a single `TcRnDataKindsError` that classifies all manner of
        `DataKinds` violations, both in the renamer and the typechecker. The
        `NoDataKindsDC` error has been removed, as it has been subsumed by
        `TcRnDataKindsError`.
      
      * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit
        uses of data types at the kind level without `DataKinds`. Previously,
        `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is
        inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`.
        Moreover, it thwarted the implementation of the `DataKinds` check in
        `checkValidType`, since we would expand `Constraint` (which was OK without
        `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and
        reject it. Now both are allowed.
      
      * I have added a flurry of additional test cases that test various corners of
        `DataKinds` checking.
      
      Fixes #22141.
      9f9c9227
    • Krzysztof Gogolewski's avatar
      docs: fix ScopedTypeVariables example (#24101) · 7a90020f
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      The previous example didn't compile.
      
      Furthermore, it wasn't demonstrating the point properly.
      I have changed it to an example which shows that 'a' in the signature
      must be the same 'a' as in the instance head.
      7a90020f
  3. Oct 24, 2023
  4. Oct 23, 2023
  5. Oct 22, 2023
    • Cheng Shao's avatar
      rts: drop stale mentions of MIN_UPD_SIZE · c1e3719c
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      We used to have MIN_UPD_SIZE macro that describes the minimum reserved
      size for thunks, so that the thunk can be overwritten in place as
      indirections or blackholes. However, this macro has not been actually
      defined or used anywhere since a long time ago; StgThunkHeader already
      reserves a padding word for this purpose. Hence this patch which drops
      stale mentions of MIN_UPD_SIZE.
      c1e3719c
    • John Ericson's avatar
      Get rid of all mention of `mk/config.h` · 7dfcab2f
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      The RTS configure script is now solely responsible for managing its
      headers; the top level configure script does not help.
      7dfcab2f
  6. Oct 14, 2023
  7. Oct 10, 2023
  8. Oct 04, 2023
  9. Sep 30, 2023
  10. Sep 27, 2023
  11. Sep 26, 2023
  12. Sep 19, 2023
  13. Sep 16, 2023
  14. Sep 12, 2023
    • Matthew Pickering's avatar
      Add -Winconsistent-flags warning · 21a906c2
      Matthew Pickering authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
      The warning fires when inconsistent command line flags are passed.
      
      For example:
      
      * -dynamic-too and -dynamic
      * -dynamic-too on windows
      * -O and --interactive
      * etc
      
      This is on by default and allows users to control whether the warning is
      displayed and whether it should be an error or not.
      
      Fixes #22572
      21a906c2
    • Teo Camarasu's avatar
      Add changelog entry for #23340 · 2b07bf2e
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      2b07bf2e
    • Teo Camarasu's avatar
      nonmoving: introduce a family of dense allocators · f367835c
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      Supplement the existing power 2 sized nonmoving allocators with a family
      of dense allocators up to a configurable threshold.
      
      This should reduce waste from rounding up block sizes while keeping the
      amount of allocator sizes manageable.
      
      This patch:
        - Adds a new configuration option `--nonmoving-dense-allocator-count`
          to control the amount of these new dense allocators.
        - Adds some constants to `NonmovingAllocator` in order to keep
          marking fast with the new allocators.
      
      Resolves #23340
      f367835c
    • Teo Camarasu's avatar
      docs: move -xn flag beside --nonmoving-gc · 98166389
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      It makes sense to have these beside each other as they are aliases.
      98166389
  15. Sep 09, 2023
  16. Sep 08, 2023
  17. Sep 05, 2023
  18. Sep 01, 2023
  19. Aug 30, 2023
  20. Aug 26, 2023
  21. Aug 23, 2023
  22. Aug 22, 2023
  23. Aug 17, 2023
  24. Aug 15, 2023
  25. Aug 14, 2023
  26. Aug 10, 2023
    • Finley McIlwaine's avatar
      Add -finfo-table-map-with-fallback -finfo-table-map-with-stack · 261c4acb
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      The -fno-info-table-map-with-stack flag omits STACK info tables from the info
      table map, and the -fno-info-table-map-with-fallback flag omits info tables
      with defaulted source locations from the map. In a test on the Agda codebase
      the build results were about 7% smaller when both of those types of tables
      were omitted.
      
      Adds a test that verifies that passing each combination of these flags
      results in the correct output for -dipe-stats, which is disabled for the js
      backend since profiling is not implemented.
      
      This commit also refactors a lot of the logic around extracting info tables
      from the Cmm results and building the info table map.
      
      This commit also fixes some issues in the users guide rst source to fix
      warnings that were noticed while debugging the documentation for these flags.
      
      Fixes #23702
      261c4acb
    • Finley McIlwaine's avatar
      Add -dipe-stats flag · cc52c358
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      This is useful for seeing which info tables have information.
      cc52c358
  27. Aug 09, 2023
    • Sebastian Graf's avatar
      CorePrep: Eta expand arguments (#23083) · 00d31188
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      Previously, we'd only eta expand let bindings and lambdas,
      now we'll also eta expand arguments such as in T23083:
      ```hs
      g f h = f (h `seq` (h $))
      ```
      Unless `-fpedantic-bottoms` is set, we'll now transform to
      ```hs
      g f h = f (\eta -> h eta)
      ```
      in CorePrep.
      
      See the new `Note [Eta expansion of arguments in CorePrep]` for the details.
      
      We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions
      in T4801 and T5321FD.
      
      Fixes #23083.
      00d31188
  28. Aug 03, 2023
  29. Aug 01, 2023
    • Bartłomiej Cieślar's avatar
      Implementation of the Deprecated Instances proposal #575 · d2bedffd
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      
      This commit implements the ability to deprecate certain instances,
      which causes the compiler to emit the desired deprecation message
      whenever they are instantiated. For example:
      
        module A where
        class C t where
        instance {-# DEPRECATED "dont use" #-} C Int where
      
        module B where
        import A
        f :: C t => t
        f = undefined
        g :: Int
        g = f -- "dont use" emitted here
      
      The implementation is as follows:
        - In the parser, we parse deprecations/warnings attached to instances:
      
            instance {-# DEPRECATED "msg" #-} Show X
            deriving instance {-# WARNING "msg2" #-} Eq Y
      
          (Note that non-standalone deriving instance declarations do not support
          this mechanism.)
      
        - We store the resulting warning message in `ClsInstDecl` (respectively, `DerivDecl`).
          In `GHC.Tc.TyCl.Instance.tcClsInstDecl` (respectively, `GHC.Tc.Deriv.Utils.newDerivClsInst`),
          we pass on that information to `ClsInst` (and eventually store it in `IfaceClsInst` too).
      
        - Finally, when we solve a constraint using such an instance, in
          `GHC.Tc.Instance.Class.matchInstEnv`, we emit the appropriate warning
          that was stored in `ClsInst`.
          Note that we only emit a warning when the instance is used in a different module
          than it is defined, which keeps the behaviour in line with the deprecation of
          top-level identifiers.
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      d2bedffd
Loading