Skip to content
Snippets Groups Projects
  1. Feb 17, 2024
  2. Feb 14, 2024
  3. Feb 13, 2024
  4. Feb 12, 2024
    • Teo Camarasu's avatar
      nonmoving: Add support for heap profiling · bedb4f0d
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      Add support for heap profiling while using the nonmoving collector.
      
      We greatly simply the implementation by disabling concurrent collection for
      GCs when heap profiling is enabled. This entails that the marked objects on
      the nonmoving heap are exactly the live objects.
      
      Note that we match the behaviour for live bytes accounting by taking the size
      of objects on the nonmoving heap to be that of the segment's block
      rather than the object itself.
      
      Resolves #22221
      bedb4f0d
    • Sylvain Henry's avatar
      JS: add support for linking C sources · aef587f6
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Support linking C sources with JS output of the JavaScript backend.
      See the added documentation in the users guide.
      
      The implementation simply extends the JS linker to use the objects (.o)
      that were already produced by the emcc compiler and which were filtered
      out previously. I've also added some options to control the link with C
      functions (see the documentation about pragmas).
      
      With this change I've successfully compiled the direct-sqlite package
      which embeds the sqlite.c database code. Some wrappers are still
      required (see the documentation about wrappers) but everything generic
      enough to be reused for other libraries have been integrated into
      rts/js/mem.js.
      aef587f6
    • Sylvain Henry's avatar
      JS: handle stored null StablePtr · df9fd9f7
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Some Haskell codes unsafely cast StablePtr into ptr to compare against
      NULL. E.g. in direct-sqlite:
      
        if castStablePtrToPtr aggStPtr /= nullPtr then
      
      where `aggStPtr` is read (`peek`) from zeroed memory initially.
      
      We fix this by giving these StablePtr the same representation as other
      null pointers. It's safe because StablePtr at offset 0 is unused (for
      this exact reason).
      df9fd9f7
  5. Feb 10, 2024
    • Matthew Pickering's avatar
      rts: eras profiling mode · b0293f78
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      The eras profiling mode is useful for tracking the life-time of
      closures. When a closure is written, the current era is recorded in the
      profiling header. This records the era in which the closure was created.
      
      * Enable with -he
      * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era
      * Automatically: --automatic-era-increment, increases the user era on major
        collections
      * The first era is era 1
      * -he<era> can be used with other profiling modes to select a specific
        era
      
      If you just want to record the era but not to perform heap profiling you
      can use `-he --no-automatic-heap-samples`.
      
      https://well-typed.com/blog/2024/01/ghc-eras-profiling/
      
      Fixes #24332
      b0293f78
  6. 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
  7. Feb 01, 2024
  8. Jan 31, 2024
  9. 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
  10. Jan 19, 2024
  11. 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
  12. 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
  13. Dec 13, 2023
Loading