Skip to content
Snippets Groups Projects
  1. Oct 18, 2024
    • Cheng Shao's avatar
      compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs · 2b2a3db8
      Cheng Shao authored
      This patch makes the STG->Cmm backend avoid saving foreign call target
      to local when there are no caller-save GlobalRegs.
      
      Since 321941a8, when we lower a
      foreign call, we unconditionally save the foreign call target to a
      temporary local first, then rely on cmmSink to clean it up later,
      which only happens with -fcmm-sink (implied by -O) and not in
      unoptimized code.
      
      And this is troublesome for the wasm backend NCG, which needs to infer
      a foreign call target symbol's type signature from the Cmm call site.
      Previously, the NCG has been emitting incorrect type signatures for
      unoptimized code, which happens to work with `wasm-ld` most of the
      time, but this is never future-proof against upstream toolchain
      updates, and it causes horrible breakages when LTO objects are
      included in linker input. Hence this patch.
      
      (cherry picked from commit 8dd8a076)
      2b2a3db8
    • Cheng Shao's avatar
      testsuite: don't attempt to detect host cpu features when testing cross ghc · 07641012
      Cheng Shao authored
      The testsuite driver CPU feature detection logic only detects host CPU
      and only makes sense when we are not testing a cross GHC.
      
      (cherry picked from commit c4c6d714)
      07641012
    • Cheng Shao's avatar
      testsuite: bump T22744 timeout to 5x · f21a1e56
      Cheng Shao authored
      (cherry picked from commit c739383b)
      f21a1e56
    • Cheng Shao's avatar
      testsuite: fix T17920 for wasm backend · c4060ce3
      Cheng Shao authored
      T17920 was marked as fragile on wasm before; it can be trivially fixed
      by avoiding calling variadic printf() in cmm.
      
      (cherry picked from commit 7b4c1998)
      c4060ce3
    • Cheng Shao's avatar
      autoconf: remove unused context diff check · 0e9d2a0f
      Cheng Shao authored
      This patch removes redundant autoconf check for the context diff
      program given it isn't actually been used anywhere, especially since
      make removal.
      
      (cherry picked from commit b7bcf729)
      0e9d2a0f
    • Cheng Shao's avatar
      rts: fix I/O manager compilation errors for win32 target · 9499ed96
      Cheng Shao authored
      This patch fixes I/O manager compilation errors for win32 target
      discovered when cross-compiling to win32 using recent clang:
      
      ```
      rts/win32/ThrIOManager.c:117:7: error:
           error: call to undeclared function 'is_io_mng_native_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            117 |   if (is_io_mng_native_p ()) {
                |       ^
          |
      117 |   if (is_io_mng_native_p ()) {
          |       ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/fs.c:143:28: error:
           error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
            143 | int setErrNoFromWin32Error () {
                |                            ^
                |                             void
          |
      143 | int setErrNoFromWin32Error () {
          |                            ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/win32/ConsoleHandler.c:227:9: error:
           error: call to undeclared function 'interruptIOManagerEvent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            227 |         interruptIOManagerEvent ();
                |         ^
          |
      227 |         interruptIOManagerEvent ();
          |         ^
      
      rts/win32/ConsoleHandler.c:227:9: error:
           note: did you mean 'getIOManagerEvent'?
          |
      227 |         interruptIOManagerEvent ();
          |         ^
      
      rts/include/rts/IOInterface.h:27:10: error:
           note: 'getIOManagerEvent' declared here
             27 | void *   getIOManagerEvent  (void);
                |          ^
         |
      27 | void *   getIOManagerEvent  (void);
         |          ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      
      rts/win32/ConsoleHandler.c:196:9: error:
           error: call to undeclared function 'setThreadLabel'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            196 |         setThreadLabel(cap, t, "signal handler thread");
                |         ^
          |
      196 |         setThreadLabel(cap, t, "signal handler thread");
          |         ^
      
      rts/win32/ConsoleHandler.c:196:9: error:
           note: did you mean 'postThreadLabel'?
          |
      196 |         setThreadLabel(cap, t, "signal handler thread");
          |         ^
      
      rts/eventlog/EventLog.h:118:6: error:
           note: 'postThreadLabel' declared here
            118 | void postThreadLabel(Capability    *cap,
                |      ^
          |
      118 | void postThreadLabel(Capability    *cap,
          |      ^
      
      1 error generated.
      `x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
      ```
      
      (cherry picked from commit 710665bd)
      9499ed96
    • Cheng Shao's avatar
      rts: do not prefetch mark_closure bdescr in non-moving gc when ASSERTS_ENABLED · 6997f0b8
      Cheng Shao authored
      This commit fixes a small an oversight in !12148: the prefetch logic
      in non-moving GC may trap in debug RTS because it calls Bdescr() for
      mark_closure which may be a static one. It's fine in non-debug RTS
      because even invalid bdescr addresses are prefetched, they will not
      cause segfaults, so this commit implements the most straightforward
      fix: don't prefetch mark_closure bdescr when assertions are enabled.
      
      (cherry picked from commit 886ab43a)
      6997f0b8
    • Cheng Shao's avatar
      testsuite: bump PartialDownSweep timeout to 5x on wasm32 · 34882192
      Cheng Shao authored
      (cherry picked from commit b1e0c313)
      34882192
    • Cheng Shao's avatar
      linters: fix lint-whitespace compilation with ghc-9.10.1 · b7965ff0
      Cheng Shao authored
      (cherry picked from commit ad38e954)
      b7965ff0
    • Cheng Shao's avatar
      hadrian: fix hadrian building with ghc-9.10.1 · d72f2e78
      Cheng Shao authored
      (cherry picked from commit be514bb4)
      d72f2e78
    • Cheng Shao's avatar
      ghc-heap: fix typo in ghc-heap cbits · 6a4eb3c6
      Cheng Shao authored
      (cherry picked from commit 2b1af08b)
      6a4eb3c6
    • Cheng Shao's avatar
      testsuite: fix testwsdeque with recent clang · 6d1ee58c
      Cheng Shao authored
      This patch fixes compilation of testwsdeque.c with recent versions of
      clang, which will fail with the error below:
      
      ```
      testwsdeque.c:95:33: error:
           warning: format specifies type 'long' but the argument has type 'void *' [-Wformat]
             95 |         barf("FAIL: %ld %d %d", p, n, val);
                |                     ~~~         ^
      
      testwsdeque.c:95:39: error:
           warning: format specifies type 'int' but the argument has type 'StgWord' (aka 'unsigned long') [-Wformat]
             95 |         barf("FAIL: %ld %d %d", p, n, val);
                |                            ~~         ^~~
                |                            %lu
      
      testwsdeque.c:133:42: error:
           error: incompatible function pointer types passing 'void (void *)' to parameter of type 'OSThreadProc *' (aka 'void *(*)(void *)') [-Wincompatible-function-pointer-types]
            133 |         createOSThread(&ids[n], "thief", thief, (void*)(StgWord)n);
                |                                          ^~~~~
      
      /workspace/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-9.11.20240502/rts-1.0.2/include/rts/OSThreads.h:193:51: error:
           note: passing argument to parameter 'startProc' here
            193 |                                     OSThreadProc *startProc, void *param);
                |                                                   ^
      
      2 warnings and 1 error generated.
      ```
      
      (cherry picked from commit a9979f55)
      6d1ee58c
    • Cheng Shao's avatar
      wasm: use scheduler.postTask() for context switch when available · 7389efbd
      Cheng Shao authored
      This patch makes use of scheduler.postTask() for JSFFI context switch
      when it's available. It's a more principled approach than our
      MessageChannel based setImmediate() implementation, and it's available
      in latest version of Chromium based browsers.
      
      (cherry picked from commit 43d48b44)
      7389efbd
    • Cheng Shao's avatar
      testsuite: fix req_target_smp predicate · 4f317bfd
      Cheng Shao authored
      (cherry picked from commit a580722e)
      4f317bfd
    • Ben Gamari's avatar
      Bump time submodule to 1.14 · 94144ebb
      Ben Gamari authored and Cheng Shao's avatar Cheng Shao committed
      As requested in #24528.
      
      -------------------------
      Metric Decrease:
          ghc_bignum_so
          rts_so
      Metric Increase:
          cabal_syntax_dir
          rts_so
          time_dir
          time_so
      -------------------------
      
      (cherry picked from commit 1dacb506)
      94144ebb
    • Sylvain Henry's avatar
      Fix TH dependencies (#22229) · 1979af97
      Sylvain Henry authored and Cheng Shao's avatar Cheng Shao committed
      Add a dependency between Syntax and Internal (via module reexport).
      
      (cherry picked from commit 4d78c53c)
      1979af97
    • Teo Camarasu's avatar
      Remove unecessary stage0 packages · 3c22f5be
      Teo Camarasu authored and Cheng Shao's avatar Cheng Shao committed
      Historically quite a few packages had to be stage0 as they depended on
      `template-haskell` and that was stage0. In #23536 we made it so that was
      no longer the case. This allows us to remove a bunch of packages from
      this list.
      
      A few still remain. A new version of `Win32` is required by
      `semaphore-compat`. Including `Win32` in the stage0 set requires also
      including `filepath` because otherwise Hadrian's dependency logic gets
      confused. Once our boot compiler has a newer version of `Win32` all of
      these will be able to be dropped.
      
      Resolves #24652
      
      (cherry picked from commit dd339c7a)
      3c22f5be
    • Teo Camarasu's avatar
      Make template-haskell a stage1 package · f3ce383c
      Teo Camarasu authored and Cheng Shao's avatar Cheng Shao committed
      
      Promoting template-haskell from a stage0 to a stage1 package means that
      we can much more easily refactor template-haskell.
      
      We implement this by duplicating the in-tree `template-haskell`.
      A new `template-haskell-next` library is autogenerated to mirror `template-haskell`
      `stage1:ghc` to depend on the new interface of the library including the
      `Binary` instances without adding an explicit dependency on `template-haskell`.
      
      This is controlled by the `bootstrap-th` cabal flag
      
      When building `template-haskell` modules as part of this vendoring we do
      not have access to quote syntax, so we cannot use variable quote
      notation (`'Just`). So we either replace these with hand-written `Name`s
      or hide the code behind CPP.
      
      We can remove the `th_hack` from hadrian, which was required when
      building stage0 packages using the in-tree `template-haskell` library.
      
      For more details see Note [Bootstrapping Template Haskell].
      
      Resolves #23536
      
      Co-Authored-By: default avatarSebastian Graf <sgraf1337@gmail.com>
      Co-Authored-By: default avatarMatthew Craven <5086-clyring@users.noreply.gitlab.haskell.org>
      (cherry picked from commit 42bd0407)
      f3ce383c
    • Cheng Shao's avatar
      Revert "hadrian: Refactor treatment of extra dependencies" · 39bc9621
      Cheng Shao authored
      This reverts commit 3a18d9e7.
      39bc9621
  2. May 31, 2024
  3. May 30, 2024
  4. May 29, 2024
  5. May 28, 2024
  6. May 23, 2024
  7. May 13, 2024
  8. May 10, 2024
  9. May 09, 2024
    • Ben Gamari's avatar
      Bump version to 9.10.1 · 017c52b7
      Ben Gamari authored
      017c52b7
    • Andrei Borzenkov's avatar
      Fix tuple puns renaming (24702) · 2cc6968a
      Andrei Borzenkov authored and Ben Gamari's avatar Ben Gamari committed
      Move tuple renaming short cutter from `isBuiltInOcc_maybe` to `isPunOcc_maybe`, so we consider incoming module.
      
      I also fixed some hidden bugs that raised after the change was done.
      
      (cherry picked from commit 94da9365)
      2cc6968a
    • Ryan Scott's avatar
      unboxedSum{Type,Data}Name: Use GHC.Types as the module · 78092043
      Ryan Scott authored
      Unboxed sum constructors are now defined in the `GHC.Types` module, so if you
      manually quote an unboxed sum (e.g., `''Sum2#`), you will get a `Name` like:
      
      ```hs
      GHC.Types.Sum2#
      ```
      
      The `unboxedSumTypeName` function in `template-haskell`, however, mistakenly
      believes that unboxed sum constructors are defined in `GHC.Prim`, so
      `unboxedSumTypeName 2` would return an entirely different `Name`:
      
      ```hs
      GHC.Prim.(#|#)
      ```
      
      This is a problem for Template Haskell users, as it means that they can't be
      sure which `Name` is the correct one. (Similarly for `unboxedSumDataName`.)
      
      This patch fixes the implementations of `unboxedSum{Type,Data}Name` to use
      `GHC.Types` as the module. For consistency with `unboxedTupleTypeName`, the
      `unboxedSumTypeName` function now uses the non-punned syntax for unboxed sums
      (`Sum<N>#`) as the `OccName`.
      
      Fixes #24750.
      78092043
    • Ben Gamari's avatar
      ghcup-metadata: Drop output_name · 923e21bc
      Ben Gamari authored
      This is entirely redundant to the filename of the URL. There is no
      compelling reason to name the downloaded file differently from its
      source.
      923e21bc
    • Ben Gamari's avatar
      Revert "ghcup-metadata: Drop output_name field" · c192d254
      Ben Gamari authored
      This reverts commit 250c5df7.
      c192d254
  10. May 08, 2024
Loading