Skip to content
  • Cheng Shao's avatar
    81aba64d
    ghci: use improved Pipe logic for wasm iserv · 81aba64d
    Cheng Shao authored
    This commit makes wasm iserv take advantage of the Pipe refactoring by
    passing binary receiver/sender js callbacks from the dyld script. This
    paves the way for piping the binary messages through WebSockets in
    order to run wasm iserv in the browser, but more importantly, it
    allows us to get rid of a horrible hack in the dyld script: we no
    longer have to fake magical wasi file descriptors that are backed by
    nodejs blocking I/O! The legacy hack was due to these facts:
    
    - iserv only supported exchanging binary messages via handles backed
      by file descriptors
    - In wasi you can't access host file descriptors passed by host ghc
    - The nodejs wasi implementation only allows mapping host directories
      into the wasi vfs, not host file descriptors
    - Named pipes with file paths (mkfifo) doesn't work well with nodejs
      wasi implementation, causes spurious testsuite failures on macos
    
    But starting from this point, we can fully take advantage of
    non-blocking I/O on the js side.
    
    (cherry picked from commit a2103fd2)
    81aba64d
    ghci: use improved Pipe logic for wasm iserv
    Cheng Shao authored
    This commit makes wasm iserv take advantage of the Pipe refactoring by
    passing binary receiver/sender js callbacks from the dyld script. This
    paves the way for piping the binary messages through WebSockets in
    order to run wasm iserv in the browser, but more importantly, it
    allows us to get rid of a horrible hack in the dyld script: we no
    longer have to fake magical wasi file descriptors that are backed by
    nodejs blocking I/O! The legacy hack was due to these facts:
    
    - iserv only supported exchanging binary messages via handles backed
      by file descriptors
    - In wasi you can't access host file descriptors passed by host ghc
    - The nodejs wasi implementation only allows mapping host directories
      into the wasi vfs, not host file descriptors
    - Named pipes with file paths (mkfifo) doesn't work well with nodejs
      wasi implementation, causes spurious testsuite failures on macos
    
    But starting from this point, we can fully take advantage of
    non-blocking I/O on the js side.
    
    (cherry picked from commit a2103fd2)
Loading