Skip to content
Snippets Groups Projects
  1. Jan 27, 2021
  2. Jan 25, 2021
    • Duncan Coutts's avatar
      Remove ioManager{Start,Die,Wakeup} from IOManager.h · 34a8a0e4
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      They are not part of the IOManager interface used within the rest of the
      RTS. They are the part of the interface of specific I/O manager
      implementations.
      
      They are no longer called directly elsewhere in the RTS, and are now
      only called by the dispatch functions in IOManager.c
      34a8a0e4
    • Duncan Coutts's avatar
      Add a common wakeupIOManager hook · e3564e38
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Use in the scheduler in threaded mode.
      
      Replaces the direct call to ioManagerWakeup which are part of specific
      I/O manager implementations.
      e3564e38
    • Duncan Coutts's avatar
      Replace a ioManagerDie call with stopIOManager · 9a7d19ba
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      The latter is the proper hook defined in IOManager.h. The former is part
      of a specific I/O manager implementation (the threaded unix one).
      9a7d19ba
    • Duncan Coutts's avatar
      Replace a direct call to ioManagerStartCap with a new hook · d345d3be
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Replace a direct call to ioManagerStartCap in the forkProcess in
      Schedule.c with a new hook initIOManagerAfterFork in IOManager.
      
      This replaces a direct hook in the scheduler from the a single I/O
      manager impl (the threaded unix one) with a generic hook.
      
      Add some commentrary on opportunities for future rationalisation.
      d345d3be
    • Duncan Coutts's avatar
      Move hooks for I/O manager startup / shutdown into IOManager.{c,h} · 4ad726fc
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      4ad726fc
    • Duncan Coutts's avatar
      Move ioManager{Start,Wakeup,Die} to internal IOManager.h · e93384e8
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Move them from the external IOInterface.h to the internal IOManager.h.
      The functions are all in fact internal. They are not used from the base
      library at all.
      
      Remove ioManagerWakeup as an exported symbol. It is not used elsewhere.
      e93384e8
    • Duncan Coutts's avatar
      Move setIOManagerControlFd from Capability.c to IOManager.c · 455ad48b
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      This is a better home for it. It is not really an aspect of
      capabilities.  It is specific to one of the I/O manager impls.
      455ad48b
    • Duncan Coutts's avatar
      Start to centralise the I/O manager hooks from other bits of the RTS · 54946e4f
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      It is currently rather difficult to understand or work with the various
      I/O manager implementations. This is for a few reasons:
      
      1. They do not have a clear or common API. There are some common
         function names, but a lot of things just get called directly.
      2. They have hooks into many other parts of the RTS where they get
         called from.
      3. There is a _lot_ of CPP involved, both THREADED_RTS vs !THREADED_RTS
         and also mingw32_HOST_OS vs !mingw32_HOST_OS. This doesn't really
         identify the I/O manager implementation.
      4. They have data structures with unclear ownership, or that are
         co-owned with other components like the scheduler. Some data
         structures are used by multiple I/O managers.
      
      One thing that would help is if the interface between the I/O managers
      and the rest of the RTS was clearer, even if it was not completely
      uniform. Centralising it would make it easier to see how to reduce any
      unnecessary diversity in the interfaces.
      
      This patch makes a start by creating a new IOManager.{h,c} module. It is
      initially empty, but we will move things into it in subsequent patches.
      54946e4f
    • Duncan Coutts's avatar
      Rename includes/rts/IOManager.h to IOInterface.h · 8bdbfdd8
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Naming is hard. Where we want to get to is to have a clear internal and
      external API for the IO manager within the RTS. What we have right now
      is just the external API (used in base for the Haskell side of the
      threaded IO manager impls) living in includes/rts/IOManager.h.
      
      We want to add a clear RTS internal API, which really ought to live in
      rts/IOManager.h. Several people think it's too confusing to have both:
       * includes/rts/IOManager.h for the external API
       * rts/IOManager.h          for the internal API
      
      So the plan is to add rts/IOManager.{h,c} as the internal parts, and
      rename the external part to be includes/rts/IOInterface.h.
      
      It is admittidly not great to have .h files in includes/rts/ called
      "interface" since by definition, every .h fle under includes/ is an
      interface!
      
      Alternative naming scheme suggestions welcome!
      8bdbfdd8
    • Duncan Coutts's avatar
      Move win32/IOManager to win32/MIOManager · 083d7aeb
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      It is only for MIO, and we want to use the generic name IOManager for
      the name of the common parts of the interface and dispatch.
      083d7aeb
  3. Jan 24, 2021
    • Sebastian Graf's avatar
      CoreToStg.Prep: Speculative evaluation · b18d9e97
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      From `Note [Speculative evaluation]`:
      
      Since call-by-value is much cheaper than call-by-need, we case-bind
      arguments that are either
      
        1. Strictly evaluated anyway, according to the StrictSig of the
           callee, or
        2. ok-for-spec, according to 'exprOkForSpeculation'
      
      While (1) is a no-brainer and always beneficial, (2) is a bit
      more subtle, as the careful haddock for 'exprOkForSpeculation'
      points out. Still, by case-binding the argument we don't need
      to allocate a thunk for it, whose closure must be retained as
      long as the callee might evaluate it. And if it is evaluated on
      most code paths anyway, we get to turn the unknown eval in the
      callee into a known call at the call site.
      
      NoFib Results:
      ```
      --------------------------------------------------------------------------------
              Program         Allocs    Instrs
      --------------------------------------------------------------------------------
                 ansi          -9.4%    -10.4%
             maillist          -0.1%     -0.1%
            paraffins          -0.7%     -0.5%
                  scc          -0.0%     +0.1%
             treejoin          -0.0%     -0.1%
      --------------------------------------------------------------------------------
                  Min          -9.4%    -10.4%
                  Max           0.0%     +0.1%
       Geometric Mean          -0.1%     -0.1%
      ```
      
      Fixes #19224.
      b18d9e97
    • John Ericson's avatar
      Track the dependencies of `GHC.Hs.Expr.Types` · 8ec6d62a
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      Thery is still, in my view, far too numerous, but I believe this won't
      be too hard to improve upon. At the very lease, we can always add more
      extension points!
      8ec6d62a
    • John Ericson's avatar
      Separate AST from GhcPass (#18936) · 81f06655
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      ----------------
      What:
      
      There are two splits.
      
      The first spit is:
      
       - `Language.Haskell.Syntax.Extension`
       - `GHC.Hs.Extension`
      
      where the former now just contains helpers like `NoExtCon` and all the
      families, and the latter is everything having to do with `GhcPass`.
      
      The second split is:
      
       - `Language.Haskell.Syntax.<mod>`
       - `GHC.Hs.<mod>`
      
      Where the former contains all the data definitions, and the few helpers
      that don't use `GhcPass`, and the latter contains everything else. The
      second modules also reexport the former.
      
      ----------------
      Why:
      
      See the issue for more details, but in short answer is we're trying to
      grasp at the modularity TTG is supposed to offer, after a long time of
      mainly just getting the safety benefits of more complete pattern
      matching on the AST.
      
      Now, we have an AST datatype which, without `GhcPass` is decently
      stripped of GHC-specific concerns. Whereas before, not was it
      GHC-specific, it was aware of all the GHC phases despite the
      parameterization, with the instances and parametric data structure
      side-by-side.
      
      For what it's worth there are also some smaller, imminent benefits:
      
      - The latter change also splits a strongly connected component in two,
        since none of the `Language.Haskell.Syntax.*` modules import the older
        ones.
      
      - A few TTG violations (Using GhcPass directly in the AST) in `Expr` are
        now more explicitly accounted for with new type families to provide the
        necessary indirection.
      
      -----------------
      Future work:
      
      - I don't see why all the type families should live in
        `Language.Haskell.Syntax.Extension`. That seems anti-modular for
        little benefit. All the ones used just once can be moved next to the
        AST type they serve as an extension point for.
      
      - Decide what to do with the `Outputable` instances. Some of these are
        no orphans because they referred to `GhcPass`, and had to be moved. I
        think the types could be generalized so they don't refer to `GhcPass`
        and therefore can be moved back, but having gotten flak for increasing
        the size and complexity types when generalizing before, I did *not*
        want to do this.
      
      - We should triage the remaining contents of `GHC.Hs.<mod>`. The
        renaming helpers are somewhat odd for needing `GhcPass`. We might
        consider if they are a) in fact only needed by one phase b) can be
        generalized to be non-GhcPass-specific (e.g. take a callback rather
        than GADT-match with `IsPass`) and then they can live in
        `Language.Haskell.Syntax.<mod>`.
      
      For more details, see
      https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow
      
      Bumps Haddock submodule
      81f06655
    • Cheng Shao's avatar
      Add _validatebuild to .gitignore · e6e1cf74
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      [ci skip]
      e6e1cf74
  4. Jan 23, 2021
  5. Jan 22, 2021
Loading