Skip to content
Snippets Groups Projects
  1. Feb 06, 2025
    • Cheng Shao's avatar
      testsuite: rest of ghc-9.6 fixes for wasm · 38a93bc1
      Cheng Shao authored
      38a93bc1
    • Josh Meredith's avatar
      JS generated refs: update testsuite conditions · 021ff5c6
      Josh Meredith authored and Cheng Shao's avatar Cheng Shao committed
      (cherry picked from commit d69ecac2)
      021ff5c6
    • Cheng Shao's avatar
      testsuite: skip bkpfail tests that fail on wasm · 4382b1c1
      Cheng Shao authored
      (cherry picked from commit 1fad5bf1)
      4382b1c1
    • Cheng Shao's avatar
      testsuite: workaround mysterious framework error · 8c92f8c6
      Cheng Shao authored
      (cherry picked from commit 280c49af)
      8c92f8c6
    • Cheng Shao's avatar
      testsuite: bump T17572 timeout · 4fdff7d3
      Cheng Shao authored
      (cherry picked from commit 94673d41)
      (cherry picked from commit f13a2942)
      (cherry picked from commit 97551107)
      4fdff7d3
    • Cheng Shao's avatar
      testsuite: bump T17572 timeout on wasm32 · 7f072dfc
      Cheng Shao authored
      (cherry picked from commit 64fba310)
      (cherry picked from commit b35707a9)
      (cherry picked from commit ead1c3cc)
      7f072dfc
    • Cheng Shao's avatar
      testsuite: skip objc-hi/objcxx-hi when cross compiling · ab6990e6
      Cheng Shao authored
      objc-hi/objcxx-hi should be skipped when cross compiling. The existing
      opsys('darwin') predicate only asserts the host system is darwin but
      tells us nothing about the target, hence the oversight.
      
      (cherry picked from commit 595c0894)
      (cherry picked from commit 5273d3d0)
      (cherry picked from commit 6babf56f)
      ab6990e6
    • Cheng Shao's avatar
      testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x · bdc39308
      Cheng Shao authored
      (cherry picked from commit e17f2df9)
      (cherry picked from commit 9a2f3313)
      (cherry picked from commit 08acf27f)
      bdc39308
    • Cheng Shao's avatar
      testsuite: fix T17920 for wasm backend · e8623449
      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)
      (cherry picked from commit c4060ce3)
      (cherry picked from commit b64e0f63)
      e8623449
    • Cheng Shao's avatar
      testsuite: bump PartialDownSweep timeout to 5x on wasm32 · afabf77c
      Cheng Shao authored
      (cherry picked from commit b1e0c313)
      (cherry picked from commit 34882192)
      (cherry picked from commit 94adf918)
      afabf77c
    • Cheng Shao's avatar
      utils: remove unused lndir from tree · fd781247
      Cheng Shao authored
      Ever since the removal of the make build system, the in tree lndir
      hasn't been actually built, so this patch removes it.
      
      (cherry picked from commit d3a050d2)
      (cherry picked from commit 04860c24)
      fd781247
    • Cheng Shao's avatar
      testsuite: fix hs_try_putmvar002 for targets without pthread.h · bdd297f9
      Cheng Shao authored
      hs_try_putmvar002 includes pthread.h and doesn't work on targets
      without this header (e.g. wasm32). It doesn't need to include this
      header at all. This was previously unnoticed by wasm CI, though recent
      toolchain upgrade brought in upstream changes that completely removes
      pthread.h in the single-threaded wasm32-wasi sysroot, therefore we
      need to handle that change.
      
      (cherry picked from commit 2ce2a493)
      (cherry picked from commit f581edb0)
      bdd297f9
    • Cheng Shao's avatar
      base: treat all FDs as "nonblocking" on wasm · a1a37769
      Cheng Shao authored
      On posix platforms, when performing read/write on FDs, we check the
      nonblocking flag first. For FDs without this flag (e.g. stdout), we
      call fdReady() first, which in turn calls poll() to wait for I/O to be
      available on that FD. This is problematic for wasm32-wasi: although
      select()/poll() is supported via the poll_oneoff() wasi syscall, that
      syscall is rather heavyweight and runtime behavior differs in
      different wasi implementations. The issue is even worse when targeting
      browsers, given there's no satisfactory way to implement async I/O as
      a synchronous syscall, so existing JS polyfills for wasi often give up
      and simply return ENOSYS.
      
      Before we have a proper I/O manager that avoids poll_oneoff() for
      async I/O on wasm, this patch improves the status quo a lot by merely
      pretending all FDs are "nonblocking". Read/write on FDs will directly
      invoke read()/write(), which are much more reliably handled in
      existing wasi implementations, especially those in browsers.
      
      Fixes #23275 and the following test cases: T7773 isEOF001 openFile009
      T4808 cgrun025
      
      Approved by CLC proposal #234:
      https://github.com/haskell/core-libraries-committee/issues/234
      
      (cherry picked from commit 2eca52b4)
      (cherry picked from commit 288692dd)
      a1a37769
    • Cheng Shao's avatar
      testsuite: fix optasm tests for wasm32 · f3306bca
      Cheng Shao authored
      (cherry picked from commit af771148)
      (cherry picked from commit 84c875d1)
      f3306bca
    • Cheng Shao's avatar
      rts: enable wasm32 register mapping · 8d64ea3d
      Cheng Shao authored
      The wasm backend didn't properly make use of all Cmm global registers
      due to #24347. Now that it is fixed, this patch re-enables full
      register mapping for wasm32, and we can now generate smaller & faster
      wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152.
      
      (cherry picked from commit 0cda2b8b)
      (cherry picked from commit f1f5068b398b1effb837add38ecc5303dc9a381f)
      (cherry picked from commit 1e695750)
      8d64ea3d
    • Cheng Shao's avatar
      testsuite: increase timeout of ghc-api tests for wasm32 · 18fb2b57
      Cheng Shao authored
      ghc-api tests for wasm32 are more likely to timeout due to the large
      wasm module sizes, especially when testing with wasm native tail
      calls, given wasmtime's handling of tail call opcodes are suboptimal
      at the moment. It makes sense to increase timeout specifically for
      these tests on wasm32. This doesn't affect other targets, and for
      wasm32 we don't increase timeout for all tests, so not to risk letting
      major performance regressions slip through the testsuite.
      
      (cherry picked from commit 07ab5cc1)
      (cherry picked from commit c4d1edb1)
      18fb2b57
    • Cheng Shao's avatar
      testsuite: wasm32-specific fixes · 4459f436
      Cheng Shao authored
      This patch includes all wasm32-specific testsuite fixes.
      
      (cherry picked from commit bd2bfdec)
      4459f436
    • Sylvain Henry's avatar
      Testsuite: replace some js_skip with req_cmm · b258f833
      Sylvain Henry authored and Cheng Shao's avatar Cheng Shao committed
      req_cmm is more informative than js_skip
      
      (cherry picked from commit 239202a2)
      b258f833
    • Cheng Shao's avatar
      testsuite: add missing annotations for some tests · 1895bd86
      Cheng Shao authored
      This patch adds missing annotations (req_th, req_dynamic_lib_support,
      req_rts_linker) to some tests. They were discovered when testing
      wasm32, though it's better to be explicit about what features they
      require, rather than simply adding when(arch('wasm32'), skip).
      
      (cherry picked from commit b174a110)
      1895bd86
    • Cheng Shao's avatar
      testsuite: add the req_host_target_ghc predicate · 04e90733
      Cheng Shao authored
      This patch adds the req_host_target_ghc predicate to the testsuite to
      assert the ghc compiler being tested can compile both host/target
      code. When testing cross GHCs this is not supported yet, but it may
      change in the future.
      
      (cherry picked from commit cb933665)
      04e90733
    • Cheng Shao's avatar
      testsuite: add the req_ghc_with_threaded_rts predicate · ad9838c8
      Cheng Shao authored
      This patch adds the req_ghc_with_threaded_rts predicate to the
      testsuite to assert the platform has threaded RTS, and mark some tests
      as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a
      config field instead of a global variable.
      
      (cherry picked from commit aa6afe8a)
      ad9838c8
    • Sylvain Henry's avatar
      testsuite: req_smp --> req_target_smp, req_ghc_smp · 73528452
      Sylvain Henry authored and Cheng Shao's avatar Cheng Shao committed
      See #22630 and !9552
      
      This commit:
       - splits req_smp into req_target_smp and req_ghc_smp
       - changes the testsuite driver to calculate req_ghc_smp
       - changes a handful of tests to use req_target_smp instead of req_smp
       - changes a handful of tests to use req_host_smp when needed
      
      The problem:
       - the problem this solves is the ambiguity surrounding req_smp
       - on master req_smp was used to express the constraint that the program
       being compiled supports smp _and_ that the host RTS (i.e., the RTS used
       to compile the program) supported smp. Normally that is fine, but in
       cross compilation this is not always the case as was discovered in #22630.
      
      The solution:
       - Differentiate the two constraints:
         - use req_target_smp to say the RTS the compiled program is linked
         with (and the platform) supports smp
         - use req_host_smp to say the RTS the host is linked with supports smp
      
      WIP: fix req_smp (target vs ghc)
      
      add flag to separate bootstrapper
      
      split req_smp -> req_target_smp and req_ghc_smp
      
      update tests smp flags
      
      cleanup and add some docstrings
      
      only set ghc_with_smp to bootstrapper on S1 or CC
      
      Only set ghc_with_smp to bootstrapperWithSMP of when testing stage 1
      and cross compiling
      
      test the RTS in config/ghc not hadrian
      
      re-add ghc_with_smp
      
      fix and align req names
      
      fix T11760 to use req_host_smp
      
      test the rts directly, avoid python 3.5 limitation
      
      test the compiler in a try block
      
      align out of tree and in tree withSMP flags
      
      mark failing tests as host req smp
      
      testsuite: req_host_smp --> req_ghc_smp
      
      Fix ghc vs host, fix ghc_with_smp leftover
      
      (cherry picked from commit 06036d93)
      73528452
  2. Jan 20, 2025
  3. Jan 16, 2025
    • Luite Stegeman's avatar
      Add flags for switching off speculative evaluation. · b44c46a2
      Luite Stegeman authored
      We found that speculative evaluation can increase the amount of
      allocations in some circumstances. This patch adds new flags for
      selectively disabling speculative evaluation, allowing us to
      test the effect of the optimization.
      
      The new flags are:
      
        -fspec-eval
           globally enable speculative evaluation
      
        -fspec-eval-dictfun
           enable speculative evaluation for dictionary functions (no effect
           if speculative evaluation is globally disabled)
      
      The new flags are on by default for all optimisation levels.
      
      See #25284
      
      (cherry picked from commit 23099752)
      b44c46a2
    • ARATA Mizuki's avatar
      Fix LLVM version detection · 9f9a3b26
      ARATA Mizuki authored and Luite Stegeman's avatar Luite Stegeman committed
      With a recent LLVM, `llc -version` emits the version on the first line
      if the vendor is set.  It emits the version on the second line
      otherwise.
      
      Therefore, we need to check the both lines to detect the version.
      
      GHC now emits a warning if it fails to detect the LLVM version,
      so we can notice if the output of `llc -version` changes in the future.
      
      Also, the warning for using LLVM < 10 on s390x is removed, because
      we assume LLVM >= 13 now.
      
      This fixes the definition of __GLASGOW_HASKELL_LLVM__ macro.
      
      Fixes #25606
      
      (cherry picked from commit a928c326)
      9f9a3b26
    • Jaro Reinders's avatar
      Refactor Unique to be represented by Word64 · 0c16eef4
      Jaro Reinders authored and Luite Stegeman's avatar Luite Stegeman committed
      In #22010 we established that Int was not always sufficient to store all
      the uniques we generate during compilation on 32-bit platforms. This
      commit addresses that problem by using Word64 instead of Int for
      uniques.
      
      The core of the change is in GHC.Core.Types.Unique and
      GHC.Core.Types.Unique.Supply. However, the representation of uniques is
      used in many other places, so those needed changes too. Additionally, the RTS
      has been extended with an atomic_inc64 operation.
      
      One major change from this commit is the introduction of the Word64Set and
      Word64Map data types. These are adapted versions of IntSet and IntMap
      from the containers package. These are planned to be upstreamed in the
      future.
      
      As a natural consequence of these changes, the compiler will be a bit
      slower and take more space on 32-bit platforms. Our CI tests indicate
      around a 5% residency increase.
      
      Metric Increase:
          CoOpt_Read
          CoOpt_Singletons
          LargeRecord
          ManyAlternatives
          ManyConstructors
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModulesTH_OneShot
          RecordUpdPerf
          T10421
          T10547
          T12150
          T12227
          T12234
          T12425
          T12707
          T13035
          T13056
          T13253
          T13253-spj
          T13379
          T13386
          T13719
          T14683
          T14697
          T14766
          T15164
          T15703
          T16577
          T16875
          T17516
          T18140
          T18223
          T18282
          T18304
          T18698a
          T18698b
          T18923
          T1969
          T19695
          T20049
          T21839c
          T3064
          T3294
          T4801
          T5030
          T5321FD
          T5321Fun
          T5631
          T5642
          T5837
          T6048
          T783
          T8095
          T9020
          T9198
          T9233
          T9630
          T9675
          T9872a
          T9872b
          T9872b_defer
          T9872c
          T9872d
          T9961
          TcPlugin_RewritePerf
          UniqLoop
          WWRec
          hard_hole_fits
          MultiLayerModulesTH_Make
          T21839r
          mhu-perf
      
      Metric Decrease:
          MultiLayerModulesTH_Make
      
      (cherry picked from commit 9edcb1fb)
      0c16eef4
    • Ben Gamari's avatar
      testsuite: Add test for #25560 · e03165b2
      Ben Gamari authored and Luite Stegeman's avatar Luite Stegeman committed
      (cherry picked from commit 683115a4)
      e03165b2
    • Sebastian Graf's avatar
      DmdAnal: Make `prompt#` lazy (#25439) · 69020c2a
      Sebastian Graf authored and Luite Stegeman's avatar Luite Stegeman committed
      This applies the same treatment to `prompt#` as for `catch#`.
      See `Note [Strictness for mask/unmask/catch/prompt]`.
      
      Fixes #25439.
      
      (cherry picked from commit 00d58ae1)
      69020c2a
    • Simon Peyton Jones's avatar
      Consider Wanteds with rewriters as insoluble · cfc9f465
      Simon Peyton Jones authored and Luite Stegeman's avatar Luite Stegeman committed
      This MR fixes #25325
      
      See GHC.Tc.Types.Constraint, Note [Insoluble Wanteds], especially (IW2)
      
      There is a small change in the error message for T14172, but it looks
      entirely acceptable to me.
      
      (cherry picked from commit 083703a1)
      cfc9f465
    • Sylvain Henry's avatar
      Fix interaction between fork and kqueue (#24672) · 9177b8ed
      Sylvain Henry authored and Luite Stegeman's avatar Luite Stegeman committed
      A kqueue file descriptor isn't inherited by a child created with fork.
      As such we mustn't try to close this file descriptor as we would close a
      random one, e.g. the one used by timerfd.
      
      Fix #24672
      
      (cherry picked from commit e7a26d7a)
      9177b8ed
    • Matthew Pickering's avatar
      driver: Fix -working-dir for foreign files · cb95a3ca
      Matthew Pickering authored and Luite Stegeman's avatar Luite Stegeman committed
      -working-dir definitely needs more serious testing, there are some easy
      ways to test this.
      
      * Modify Cabal to call ghc using -working-dir rather than changing
        directory.
      * Modify the testsuite to run ghc using `-working-dir` rather than
        running GHC with cwd = temporary directory.
      
      However this will have to wait until after 9.12.
      
      Fixes #25150
      
      (cherry picked from commit c20d5186)
      cb95a3ca
    • Sylvain Henry's avatar
      JS: support rubbish static literals (#25177) · cb2cccf8
      Sylvain Henry authored and Luite Stegeman's avatar Luite Stegeman committed
      Support for rubbish dynamic literals was added in #24664. This patch
      does the same for static literals.
      
      Fix #25177
      
      (cherry picked from commit 5092dbff)
      cb2cccf8
    • Sylvain Henry's avatar
      AARCH64 linker: skip NONE relocations · 70410779
      Sylvain Henry authored and Luite Stegeman's avatar Luite Stegeman committed
      This patch is part of the patches upstreamed from haskell.nix.
      See https://github.com/input-output-hk/haskell.nix/pull/1960 for the
      original report/patch.
      
      (cherry picked from commit c749bdfd)
      70410779
    • Sylvain Henry's avatar
      Cmm: don't perform unsound optimizations on 32-bit compiler hosts · f2bb55d8
      Sylvain Henry authored and Luite Stegeman's avatar Luite Stegeman committed
      
      - beef6135 enabled the use of
        MO_Add/MO_Sub for 64-bit operations in the C and LLVM backends
      - 6755d833 did the same for the x86 NCG
        backend
      
      However we store some literal values as `Int` in the compiler. As a
      result, some Cmm optimizations transformed target 64-bit literals into
      compiler `Int`. If the compiler is 32-bit, this leads to computing with
      wrong literals (see #24893 and #24700).
      
      This patch disables these Cmm optimizations for 32-bit compilers. This
      is unsatisfying (optimizations shouldn't be compiler-word-size
      dependent) but it fixes the bug and it makes the patch easy to backport.
      A proper fix would be much more invasive but it shall be implemented in
      the future.
      
      Co-authored-by: default avataramesgen <amesgen@amesgen.de>
      (cherry picked from commit 7446a09a)
      f2bb55d8
    • Matthew Pickering's avatar
      driver: Fix -Wmissing-home-modules when multiple units have the same module name · dab9025d
      Matthew Pickering authored and Luite Stegeman's avatar Luite Stegeman committed
      It was assumed that module names were unique but that isn't true with
      multiple units.
      
      The fix is quite simple, maintain a set of `(ModuleName, UnitId)` and
      query that to see whether the module has been specified.
      
      Fixes #25122
      
      (cherry picked from commit 951ce3d5)
      dab9025d
    • Simon Peyton Jones's avatar
      Address #25055, by disabling case-of-runRW# in Gentle phase · 4c304809
      Simon Peyton Jones authored and Luite Stegeman's avatar Luite Stegeman committed
      See Note [Case-of-case and full laziness]
      in GHC.Driver.Config.Core.Opt.Simplify
      
      (cherry picked from commit de5d9852)
      4c304809
    • Andreas Klebinger's avatar
      Fix -freg-graphs for FP and AARch64 NCG (#24941). · ff24528f
      Andreas Klebinger authored and Luite Stegeman's avatar Luite Stegeman committed
      It seems we reserve 8 registers instead of four for global regs
      based on the layout in Note [AArch64 Register assignments].
      
      I'm not sure it's neccesary, but for now we just accept this state of
      affairs and simple update -fregs-graph to account for this.
      
      (cherry picked from commit 3f89ab92)
      ff24528f
    • Peter Trommler's avatar
      X86 NCG: Fix argument promotion in foreign C calls · e6ba4f69
      Peter Trommler authored and Luite Stegeman's avatar Luite Stegeman committed
      Promote 8 bit and 16 bit signed arguments by sign extension.
      
      Fixes #25018
      
      (cherry picked from commit a82121b3)
      e6ba4f69
    • Zubin's avatar
      compiler: Fingerprint -fwrite-if-simplified-core · 3ccef3dd
      Zubin authored and Luite Stegeman's avatar Luite Stegeman committed
      We need to recompile if this flag is changed because later modules might depend on the
      simplified core for this module if -fprefer-bytecode is enabled.
      
      Fixes #24656
      
      (cherry picked from commit dddc9dff)
      3ccef3dd
Loading