[#107430] [Ruby master Feature#18566] Merge `io-wait` gem into core IO — "byroot (Jean Boussier)" <noreply@...>

Issue #18566 has been reported by byroot (Jean Boussier).

22 messages 2022/02/02

[#107434] [Ruby master Bug#18567] Depending on default gems when not needed considered harmful — "Eregon (Benoit Daloze)" <noreply@...>

Issue #18567 has been reported by Eregon (Benoit Daloze).

31 messages 2022/02/02

[#107443] [Ruby master Feature#18568] Explore lazy RubyGems boot to reduce need for --disable-gems — "headius (Charles Nutter)" <noreply@...>

Issue #18568 has been reported by headius (Charles Nutter).

13 messages 2022/02/02

[#107481] [Ruby master Feature#18571] Removed the bundled sources from release package after Ruby 3.2 — "hsbt (Hiroshi SHIBATA)" <noreply@...>

Issue #18571 has been reported by hsbt (Hiroshi SHIBATA).

9 messages 2022/02/04

[#107490] [Ruby master Bug#18572] Performance regression when invoking refined methods — "palkan (Vladimir Dementyev)" <noreply@...>

Issue #18572 has been reported by palkan (Vladimir Dementyev).

12 messages 2022/02/05

[#107514] [Ruby master Feature#18576] Rename `ASCII-8BIT` encoding to `BINARY` — "byroot (Jean Boussier)" <noreply@...>

Issue #18576 has been reported by byroot (Jean Boussier).

47 messages 2022/02/08

[#107536] [Ruby master Feature#18579] Concatenation of ASCII-8BIT strings shouldn't behave differently depending on string contents — "tenderlovemaking (Aaron Patterson)" <noreply@...>

Issue #18579 has been reported by tenderlovemaking (Aaron Patterson).

11 messages 2022/02/09

[#107547] [Ruby master Bug#18580] Range#include? inconsistency for String ranges — "zverok (Victor Shepelev)" <noreply@...>

Issue #18580 has been reported by zverok (Victor Shepelev).

10 messages 2022/02/10

[#107603] [Ruby master Feature#18589] Finer-grained constant invalidation — "kddeisz (Kevin Newton)" <noreply@...>

Issue #18589 has been reported by kddeisz (Kevin Newton).

17 messages 2022/02/16

[#107624] [Ruby master Bug#18590] String#downcase and CAPITAL LETTER I WITH DOT ABOVE — "andrykonchin (Andrew Konchin)" <noreply@...>

Issue #18590 has been reported by andrykonchin (Andrew Konchin).

13 messages 2022/02/17

[#107651] [Ruby master Misc#18591] DevMeeting-2022-03-17 — "mame (Yusuke Endoh)" <noreply@...>

Issue #18591 has been reported by mame (Yusuke Endoh).

11 messages 2022/02/18

[#107682] [Ruby master Feature#18595] Alias `String#-@` as `String#dedup` — "byroot (Jean Boussier)" <noreply@...>

Issue #18595 has been reported by byroot (Jean Boussier).

15 messages 2022/02/21

[#107699] [Ruby master Feature#18597] Strings need a named method like `dup` that doesn't duplicate if receiver is mutable — "danh337 (Dan H)" <noreply@...>

Issue #18597 has been reported by danh337 (Dan H).

18 messages 2022/02/21

[ruby-core:107408] [Ruby master Feature#18462] Proposal to merge WASI based WebAssembly support

From: "jez (Jake Zimmerman)" <noreply@...>
Date: 2022-02-01 05:38:38 UTC
List: ruby-core #107408
Issue #18462 has been updated by jez (Jake Zimmerman).


mame (Yusuke Endoh) wrote in #note-4:
> Feel free to ask me if you have a question.

Wow, thanks for putting this together! I did in fact have a question, but I figure we can move the conversation somewhere else to keep this Ruby ticket on topic (discussing the WASI support).

→ https://github.com/mame/emruby/issues/6

----------------------------------------
Feature #18462: Proposal to merge WASI based WebAssembly support
https://bugs.ruby-lang.org/issues/18462#change-96307

* Author: katei (Yuta Saito)
* Status: Open
* Priority: Normal
----------------------------------------
# Proposal to merge WASI based WebAssembly support

This is an initial port of WASI based WebAssembly support.
This enables a CRuby binary to be available on Web browser, Serverless Edge environment, and other WebAssembly/WASI embedders. 
Currently this port passes basic and bootstrap test suites not using Thread API.

The upstreaming PR on ruby/ruby is here: https://github.com/ruby/ruby/pull/5407

## Background

For example, CRuby already supports WebAssembly target by Emscripten, but Emscripten heavily depends on JavaScript to emulate some missing features in WebAssembly itself.

In short the WASI is an effort to define a standard set of syscalls for WebAssembly modules, allowing WebAssembly modules to not only be portable across architectures but also be portable across environments implementing this standard set of system calls. The environments includes non JS environments, Edge Computing platforms, IoT devices, and so on.

This is a proposal ticket to support WASI based WebAssembly target.

This is a part of Ruby Association Grant project

## Lexicon

- [WASI](https://wasi.dev): A system call interface for WebAssembly
- [wasi-libc](https://github.com/WebAssembly/wasi-libc): A libc implementation for WebAssembly programs built on top of WASI system calls.

## Current Limitation of WebAssembly and WASI

### Threads

Currently WebAssembly has no threads, and WASI doesn't provide any API to create a thread, but they are [on the roadmap](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md). This means `Thread.new` doesn't work on this target, and it raises `ENOSUP` for now.

### Register operations

Current WebAssembly doesn't allow to touch the program counter, but they are also [on the roadmap](https://github.com/WebAssembly/stack-switching).
This limitation makes it hard to implement setjmp/longjmp and context-switching on this target, and wasi-libc doesn't provide such implementations.

And also WebAssembly has function local infinite registers, but there is no way to scan the values in a call stack for now.
This limitation makes it unable to mark living objects by Conservative GC in a simple way.

## Patch Overview

This patch is a set of minor changes:

### Adapt to wasi-libc API

wasi-libc is almost compatible with other libc implementations, but it doesn't have some functions.
So this patch adds stub implementations for them.

### Add no thread variant

As mentioned above, WebAssembly has no thread, so this patch adds a thread_none.c, which is a sibling of thread_win32.c and thread_pthread.c. This implementation does nothing around preemptive context switching because there is no native thread.

### Emulate setjmp/longjmp, coroutine, and register scan by Asyncify

As mentioned above, WebAssembly has no context switching feature, but there is an userland technique to pause and resume a WebAssembly process by binary transformation.
This technique is called [Asyncify](https://kripken.github.io/blog/wasm/2019/07/16/asyncify.html).
This patch utilizes it to emulate setjmp/longjmp, coroutine, and register scan for GC.





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread