Commit Graph

22 Commits

Author SHA1 Message Date
Michael Dawson
56ccd599fe wasi: make returnOnExit true by default
Refs: https://github.com/nodejs/node/issues/46923

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/47390
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-04-11 16:35:52 -04:00
Michael Dawson
7efae9341f wasi: make version non-optional
- remove default for version
- updates tests to specify version
- add test for when version is not specified

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/47391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2023-04-06 17:46:58 -04:00
Antoine du Hamel
9dbb1623ff
lib: add trailing commas to all public core modules
PR-URL: https://github.com/nodejs/node/pull/46848
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2023-02-28 12:10:24 +01:00
Michael Dawson
2d35f669ae wasi: add support for version when creating WASI
Refs: https://github.com/nodejs/node/issues/46254

- add version to options when creating WASI object
- add convenience function to return importObject

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/46469
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-02-22 09:46:46 -05:00
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-02-14 18:45:16 +01:00
snek
f8bb0b183c
wasi: use WasmMemoryObject handle for perf (#43544)
PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-06-25 11:02:32 -07:00
LiviaMedeiros
51e7f751c7
wasi: use kEmptyObject
PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-06-11 12:18:16 +02:00
Voltrex
46a7e61900 wasi: use missing validator
The `wasi` lib module's `initialize()` method is missing a validator.

PR-URL: https://github.com/nodejs/node/pull/39070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-06-26 16:31:30 +02:00
Rongjian Zhang
5d7b6c2497
lib: refactor to reuse validators
PR-URL: https://github.com/nodejs/node/pull/38608
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-19 09:22:56 -07:00
Antoine du Hamel
08d8958a35 wasi: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/36724
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-01-06 11:34:02 +01:00
Sebastien Ahkrin
b79829c5f5
lib: replace String global with primordials
PR-URL: https://github.com/nodejs/node/pull/35397
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
2020-10-04 09:40:56 +02:00
Gus Caplan
9e135accbb
wasi: add reactor support
PR-URL: https://github.com/nodejs/node/pull/34046
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-06-29 09:52:09 -05:00
cjihrig
e3b54b4d1c wasi: allow WASI stdio to be configured
This commit adds stdin, stderr, and stdout options to WASI, which
allow the stdio streams to be configured.

PR-URL: https://github.com/nodejs/node/pull/33544
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-30 04:28:02 +02:00
Ben Noordhuis
9ad8b4d393 wasi: relax WebAssembly.Instance type check
Instances coming from different VM contexts don't pass `instanceof`
type checks because each context has its own copy of the built-in
globals.

After review of the relevant code it seems like it should be safe to
relax the type check and that is what this commit does: `wasi.start()`
now accepts any input that walks and quacks like a WebAssembly.Instance
or WebAssembly.Memory instance.

Fixes: https://github.com/nodejs/node/issues/33415

PR-URL: https://github.com/nodejs/node/pull/33431
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-23 17:57:11 +02:00
cjihrig
6ca6db105d
wasi: update start() behavior to match spec
_start() and _initialize() shouldn't be called from the same
function, as they have different behavior. Furthermore, Node
should throw if both are provided. This commit updates the
implementation, docs, and tests accordingly.

PR-URL: https://github.com/nodejs/node/pull/33073
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
2020-04-28 13:04:43 -04:00
cjihrig
4791ea09bd
wasi: rename __wasi_unstable_reactor_start()
Upstream WASI has renamed __wasi_unstable_reactor_start() to
_initialize(). This commit updates Node's WASI implementation to
reflect that change.

PR-URL: https://github.com/nodejs/node/pull/33073
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
2020-04-28 13:04:43 -04:00
Denys Otrishko
fd7e5d40a4
wasi: clean up options validation
PR-URL: https://github.com/nodejs/node/pull/31797
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-30 17:22:22 +02:00
cjihrig
6aff62fcb3
wasi: add returnOnExit option
This commit adds a WASI option allowing the __wasi_proc_exit()
function to return an exit code instead of forcefully terminating
the process.

PR-URL: https://github.com/nodejs/node/pull/32101
Fixes: https://github.com/nodejs/node/issues/32093
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2020-03-08 11:05:23 -04:00
cjihrig
b8922e8924
wasi: improve use of primordials
PR-URL: https://github.com/nodejs/node/pull/31212
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-07 21:49:20 -05:00
himself65
714eb919cc wasi: refactor destructuring object on constructor
PR-URL: https://github.com/nodejs/node/pull/31185
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-01-05 22:12:44 -08:00
Sebastien Ahkrin
eac3f0adc4
lib: replace Symbol global by the primordials Symbol
PR-URL: https://github.com/nodejs/node/pull/30737
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-12-08 13:38:58 +01:00
cjihrig
09b1228c3a
wasi: introduce initial WASI support
Co-authored-by: Gus Caplan <me@gus.host>
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
Co-authored-by: Jiawen Geng <technicalcute@gmail.com>
Co-authored-by: Tobias Nießen <tniessen@tnie.de>
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/30258
Refs: https://github.com/nodejs/node/pull/27850
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-11-30 18:06:39 +01:00