Skip to content
Snippets Groups Projects
  1. Feb 08, 2024
    • Ben Gamari's avatar
      Move `base` to `ghc-internal` · 44f6557a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we move a good deal of the implementation of `base` into a new
      package, `ghc-internal` such that it can be evolved independently
      from the user-visible interfaces of `base`.
      
      While we want to isolate implementation from interfaces, naturally, we
      would like to avoid turning `base` into a mere set of module re-exports.
      However, this is a non-trivial undertaking for a variety of reasons:
      
       * `base` contains numerous known-key and wired-in things, requiring
         corresponding changes in the compiler
      
       * `base` contains a significant amount of C code and corresponding
         autoconf logic, which is very fragile and difficult to break apart
      
       * `base` has numerous import cycles, which are currently dealt with via
         carefully balanced `hs-boot` files
      
       * We must not break existing users
      
      To accomplish this migration, I tried the following approaches:
      
      * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
        migration of modules into ghc-internal: this knot is simply too
        intertwined to be easily pulled apart, especially given the rather
        tricky import cycles that it contains)
      
      * [Move-Core]: Moving the "core" connected component of base (roughly
        150 modules) into ghc-internal. While the Haskell side of this seems
        tractable, the C dependencies are very subtle to break apart.
      
      * [Move-Incrementally]:
      
        1. Move all of base into ghc-internal
        2. Examine the module structure and begin moving obvious modules (e.g.
           leaves of the import graph) back into base
        3. Examine the modules remaining in ghc-internal, refactor as necessary
           to facilitate further moves
        4. Go to (2) iterate until the cost/benefit of further moves is
           insufficient to justify continuing
        5. Rename the modules moved into ghc-internal to ensure that they don't
           overlap with those in base
        6. For each module moved into ghc-internal, add a shim module to base
           with the declarations which should be exposed and any requisite
           Haddocks (thus guaranteeing that base will be insulated from changes
           in the export lists of modules in ghc-internal
      
      Here I am using the [Move-Incrementally] approach, which is empirically
      the least painful of the unpleasant options above
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.Cabal
          haddock.base
      Metric Increase:
          MultiComponentModulesRecomp
          T16875
          size_hello_artifact
      44f6557a
  2. Feb 01, 2024
  3. Jan 31, 2024
  4. Jan 24, 2024
    • Cheng Shao's avatar
      rts: enable wasm32 register mapping · 0cda2b8b
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      The wasm backend didn't properly make use of all Cmm global registers
      due to #24347. Now that it is fixed, this patch re-enables full
      register mapping for wasm32, and we can now generate smaller & faster
      wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152.
      0cda2b8b
  5. Jan 19, 2024
  6. Jan 16, 2024
    • Matthew Pickering's avatar
      eventlog: Fix off-by-one error in postIPE · 5776008c
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      We were missing the extra_comma from the calculation of the size of the
      payload of postIPE. This was causing assertion failures when the event
      would overflow the buffer by one byte, as ensureRoomForVariable event
      would report there was enough space for `n` bytes but then we would
      write `n + 1` bytes into the buffer.
      
      Fixes #24287
      5776008c
    • Javier Sagredo's avatar
      Profiling: Adds an option to not start time profiling at startup · 5077416e
      Javier Sagredo authored and Marge Bot's avatar Marge Bot committed
      Using the functionality provided by
      d89deeba, this patch creates a new rts
      flag `--no-automatic-time-samples` which disables the time profiling
      when starting a program. It is then expected that the user starts it
      whenever it is needed.
      
      Fixes #24337
      5077416e
  7. Dec 20, 2023
    • Ben Gamari's avatar
      Fix thunk update ordering · 9a52ae46
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously we attempted to ensure soundness of concurrent thunk update
      by synchronizing on the access of the thunk's info table pointer field.
      This was believed to be sufficient since the indirectee (which may
      expose a closure allocated by another core) would not be examined
      until the info table pointer update is complete.
      
      However, it turns out that this can result in data races in the presence
      of multiple threads racing a update a single thunk. For instance,
      consider this interleaving under the old scheme:
      
                  Thread A                             Thread B
                  ---------                            ---------
          t=0     Enter t
            1     Push update frame
            2     Begin evaluation
      
            4     Pause thread
            5     t.indirectee=tso
            6     Release t.info=BLACKHOLE
      
            7     ... (e.g. GC)
      
            8     Resume thread
            9     Finish evaluation
            10    Relaxed t.indirectee=x
      
            11                                         Load t.info
            12                                         Acquire fence
            13                                         Inspect t.indirectee
      
            14    Release t.info=BLACKHOLE
      
      Here Thread A enters thunk `t` but is soon paused, resulting in `t`
      being lazily blackholed at t=6. Then, at t=10 Thread A finishes
      evaluation and updates `t.indirectee` with a relaxed store.
      
      Meanwhile, Thread B enters the blackhole. Under the old scheme this
      would introduce an acquire-fence but this would only synchronize with
      Thread A at t=6. Consequently, the result of the evaluation, `x`, is not
      visible to Thread B, introducing a data race.
      
      We fix this by treating the `indirectee` field as we do all other
      mutable fields. This means we must always access this field with
      acquire-loads and release-stores.
      
      See #23185.
      9a52ae46
  8. Dec 13, 2023
  9. Nov 17, 2023
  10. Nov 10, 2023
  11. Nov 01, 2023
  12. Oct 28, 2023
  13. Oct 26, 2023
  14. Oct 22, 2023
  15. Oct 20, 2023
  16. Oct 18, 2023
Loading