Skip to content
Snippets Groups Projects
  1. Apr 03, 2024
    • Duncan Coutts's avatar
      Move most of the delay# impl from cmm to C · 457705a8
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Moves it into the IOManager.c where we can follow the new pattern of
      switching on the selected I/O manager.
      
      Uses a new IOManager API: syncDelay, following the naming convention of
      sync* for thread-synchronous I/O & timer/delay operations.
      
      As part of porting from cmm to C, we maintain the rule that the
      why_blocked gets accessed using load acquire and store release atomic
      memory operations. There was one exception to this rule: in the delay#
      primop cmm code on posix (not win32), the why_blocked was being updated
      using a store relaxed, not a store release. I've no idea why. In this
      convesion I'm playing it safe here and using store release consistently.
      457705a8
    • Duncan Coutts's avatar
      Move most of waitRead#/Write# from cmm to C · c2f26f36
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Moves it into the IOManager.c where we can follow the new pattern of
      switching on the selected I/O manager.
      c2f26f36
    • Duncan Coutts's avatar
      Convert initIOManagerAfterFork and wakeupIOManager to switch style · 1d36e609
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      1d36e609
    • Duncan Coutts's avatar
      Split up the CapIOManager content by I/O manager · a5bad3d2
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Using the new IOMGR_ENABLED_<name> CPP defines.
      a5bad3d2
    • Duncan Coutts's avatar
      Convert {init,stop,exit}IOManager to switch style · 1a8f020f
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Rather than ad-hoc cpp conitionals on THREADED_RTS and mingw32_HOST_OS,
      we use a style where we switch on the I/O manager impl, with cases for
      each I/O manager impl.
      1a8f020f
    • Duncan Coutts's avatar
      Change the handling of the RTS flag --io-manager= · 85b0f87a
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      Now instead of it being just used on Windows to select between the WinIO
      vs the MIO or Win32-legacy I/O managers, it is now used on all platforms
      for selecting the I/O manager to use.
      
      Right now it remains the case that there is only an actual choice on
      Windows, but that will change later.
      
      Document the --io-manager flag in the user guide.
      
      This change is also reflected in the RTS flags types in the base
      library. Deprecate the export of IoSubSystem from GHC.RTS.Flags with a
      message to import it from GHC.IO.Subsystem.
      
      The way the 'IoSubSystem' is detected also changes. Instead of looking
      at the RTS flag, there is now a C bool global var in the RTS which gets
      set on startup when the I/O manager is selected. This bool var says
      whether the selected I/O manager classifies as "native" on Windows,
      which in practice means the WinIO I/O manager has been selected.
      
      Similarly, the is_io_mng_native_p RTS helper function is re-implemented
      in terms of the selected I/O manager, rather than based on the RTS
      flags.
      
      We do however remove the ./configure --native-io-manager flag because
      we're bringing the WinIO/MIO/Win32-legacy choice under the new general
      scheme for selecting I/O managers, and that new scheme involves no
      ./configure time user choices, just runtime RTS flag choices.
      85b0f87a
    • Duncan Coutts's avatar
      Initial ./configure support for selecting I/O managers · 15f4d867
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      
      In this patch we just define new CPP vars, but don't yet use them
      or replace the existing approach. That will follow.
      
      The intention here is that every I/O manager can be enabled/disabled at
      GHC build time (subject to some constraints). More than one I/O manager
      can be enabled to be built. At least one I/O manager supporting the
      non-threaded RTS must be enabled as well as at least one supporting the
      non-threaded RTS. The I/O managers enabled here will become the choices
      available at runtime at RTS startup (in later patches). The choice can
      be made with RTS flags. There are separate sets of choices for the
      threaded and non-threaded RTS ways, because most I/O managers are
      specific to these ways. Furthermore we must establish a default I/O
      manager for the threaded and non-threaded RTS.
      
      Most I/O managers are platform-specific so there are checks to ensure
      each one can be enabled on the platform. Such checks are also where (in
      future) any system dependencies (e.g. libraries) can be checked.
      
      The output is a set of CPP flags (in the mk/config.h file), with one
      flag per named I/O manager:
      * IOMGR_BUILD_<name>                : which ones should be built (some)
      * IOMGR_DEFAULT_NON_THREADED_<name> : which one is default (exactly one)
      * IOMGR_DEFAULT_THREADED_<name>     : which one is default (exactly one)
      
      and a set of derived flags in IOManager.h
      
      * IOMGR_ENABLED_<name>              : enabled for the current RTS way
      
      Note that IOMGR_BUILD_<name> just says that an I/O manager will be
      built for _some_ RTS way (i.e. threaded or non-threaded). The derived
      flags IOMGR_ENABLED_<name> in IOManager.h say if each I/O manager is
      enabled in the "current" RTS way. These are the ones that can be used
      for conditional compilation of the I/O manager code.
      
      Co-authored-by: default avatarPi Delport <pi@well-typed.com>
      15f4d867
    • Simon Peyton Jones's avatar
      Try using MCoercion in exprIsConApp_maybe · e0b0c717
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This is just a simple refactor that makes exprIsConApp_maybe
      a little bit more direct, simple, and efficient.
      
      Metrics: compile_time/bytes allocated
          geo. mean                                          -0.1%
          minimum                                            -2.0%
          maximum                                            -0.0%
      
      Not a big gain, but worthwhile given that the code is, if anything,
      easier to grok.
      e0b0c717
    • Simon Peyton Jones's avatar
      Deal with duplicate tyvars in type declarations · faa30b41
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      GHC was outright crashing before this fix: #24604
      faa30b41
    • Sylvain Henry's avatar
      JS: fix h$appendToHsString implementation (#24495) · 527616e9
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      h$appendToHsString needs to wrap its argument in an updatable thunk
      to behave like unpackAppendCString#. Otherwise if a SingleEntry thunk is
      passed, it is stored as-is in a CONS cell, making the resulting list
      impossible to deepseq (forcing the thunk doesn't update the contents of
      the CONS cell)!
      
      The added test checks that the optimization kicks in and that
      h$appendToHsString works as intended.
      
      Fix #24495
      527616e9
    • Sylvain Henry's avatar
      JS: reenable h$appendToHsString optimization (#24495) · b36ee57b
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      The optimization introducing h$appendToHsString wasn't kicking in
      anymore (while it did in 9.8.1) because of the changes introduced in #23270 (7e0c8b3b).
      This patch reenables the optimization by matching on case-expression, as
      done in Cmm for unpackCString# standard thunks.
      
      The test is also T24495 added in the next commits (two commits for ease
      of backporting to 9.8).
      b36ee57b
    • Rodrigo Mesquita's avatar
      th: Hide the Language.Haskell.TH.Lib.Internal module from haddock · 817e8936
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Fixes #24562
      817e8936
  2. Apr 02, 2024
    • Andrei Borzenkov's avatar
      Merge tc_infer_hs_type and tc_hs_type into one function using ExpType philosophy (#24299, #23639) · a1c18c7b
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      This patch implements refactoring which is a prerequisite to
      updating kind checking of type patterns. This is a huge simplification
      of the main worker that checks kind of HsType.
      
      It also fixes the issues caused by previous code duplication, e.g.
      that we didn't add module finalizers from splices in inference mode.
      a1c18c7b
    • Cheng Shao's avatar
      ci: improve TSAN CI jobs · 07cb627c
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      - Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm
        instrumentation as well.
      - Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc
        that @bgamari confirms he's using in #GHC:matrix.org. Ideally we
        should be using latest clang release for latest improvements in
        sanitizers, though that's left as future work.
      - Mark TSAN jobs as manual+allow_failure in validate pipelines. The
        purpose is to demonstrate that we have indeed at least fixed
        building of TSAN mode in CI without blocking the patch to land, and
        once merged other people can begin playing with TSAN using their own
        dev setups and feature branches.
      07cb627c
    • Cheng Shao's avatar
      compiler: fix github link to __tsan_memory_order in a comment · 865bd717
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      865bd717
    • Cheng Shao's avatar
      rts: fix clang-specific errors when compiling with TSAN · a9ab9455
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This commit fixes clang-specific rts compilation errors when compiling
      with TSAN:
      
      - clang doesn't have -Wtsan flag
      - Fix prototype of ghc_tsan_* helper functions
      - __tsan_atomic_* functions aren't clang built-ins and
        sanitizer/tsan_interface_atomic.h needs to be included
      - On macOS, TSAN runtime library is
        libclang_rt.tsan_osx_dynamic.dylib, not libtsan. -fsanitize-thread
        as a link-time flag will take care of linking the TSAN runtime
        library anyway so remove tsan as an rts extra library
      a9ab9455
    • Cheng Shao's avatar
      rts: fix errors when compiling with TSAN · e91dad93
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This commit fixes rts compilation errors when compiling with TSAN:
      
      - xxx_FENCE macros are redefined and trigger CPP warnings.
      - Use SIZEOF_W. WORD_SIZE_IN_BITS is provided by MachDeps.h which
        Cmm.h doesn't include by default.
      e91dad93
    • Ben Gamari's avatar
      rts: Fix TSAN_ENABLED CPP guard · c8a4c050
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      This should be `#if defined(TSAN_ENABLED)`, not `#if TSAN_ENABLED`,
      lest we suffer warnings.
      c8a4c050
  3. Apr 01, 2024
  4. Mar 29, 2024
  5. Mar 27, 2024
  6. Mar 26, 2024
  7. Mar 25, 2024
  8. Mar 23, 2024
  9. Mar 22, 2024
    • Sebastian Graf's avatar
      Simplifier: Re-do dependency analysis in abstractFloats (#24551) · 3e0b2b1f
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      In #24551, we abstracted a string literal binding over a type variable,
      triggering a CoreLint error when that binding floated to top-level.
      
      The solution implemented in this patch fixes this by re-doing dependency
      analysis on a simplified recursive let binding that is about to be type
      abstracted, in order to find the minimal set of type variables to abstract over.
      See wrinkle (AB5) of Note [Floating and type abstraction] for more details.
      
      Fixes #24551
      3e0b2b1f
    • Sylvain Henry's avatar
      JS: fix some comments · 864922ef
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      864922ef
    • Sylvain Henry's avatar
      Lexer: small perf changes · 7dfdf3d9
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      - Use unsafeChr because we know our values to be valid
      - Remove some unnecessary use of `ord` (return Word8 values directly)
      7dfdf3d9
Loading