From dd8002279ed8ebff8e3aa29d4089dfc90d64e5a2 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 25 Apr 2020 23:38:34 -0400 Subject: [PATCH] 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 Reviewed-By: Gus Caplan --- doc/api/wasi.md | 4 ++-- lib/wasi.js | 4 ++-- test/wasi/test-wasi-start-validation.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/wasi.md b/doc/api/wasi.md index 622de02ff85c23..e66039f1b1ae02 100644 --- a/doc/api/wasi.md +++ b/doc/api/wasi.md @@ -72,8 +72,8 @@ added: v12.16.0 Attempt to begin execution of `instance` by invoking its `_start()` export. If `instance` does not contain a `_start()` export, then `start()` attempts to -invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports -is present on `instance`, then `start()` does nothing. +invoke the `_initialize()` export. If neither of those exports is present on +`instance`, then `start()` does nothing. `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named `memory`. If `instance` does not have a `memory` export an exception is thrown. diff --git a/lib/wasi.js b/lib/wasi.js index 7ea2d1bbe0f7c0..a382388197cc03 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -96,8 +96,8 @@ class WASI { try { if (exports._start) exports._start(); - else if (exports.__wasi_unstable_reactor_start) - exports.__wasi_unstable_reactor_start(); + else if (exports._initialize) + exports._initialize(); } catch (err) { if (err !== kExitCode) { throw err; diff --git a/test/wasi/test-wasi-start-validation.js b/test/wasi/test-wasi-start-validation.js index a31c5847968491..94d31f2e1257c3 100644 --- a/test/wasi/test-wasi-start-validation.js +++ b/test/wasi/test-wasi-start-validation.js @@ -83,7 +83,7 @@ const bufferSource = fixtures.readSync('simple.wasm'); get() { return { memory: new WebAssembly.Memory({ initial: 1 }), - __wasi_unstable_reactor_start: common.mustCall() + _initialize: common.mustCall() }; } });