1. 01 Apr, 2020 1 commit
  2. 26 Mar, 2020 1 commit
    • Sylvain Henry's avatar
      DynFlags refactoring III · 0de03cd7
      Sylvain Henry authored
      Use Platform instead of DynFlags when possible:
      * `tARGET_MIN_INT` et al. replaced with `platformMinInt` et al.
      * no more DynFlags in PreRules: added a new `RuleOpts` datatype
      * don't use `wORD_SIZE` in the compiler
      * make `wordAlignment` use `Platform`
      * make `dOUBLE_SIZE` a constant
      
      Metric Decrease:
          T13035
          T1969
      0de03cd7
  3. 05 Mar, 2020 1 commit
  4. 29 Feb, 2020 1 commit
  5. 25 Feb, 2020 1 commit
  6. 12 Feb, 2020 1 commit
  7. 11 Feb, 2020 1 commit
  8. 08 Feb, 2020 1 commit
  9. 27 Jan, 2020 1 commit
  10. 25 Jan, 2020 1 commit
  11. 20 Jan, 2020 1 commit
    • Ben Gamari's avatar
      unregisterised: Fix declaration for stg_NO_FINALIZER · 17e43a7c
      Ben Gamari authored
      Previously it had a redundant _entry suffix. We never noticed this
      previously presumably because we never generated references to it
      (however hard to believe this may be). However, it did start failing in
      !1304.
      17e43a7c
  12. 04 Jan, 2020 1 commit
  13. 01 Jan, 2020 1 commit
  14. 11 Dec, 2019 1 commit
    • Crazycolorz5's avatar
      rts: Specialize hashing at call site rather than in struct. · f80c4a66
      Crazycolorz5 authored
      Separate word and string hash tables on the type level, and do not store
      the hashing function.  Thus when a different hash function is desire it
      is provided upon accessing the table. This is worst case the same as
      before the change, and in the majority of cases is better. Also mark the
      functions for aggressive inlining to improve performance.  {F1686506}
      
      Reviewers: bgamari, erikd, simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #13165
      
      Differential Revision: https://phabricator.haskell.org/D4889
      f80c4a66
  15. 28 Nov, 2019 1 commit
  16. 23 Nov, 2019 2 commits
  17. 20 Nov, 2019 2 commits
  18. 19 Nov, 2019 1 commit
    • Ben Gamari's avatar
      nonmoving: Use correct info table pointer accessor · c819c0e4
      Ben Gamari authored
      Previously we used INFO_PTR_TO_STRUCT instead of
      THUNK_INFO_PTR_TO_STRUCT when looking at a thunk. These two happen to be
      equivalent on 64-bit architectures due to alignment considerations
      however they are different on 32-bit platforms. This lead to #17487.
      
      To fix this we also employ a small optimization: there is only one thunk
      of type WHITEHOLE (namely stg_WHITEHOLE_info). Consequently, we can just
      use a plain pointer comparison instead of testing against info->type.
      c819c0e4
  19. 02 Nov, 2019 1 commit
  20. 26 Oct, 2019 1 commit
  21. 23 Oct, 2019 1 commit
    • Matthew Pickering's avatar
      eventlog: Dump cost centre stack on each sample · 17987a4b
      Matthew Pickering authored
      With this change it is possible to reconstruct the timing portion of a
      `.prof` file after the fact. By logging the stacks at each time point
      a more precise executation trace of the program can be observed rather
      than all identical cost centres being identified in the report.
      
      There are two new events:
      
      1. `EVENT_PROF_BEGIN` - emitted at the start of profiling to communicate
      the tick interval
      2. `EVENT_PROF_SAMPLE_COST_CENTRE` - emitted on each tick to communicate the
      current call stack.
      
      Fixes #17322
      17987a4b
  22. 22 Oct, 2019 9 commits
  23. 21 Oct, 2019 5 commits
    • Ben Gamari's avatar
    • Ben Gamari's avatar
      4a44ab33
    • Ben Gamari's avatar
      rts: Implement concurrent collection in the nonmoving collector · bd8e3ff4
      Ben Gamari authored
      This extends the non-moving collector to allow concurrent collection.
      
      The full design of the collector implemented here is described in detail
      in a technical note
      
          B. Gamari. "A Concurrent Garbage Collector For the Glasgow Haskell
          Compiler" (2018)
      
      This extension involves the introduction of a capability-local
      remembered set, known as the /update remembered set/, which tracks
      objects which may no longer be visible to the collector due to mutation.
      To maintain this remembered set we introduce a write barrier on
      mutations which is enabled while a concurrent mark is underway.
      
      The update remembered set representation is similar to that of the
      nonmoving mark queue, being a chunked array of `MarkEntry`s. Each
      `Capability` maintains a single accumulator chunk, which it flushed
      when it (a) is filled, or (b) when the nonmoving collector enters its
      post-mark synchronization phase.
      
      While the write barrier touches a significant amount of code it is
      conceptually straightforward: the mutator must ensure that the referee
      of any pointer it overwrites is added to the update remembered set.
      However, there are a few details:
      
       * In the case of objects with a dirty flag (e.g. `MVar`s) we can
         exploit the fact that only the *first* mutation requires a write
         barrier.
      
       * Weak references, as usual, complicate things. In particular, we must
         ensure that the referee of a weak object is marked if dereferenced by
         the mutator. For this we (unfortunately) must introduce a read
         barrier, as described in Note [Concurrent read barrier on deRefWeak#]
         (in `NonMovingMark.c`).
      
       * Stable names are also a bit tricky as described in Note [Sweeping
         stable names in the concurrent collector] (`NonMovingSweep.c`).
      
      We take quite some pains to ensure that the high thread count often seen
      in parallel Haskell applications doesn't affect pause times. To this end
      we allow thread stacks to be marked either by the thread itself (when it
      is executed or stack-underflows) or the concurrent mark thread (if the
      thread owning the stack is never scheduled). There is a non-trivial
      handshake to ensure that this happens without racing which is described
      in Note [StgStack dirtiness flags and concurrent marking].
      Co-Authored-by: Ömer Sinan Ağacan's avatarÖmer Sinan Ağacan <omer@well-typed.com>
      bd8e3ff4
    • Ömer Sinan Ağacan's avatar
      rts: Non-concurrent mark and sweep · 68e0647f
      Ömer Sinan Ağacan authored
      This implements the core heap structure and a serial mark/sweep
      collector which can be used to manage the oldest-generation heap.
      This is the first step towards a concurrent mark-and-sweep collector
      aimed at low-latency applications.
      
      The full design of the collector implemented here is described in detail
      in a technical note
      
          B. Gamari. "A Concurrent Garbage Collector For the Glasgow Haskell
          Compiler" (2018)
      
      The basic heap structure used in this design is heavily inspired by
      
          K. Ueno & A. Ohori. "A fully concurrent garbage collector for
          functional programs on multicore processors." /ACM SIGPLAN Notices/
          Vol. 51. No. 9 (presented by ICFP 2016)
      
      This design is intended to allow both marking and sweeping
      concurrent to execution of a multi-core mutator. Unlike the Ueno design,
      which requires no global synchronization pauses, the collector
      introduced here requires a stop-the-world pause at the beginning and end
      of the mark phase.
      
      To avoid heap fragmentation, the allocator consists of a number of
      fixed-size /sub-allocators/. Each of these sub-allocators allocators into
      its own set of /segments/, themselves allocated from the block
      allocator. Each segment is broken into a set of fixed-size allocation
      blocks (which back allocations) in addition to a bitmap (used to track
      the liveness of blocks) and some additional metadata (used also used
      to track liveness).
      
      This heap structure enables collection via mark-and-sweep, which can be
      performed concurrently via a snapshot-at-the-beginning scheme (although
      concurrent collection is not implemented in this patch).
      
      The mark queue is a fairly straightforward chunked-array structure.
      The representation is a bit more verbose than a typical mark queue to
      accomodate a combination of two features:
      
       * a mark FIFO, which improves the locality of marking, reducing one of
         the major overheads seen in mark/sweep allocators (see [1] for
         details)
      
       * the selector optimization and indirection shortcutting, which
         requires that we track where we found each reference to an object
         in case we need to update the reference at a later point (e.g. when
         we find that it is an indirection). See Note [Origin references in
         the nonmoving collector] (in `NonMovingMark.h`) for details.
      
      Beyond this the mark/sweep is fairly run-of-the-mill.
      
      [1] R. Garner, S.M. Blackburn, D. Frampton. "Effective Prefetch for
          Mark-Sweep Garbage Collection." ISMM 2007.
      Co-Authored-By: Ben Gamari's avatarBen Gamari <ben@well-typed.com>
      68e0647f
    • Ben Gamari's avatar
      rts: Introduce flag to enable the nonmoving old generation · 6ff29c06
      Ben Gamari authored
      This flag will enable the use of a non-moving oldest generation.
      6ff29c06
  24. 20 Oct, 2019 1 commit
  25. 18 Oct, 2019 2 commits
    • Ömer Sinan Ağacan's avatar
      rts/BlockAlloc: Allow aligned allocation requests · 921e4e36
      Ömer Sinan Ağacan authored
      This implements support for block group allocations which are aligned to
      an integral number of blocks.
      
      This will be used by the nonmoving garbage collector, which uses the
      block allocator to allocate the segments which back its heap. These
      segments are a fixed number of blocks in size, with each segment being
      aligned to the segment size boundary. This allows us to easily find the
      segment metadata stored at the beginning of the segment.
      921e4e36
    • Ben Gamari's avatar
      rts: Fix macro parenthesisation · 4d674c4e
      Ben Gamari authored
      4d674c4e