[Git][ghc/ghc][master] 2 commits: ci: bump ci-images for updated wasm image

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Jan 18 10:21:46 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
320454d3 by Cheng Shao at 2024-01-17T23:02:40+00:00
ci: bump ci-images for updated wasm image

- - - - -
2eca52b4 by Cheng Shao at 2024-01-17T23:06:44+00:00
base: treat all FDs as "nonblocking" on wasm

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

- - - - -


6 changed files:

- .gitlab-ci.yml
- libraries/base/cbits/inputReady.c
- libraries/base/changelog.md
- libraries/base/tests/IO/all.T
- libraries/base/tests/all.T
- testsuite/tests/codeGen/should_run/all.T


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -2,7 +2,7 @@ variables:
   GIT_SSL_NO_VERIFY: "1"
 
   # Commit of ghc/ci-images repository from which to pull Docker images
-  DOCKER_REV: cf2ba8e205bd41ac36f39e1a12b4727f899ded75
+  DOCKER_REV: f8658053d14911d73b1e32f5b6d13fb7b1c8a5ee
 
   # Sequential version number of all cached things.
   # Bump to invalidate GitLab CI cache.


=====================================
libraries/base/cbits/inputReady.c
=====================================
@@ -153,6 +153,9 @@ compute_WaitForSingleObject_timeout(bool infinite, Time remaining)
 int
 fdReady(int fd, bool write, int64_t msecs, bool isSock)
 {
+#if defined(wasm32_HOST_ARCH)
+    return 1;
+#else
     bool infinite = msecs < 0;
 
     // if we need to track the time then record the end time in case we are
@@ -477,4 +480,5 @@ fdReady(int fd, bool write, int64_t msecs, bool isSock)
         }
     }
 #endif
+#endif // wasm32_HOST_ARCH
 }


=====================================
libraries/base/changelog.md
=====================================
@@ -35,6 +35,8 @@
 
   * Add more instances for `Compose`: `Fractional`, `RealFrac`, `Floating`, `RealFloat` ([CLC proposal #226](https://github.com/haskell/core-libraries-committee/issues/226))
 
+  * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234))
+
 ## 4.19.0.0 *October 2023*
   * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`.
     Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it.


=====================================
libraries/base/tests/IO/all.T
=====================================
@@ -63,7 +63,7 @@ test('hSetBuffering004', set_stdin('hSetBuffering004.hs'), compile_and_run, ['']
 test('ioeGetErrorString001', normal, compile_and_run, ['-cpp'])
 test('ioeGetFileName001',    normal, compile_and_run, ['-cpp'])
 test('ioeGetHandle001',      normal, compile_and_run, ['-cpp'])
-test('isEOF001', [extra_run_opts('</dev/null'), when(arch('wasm32'), fragile(23275))], compile_and_run, [''])
+test('isEOF001', [extra_run_opts('</dev/null')], compile_and_run, [''])
 
 test('misc001', [extra_run_opts('misc001.hs misc001.out')], compile_and_run,
      [''])
@@ -76,7 +76,7 @@ test('openFile005', js_broken(22261), compile_and_run, [''])
 test('openFile006', [], compile_and_run, [''])
 test('openFile007', js_broken(22261), compile_and_run, [''])
 test('openFile008', [cmd_prefix('ulimit -n 1024; ')], compile_and_run, [''])
-test('openFile009', [when(arch('wasm32'), fragile(23284))], compile_and_run, [''])
+test('openFile009', [], compile_and_run, [''])
 
 test('putStr001',    normal, compile_and_run, [''])
 test('readFile001', js_broken(22261), compile_and_run, [''])
@@ -155,7 +155,6 @@ test('encodingerror001', normal, compile_and_run, [''])
 
 # Requires use of the FD interface which is not supported under WINIO
 test('T4808', [when(opsys('mingw32'), skip)
-              , when(arch('wasm32'), fragile(23284))
               ,fragile_for(16909, concurrent_ways), exit_code(1)]
               , compile_and_run, [''])
 test('T4895', normal, compile_and_run, [''])


=====================================
libraries/base/tests/all.T
=====================================
@@ -175,9 +175,8 @@ test('T7457', normal, compile_and_run, [''])
 test('T7773',
      [when(opsys('mingw32'), skip),
       js_broken(22261),
-      expect_broken_for(23272, ['ghci-opt']), # unclear
-      when(arch('wasm32'),
-      fragile(23275))],
+      expect_broken_for(23272, ['ghci-opt']) # unclear
+     ],
      compile_and_run,
      [''])
 # Andreas says that T7773 will not (and should not) work on Windows


=====================================
testsuite/tests/codeGen/should_run/all.T
=====================================
@@ -29,7 +29,7 @@ test('cgrun021', extra_ways(['nursery_chunks']), compile_and_run, [''])
 test('cgrun022', normal, compile_and_run, [''])
 test('cgrun024', normal, compile_and_run, [''])
 test('cgrun025',
-     [ omit_ghci, extra_run_opts('cgrun025.hs < /dev/null'), exit_code(1), when(arch('wasm32'), fragile(23275))],
+     [ omit_ghci, extra_run_opts('cgrun025.hs < /dev/null'), exit_code(1) ],
      compile_and_run, [''])
 test('cgrun026', normal, compile_and_run, [''])
 test('cgrun027', normal, compile_and_run, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7f0879e1c413845369b1f465a399b6f0838e9c52...2eca52b4a4c14f74a5269b7eb4643fca638d1fbe

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7f0879e1c413845369b1f465a399b6f0838e9c52...2eca52b4a4c14f74a5269b7eb4643fca638d1fbe
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240118/73b0d70e/attachment-0001.html>


More information about the ghc-commits mailing list