Skip to content
Snippets Groups Projects
  1. Jun 04, 2024
    • Cheng Shao's avatar
      rts: remove legacy i386 windows code paths · d1fe9ab6
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This commit removes some legacy i386 windows related code paths in the
      RTS, given this target is no longer supported.
      d1fe9ab6
    • Cheng Shao's avatar
      compiler/ghci/rts: remove stdcall support completely · 395412e8
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      We have formally dropped i386 windows support (#18487) a long time
      ago. The stdcall foreign call convention is only used by i386 windows,
      and the legacy logic around it is a significant maintenance burden for
      future work that adds arm64 windows support (#24603). Therefore, this
      patch removes stdcall support completely from the compiler as well as
      the RTS (#24883):
      
      - stdcall is still recognized as a FFI calling convention in Haskell
        syntax. GHC will now unconditionally emit a warning
        (-Wunsupported-calling-conventions) and treat it as ccall.
      - Apart from minimum logic to support the parsing and warning logic,
        all other code paths related to stdcall has been completely stripped
        from the compiler.
      - ghci only supports FFI_DEFAULT_ABI and ccall convention from now on.
      - FFI foreign export adjustor code on all platforms no longer handles
        the stdcall case and only handles ccall from now on.
      - The Win32 specific parts of RTS no longer has special code paths for
        stdcall.
      
      This commit is the final nail on the coffin for i386 windows support.
      Further commits will perform more housecleaning to strip the legacy
      code paths and pave way for future arm64 windows support.
      395412e8
    • David's avatar
      Implement Or Patterns (#22596) · 38757c30
      David authored and Marge Bot's avatar Marge Bot committed
      
      This commit introduces a new language extension, `-XOrPatterns`, as described in
      GHC Proposal 522.
      
      An or-pattern `pat1; ...; patk` succeeds iff one of the patterns `pat1`, ...,
      `patk` succeed, in this order.
      
      See also the summary `Note [Implmentation of OrPatterns]`.
      
      Co-Authored-By: default avatarSebastian Graf <sgraf1337@gmail.com>
      38757c30
    • Sebastian Graf's avatar
      Parser: Remove unused `apats` rule · 18f63970
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      18f63970
  2. Jun 03, 2024
    • Cheng Shao's avatar
      compiler: emit NaturallyAligned when element type & index type are the same width · 0cff083a
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This commit fixes a subtle mistake in alignmentFromTypes that used to
      generate Unaligned when element type & index type are the same width.
      Fixes #24930.
      0cff083a
    • Hannes Siebenhandl's avatar
      Migrate `Finder` component to `OsPath`, fixed #24616 · c8ece0df
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      For each module in a GHCi session, we keep alive one `ModLocation`.
      A `ModLocation` is fairly inefficiently packed, as `String`s are
      expensive in memory usage.
      
      While benchmarking the agda codebase, we concluded that we keep alive
      around 11MB of `FilePath`'s, solely retained by `ModLocation`.
      
      We provide a more densely packed encoding of `ModLocation`, by moving
      from `FilePath` to `OsPath`. Further, we migrate the full `Finder`
      component to `OsPath` to avoid unnecessary transformations.
      As the `Finder` component is well-encapsulated, this requires only a
      minimal amount of changes in other modules.
      
      We introduce pattern synonym for 'ModLocation' which maintains backwards
      compatibility and avoids breaking consumers of 'ModLocation'.
      c8ece0df
    • Cheng Shao's avatar
      testsuite: mark T7773 as fragile on wasm · ae50a8eb
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      ae50a8eb
    • Alex Mason's avatar
      Improve performance of genericWordQuotRem2Op (#22966) · 4998a6ed
      Alex Mason authored and Marge Bot's avatar Marge Bot committed
      Implements the algorithm from compiler-rt's udiv128by64to64default. This
      rewrite results in a roughly 24x improvement in runtime on AArch64 (and
      likely any other arch that uses it).
      4998a6ed
  3. Jun 02, 2024
  4. Jun 01, 2024
  5. May 31, 2024
  6. May 30, 2024
    • Jakob Brünker's avatar
      Add diagrams to Arrows documentation · 1bc66ee4
      Jakob Brünker authored and Marge Bot's avatar Marge Bot committed
      This adds diagrams to the documentation of Arrows, similar to the ones found on
      https://www.haskell.org/arrows/.
      
      It does not add diagrams for ArrowChoice for the time being, mainly because it's
      not clear to me how to visually distinguish them from the ones for Arrow. Ideally,
      you might want to do something like highlight the arrows belonging to the same
      tuple or same Either in common colors, but that's not really possible with unicode.
      1bc66ee4
    • Matthew Pickering's avatar
      ghcup-metadata: Fix metadata generation · 95ef2d58
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      There were some syntax errors in the generation script which were
      preventing it from running.
      
      I have tested this with:
      
      ```
      nix shell --extra-experimental-features nix-command -f .gitlab/rel_eng -c ghcup-metadata --metadata ghcup-0.0.7.yaml --date="2024-05-27" --pipeline-id=95534 --version=9.11.20240525
      ```
      
      which completed successfully.
      95ef2d58
    • Sylvain Henry's avatar
      JS: remove useless h$CLOCK_REALTIME (#23202) · 5ff83bfc
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      5ff83bfc
    • Cheng Shao's avatar
      rts: use __builtin_offsetof to implement STG_FIELD_OFFSET · 05c4fafb
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch fixes the STG_FIELD_OFFSET macro definition by using
      __builtin_offsetof, which is what gcc/clang uses to implement offsetof
      in standard C. The previous definition that uses NULL pointer involves
      subtle undefined behavior in C and thus reported by
      UndefinedBehaviorSanitizer as well:
      
      ```
      rts/Capability.h:243:58: runtime error: member access within null pointer of type 'Capability' (aka 'struct Capability_')
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Capability.h:243:58
      ```
      05c4fafb
    • Cheng Shao's avatar
      rts: fix an unaligned load in nonmoving gc · c77a48af
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch fixes an unaligned load in nonmoving gc by ensuring the
      closure address is properly untagged first before attempting to
      prefetch its header. The unaligned load is reported by
      UndefinedBehaviorSanitizer:
      
      ```
      rts/sm/NonMovingMark.c:921:9: runtime error: member access within misaligned address 0x0042005f3a71 for type 'StgClosure' (aka 'struct StgClosure_'), which requires 8 byte alignment
      0x0042005f3a71: note: pointer points here
       00 00 00  98 43 13 8e 12 7f 00 00  50 3c 5f 00 42 00 00 00  58 17 b7 92 12 7f 00 00  89 cb 5e 00 42
                    ^
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/NonMovingMark.c:921:9
      ```
      
      This issue had previously gone unnoticed since it didn't really harm
      runtime correctness, the invalid header address directly loaded from a
      tagged pointer is only used as prefetch address and will not cause
      segfaults. However, it still should be corrected because the prefetch
      would be rendered useless by this issue, and untagging only involves a
      single bitwise operation without memory access so it's cheap enough to
      add.
      c77a48af
    • Cheng Shao's avatar
      rts: ensure gc_thread/gen_workspace is allocated with proper alignment · 7a660042
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      gc_thread/gen_workspace are required to be aligned by 64 bytes.
      However, this property has not been properly enforced before, and
      numerous alignment violations at runtime has been caught by
      UndefinedBehaviorSanitizer that look like:
      
      ```
      rts/sm/GC.c:1167:8: runtime error: member access within misaligned address 0x0000027a3390 for type 'gc_thread' (aka 'struct gc_thread_'), which requires 64 byte alignment
      0x0000027a3390: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1167:8
      
      rts/sm/GC.c:1184:13: runtime error: member access within misaligned address 0x0000027a3450 for type 'gen_workspace' (aka 'struct gen_workspace_'), which requires 64 byte alignment
      0x0000027a3450: note: pointer points here
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1184:13
      ```
      
      This patch fixes the gc_thread/gen_workspace misalignment issue by
      explicitly allocating them with alignment constraint.
      7a660042
    • Cheng Shao's avatar
      testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x · e17f2df9
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      e17f2df9
Loading