Skip to content
Snippets Groups Projects
  1. May 16, 2024
  2. May 15, 2024
    • Matthew Farkas-Dyck's avatar
      TTG: ApplicativeStatement exist only in Rn and Tc · 639d742b
      Matthew Farkas-Dyck authored and Marge Bot's avatar Marge Bot committed
      
      Co-Authored-By: default avatarromes <rodrigo.m.mesquita@gmail.com>
      639d742b
    • Matthew Pickering's avatar
      Introduce regression tests for `.hi` file sizes · 1e63a6fb
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Add regression tests to track how `-fwrite-if-compression` levels affect
      the size of `.hi` files.
      1e63a6fb
    • Hannes Siebenhandl's avatar
      Add run-time configurability of `.hi` file compression · 36aa7cf1
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      Introduce the flag `-fwrite-if-compression=<n>` which allows to
      configure the compression level of writing .hi files.
      
      The motivation is that some deduplication operations are too expensive
      for the average use case. Hence, we introduce multiple compression
      levels with variable impact on performance, but still reduce the
      memory residency and `.hi` file size on disk considerably.
      
      We introduce three compression levels:
      
      * `1`: `Normal` mode. This is the least amount of compression.
          It deduplicates only `Name` and `FastString`s, and is naturally the
          fastest compression mode.
      * `2`: `Safe` mode. It has a noticeable impact on .hi file size and is
        marginally slower than `Normal` mode. In general, it should be safe to
        always use `Safe` mode.
      * `3`: `Full` deduplication mode. Deduplicate as much as we can,
        resulting in minimal .hi files, but at the cost of additional
        compilation time.
      
      Reading .hi files doesn't need to know the initial compression level,
      and can always deserialise a `ModIface`, as we write out a byte that
      indicates the next value has been deduplicated.
      This allows users to experiment with different compression levels for
      packages, without recompilation of dependencies.
      
      Note, the deduplication also has an additional side effect of reduced
      memory consumption to implicit sharing of deduplicated elements.
      See #24540 for example where
      that matters.
      
      -------------------------
      Metric Decrease:
          MultiLayerModulesDefsGhciWithCore
          T16875
          T21839c
          T24471
          hard_hole_fits
          libdir
      -------------------------
      36aa7cf1
    • Hannes Siebenhandl's avatar
      Add deduplication table for `IfaceType` · 2fcc09fd
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      The type `IfaceType` is a highly redundant, tree-like data structure.
      While benchmarking, we realised that the high redundancy of `IfaceType`
      causes high memory consumption in GHCi sessions when byte code is
      embedded into the `.hi` file via `-fwrite-if-simplified-core` or
      `-fbyte-code-and-object-code`.
      Loading such `.hi` files from disk introduces many duplicates of
      memory expensive values in `IfaceType`, such as `IfaceTyCon`,
      `IfaceTyConApp`, `IA_Arg` and many more.
      
      We improve the memory behaviour of GHCi by adding an additional
      deduplication table for `IfaceType` to the serialisation of `ModIface`,
      similar to how we deduplicate `Name`s and `FastString`s.
      When reading the interface file back, the table allows us to automatically
      share identical values of `IfaceType`.
      
      To provide some numbers, we evaluated this patch on the agda code base.
      We loaded the full library from the `.hi` files, which contained the
      embedded core expressions (`-fwrite-if-simplified-core`).
      
      Before this patch:
      
      * Load time: 11.7 s, 2.5 GB maximum residency.
      
      After this patch:
      
      * Load time:  7.3 s, 1.7 GB maximum residency.
      
      This deduplication has the beneficial side effect to additionally reduce
      the size of the on-disk interface files tremendously.
      
      For example, on agda, we reduce the size of `.hi` files (with
      `-fwrite-if-simplified-core`):
      
      * Before: 101 MB on disk
      * Now:     24 MB on disk
      
      This has even a beneficial side effect on the cabal store. We reduce the
      size of the store on disk:
      
      * Before: 341 MB on disk
      * Now:    310 MB on disk
      
      Note, none of the dependencies have been compiled with
      `-fwrite-if-simplified-core`, but `IfaceType` occurs in multiple
      locations in a `ModIface`.
      
      We also add IfaceType deduplication table to .hie serialisation and
      refactor .hie file serialisation to use the same infrastrucutre as
      `putWithTables`.
      
      Bump haddock submodule to accomodate for changes to the deduplication
      table layout and binary interface.
      2fcc09fd
    • Hannes Siebenhandl's avatar
      Move out LiteralMap to avoid cyclic module dependencies · d368f9a6
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      d368f9a6
    • Hannes Siebenhandl's avatar
      Add Eq and Ord instance to `IfaceType` · b2227487
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      We add an `Ord` instance so that we can store `IfaceType` in a
      `Data.Map` container.
      This is required to deduplicate `IfaceType` while writing `.hi` files to
      disk. Deduplication has many beneficial consequences to both file size
      and memory usage, as the deduplication enables implicit sharing of
      values.
      See issue #24540 for more motivation.
      
      The `Ord` instance would be unnecessary if we used a `TrieMap` instead
      of `Data.Map` for the deduplication process. While in theory this is
      clerarly the better option, experiments on the agda code base showed
      that a `TrieMap` implementation has worse run-time performance
      characteristics.
      
      To the change itself, we mostly derive `Eq` and `Ord`. This requires us
      to change occurrences of `FastString` with `LexicalFastString`, since
      `FastString` has no `Ord` instance.
      We change the definition of `IfLclName` to a newtype of
      `LexicalFastString`, to make such changes in the future easier.
      
      Bump haddock submodule for IfLclName changes
      b2227487
    • Cheng Shao's avatar
      testsuite: bump PartialDownSweep timeout to 5x on wasm32 · b1e0c313
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      b1e0c313
    • Andreas Klebinger's avatar
      Expand the `inline` rule to look through casts/ticks. · a593f284
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      Fixes #24808
      a593f284
  3. May 14, 2024
    • Cheng Shao's avatar
      linters: fix lint-whitespace compilation with ghc-9.10.1 · ad38e954
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      ad38e954
    • Cheng Shao's avatar
      hadrian: fix hadrian building with ghc-9.10.1 · be514bb4
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      be514bb4
    • Andrei Borzenkov's avatar
      Improve pattern to type pattern transformation (23739) · 2c0f8ddb
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      `pat_to_type_pat` function now can handle more patterns:
        - TuplePat
        - ListPat
        - LitPat
        - NPat
        - ConPat
      
      Allowing these new constructors in type patterns significantly
      increases possible shapes of type patterns without `type` keyword.
      
      This patch also changes how lookups in `lookupOccRnConstr` are
      performed, because we need to fall back into
      types when we didn't find a constructor on data level to perform
      `ConPat` to type transformation properly.
      2c0f8ddb
    • Hannes Siebenhandl's avatar
      Add perf regression test for `-fwrite-if-simplified-core` · d65bf4a2
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      d65bf4a2
    • Zubin's avatar
      Don't store a GlobalRdrEnv in `mi_globals` for GHCi. · c5d89412
      Zubin authored and Marge Bot's avatar Marge Bot committed
      GHCi only needs the `mi_globals` field for modules imported with
      :module +*SomeModule.
      
      It uses this field to make the top level environment in `SomeModule` available
      to the repl.
      
      By default, only the first target in the command line parameters is
      "star" loaded into GHCi. Other modules have to be manually "star" loaded
      into the repl.
      
      Storing the top level GlobalRdrEnv for each module is very wasteful, especially
      given that we will most likely never need most of these environments.
      
      Instead we store only the information needed to reconstruct the top level environment
      in a module, which is the `IfaceTopEnv` data structure, consisting of all import statements
      as well as all top level symbols defined in the module (not taking export lists into account)
      
      When a particular module is "star-loaded" into GHCi (as the first commandline target, or via
      an explicit `:module +*SomeModule`, we reconstruct the top level environment on demand using
      the `IfaceTopEnv`.
      c5d89412
  4. May 12, 2024
  5. May 11, 2024
    • Matthew Pickering's avatar
      Revert "ghcup-metadata: Drop output_name field" · 1012e8aa
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This reverts commit ecbf22a6.
      
      This breaks the ghcup metadata generation on the nightly jobs.
      1012e8aa
    • Jade's avatar
      Improve performance of Data.List.sort(By) · fc2d6de1
      Jade authored and Marge Bot's avatar Marge Bot committed
      This patch improves the algorithm to sort lists in base.
      It does so using two strategies:
      
      1) Use a four-way-merge instead of the 'default' two-way-merge.
      This is able to save comparisons and allocations.
      
      2) Use `(>) a b` over `compare a b == GT` and allow inlining and specialization.
      This mainly benefits types with a fast (>).
      
      Note that this *may* break instances with a *malformed* Ord instance
      where `a > b` is *not* equal to `compare a b == GT`.
      
      CLC proposal: https://github.com/haskell/core-libraries-committee/issues/236
      
      Fixes #24280
      
      -------------------------
      Metric Decrease:
          MultiLayerModulesTH_Make
          T10421
          T13719
          T15164
          T18698a
          T18698b
          T1969
          T9872a
          T9961
          T18730
          WWRec
          T12425
          T15703
      -------------------------
      fc2d6de1
  6. May 10, 2024
    • Cheng Shao's avatar
      ghc-heap: fix typo in ghc-heap cbits · 2b1af08b
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      2b1af08b
    • Rodrigo Mesquita's avatar
      Rename pre-processor invocation args · c2b33fc9
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Small clean up. Uses proper names for the various groups of arguments
      that make up the pre-processor invocation.
      c2b33fc9
    • Cheng Shao's avatar
      testsuite: fix testwsdeque with recent clang · a9979f55
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch fixes compilation of testwsdeque.c with recent versions of
      clang, which will fail with the error below:
      
      ```
      testwsdeque.c:95:33: error:
           warning: format specifies type 'long' but the argument has type 'void *' [-Wformat]
             95 |         barf("FAIL: %ld %d %d", p, n, val);
                |                     ~~~         ^
      
      testwsdeque.c:95:39: error:
           warning: format specifies type 'int' but the argument has type 'StgWord' (aka 'unsigned long') [-Wformat]
             95 |         barf("FAIL: %ld %d %d", p, n, val);
                |                            ~~         ^~~
                |                            %lu
      
      testwsdeque.c:133:42: error:
           error: incompatible function pointer types passing 'void (void *)' to parameter of type 'OSThreadProc *' (aka 'void *(*)(void *)') [-Wincompatible-function-pointer-types]
            133 |         createOSThread(&ids[n], "thief", thief, (void*)(StgWord)n);
                |                                          ^~~~~
      
      /workspace/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-9.11.20240502/rts-1.0.2/include/rts/OSThreads.h:193:51: error:
           note: passing argument to parameter 'startProc' here
            193 |                                     OSThreadProc *startProc, void *param);
                |                                                   ^
      
      2 warnings and 1 error generated.
      ```
      a9979f55
    • Ben Gamari's avatar
      IPE: Eliminate dependency on Read · ab840ce6
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Instead of encoding the closure type as decimal string we now simply
      represent it as an integer, eliminating the need for `Read` in
      `GHC.Internal.InfoProv.Types.peekInfoProv`.
      
      Closes #24504.
      
      -------------------------
      Metric Decrease:
          T24602_perf_size
          size_hello_artifact
      -------------------------
      ab840ce6
    • Zejun Wu's avatar
      Make renamer to be more flexible with parens in the LHS of the rules · 4d3acbcf
      Zejun Wu authored and Marge Bot's avatar Marge Bot committed
      We used to reject LHS like `(f a) b` in RULES and requires it to be written as
      `f a b`. It will be handy to allow both as the expression may be more
      readable with extra parens in some cases when infix operator is involved.
      Espceially when TemplateHaskell is used, extra parens may be added out of
      user's control and result in "valid" rules being rejected and there
      are not always ways to workaround it.
      
      Fixes #24621
      4d3acbcf
    • Rodrigo Mesquita's avatar
      Document NcgImpl methods · b2682534
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Fixes #19914
      b2682534
  7. May 08, 2024
  8. May 07, 2024
    • Arsen Arsenović's avatar
      Split out the C-- preprocessor, and make it pass -g0 · 25b0b404
      Arsen Arsenović authored and Marge Bot's avatar Marge Bot committed
      Previously, C-- was processed with the C preprocessor program.  This
      means that it inherited flags passed via -optc.  A flag that is somewhat
      often passed through -optc is -g.  At certain -g levels (>=2), GCC
      starts emitting defines *after* preprocessing, for the purposes of
      debug info generation.  This is not useful for the C-- compiler, and, in
      fact, causes lexer errors.  We can suppress this effect (safely, if
      supported) via -g0.
      
      As a workaround, in older versions of GCC (<=10), GCC only emitted
      defines if a certain set of -g*3 flags was passed.  Newer versions check
      the debug level.  For the former, we filter out those -g*3 flags and,
      for the latter, we specify -g0 on top of that.
      
      As a compatible and effective solution, this change adds a C--
      preprocessor distinct from the C compiler and preprocessor, but that
      keeps its flags.  The command line produced for C-- preprocessing now
      looks like:
      
        $pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP
      
      Closes: #24474
      25b0b404
    • Arsen Arsenović's avatar
      Add the cmm_cpp_is_gcc predicate to the testsuite · 4d59abf2
      Arsen Arsenović authored and Marge Bot's avatar Marge Bot committed
      A future C-- test called T24474-cmm-override-g0 relies on the
      GCC-specific behaviour of -g3 implying -dD, which, in turn, leads to it
      emitting #defines past the preprocessing stage.  Clang, at least, does
      not do this, so the test would fail if ran on Clang.
      
      As the behaviour here being tested is ``-optCmmP-g3'' undoing effects of
      the workaround we apply as a fix for bug #24474, and the workaround was
      for GCC-specific behaviour, the test needs to be marked as fragile on
      other compilers.
      4d59abf2
    • Andrei Borzenkov's avatar
      Rename Solo# data constructor to MkSolo# (#24673) · 3b51995c
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      - data Solo# a = (# a #)
      + data Solo# a = MkSolo# a
      
      And `(# foo #)` syntax now becomes just a syntactic
      sugar for `MkSolo# a`.
      3b51995c
  9. May 06, 2024
  10. May 05, 2024
Loading