diff --git a/crates/js-component-bindgen/src/transpile_bindgen.rs b/crates/js-component-bindgen/src/transpile_bindgen.rs index bf14eb4ea..9aa1d1f80 100644 --- a/crates/js-component-bindgen/src/transpile_bindgen.rs +++ b/crates/js-component-bindgen/src/transpile_bindgen.rs @@ -914,7 +914,12 @@ impl<'a> Instantiator<'a, '_> { .gen .local_names .get_or_create( - &format!("import:{}-{}", import_name, &func.name), + &format!( + "import:{}-{}-{}", + import_specifier, + maybe_iface_member.as_deref().unwrap_or(""), + &func.name + ), &func.name, ) .0 diff --git a/packages/preview2-shim/lib/io/worker-io.js b/packages/preview2-shim/lib/io/worker-io.js index 7ffd3795c..41d15b997 100644 --- a/packages/preview2-shim/lib/io/worker-io.js +++ b/packages/preview2-shim/lib/io/worker-io.js @@ -231,16 +231,14 @@ class OutputStream { return streamIoErrorCall( OUTPUT_STREAM_SPLICE | this.#streamType, this.#id, - src.#id, - len + { src: src.#id, len } ); } blockingSplice(src, len) { return streamIoErrorCall( OUTPUT_STREAM_BLOCKING_SPLICE | this.#streamType, this.#id, - inputStreamId(src), - len + { src: inputStreamId(src), len } ); } subscribe() { @@ -279,21 +277,16 @@ export const streams = { InputStream, OutputStream }; class Pollable { #id; - #ready = false; get _id() { return this.#id; } ready() { - if (this.#ready) return true; - const ready = ioCall(POLL_POLLABLE_READY, this.#id); - if (ready) this.#ready = true; - return ready; + if (this.#id === 0) return true; + return ioCall(POLL_POLLABLE_READY, this.#id); } block() { - if (!this.#ready) { - ioCall(POLL_POLLABLE_BLOCK, this.#id); - this.#ready = true; - } + if (this.#id === 0) return; + ioCall(POLL_POLLABLE_BLOCK, this.#id); } static _getId(pollable) { return pollable.#id; @@ -301,31 +294,20 @@ class Pollable { static _create(id) { const pollable = new Pollable(); pollable.#id = id; - if (id === 0) pollable.#ready = true; return pollable; } - static _markReady(pollable) { - pollable.#ready = true; - } } export const pollableCreate = Pollable._create; delete Pollable._create; -const pollableMarkReady = Pollable._markReady; -delete Pollable._markReady; - const pollableGetId = Pollable._getId; delete Pollable._getId; export const poll = { Pollable, poll(list) { - const doneList = ioCall(POLL_POLL_LIST, null, list.map(pollableGetId)); - for (const idx of doneList) { - pollableMarkReady(list[idx]); - } - return doneList; + return ioCall(POLL_POLL_LIST, null, list.map(pollableGetId)); }, }; diff --git a/packages/preview2-shim/lib/io/worker-thread.js b/packages/preview2-shim/lib/io/worker-thread.js index 758a82459..153e089b8 100644 --- a/packages/preview2-shim/lib/io/worker-thread.js +++ b/packages/preview2-shim/lib/io/worker-thread.js @@ -518,7 +518,6 @@ function handle(call, id, payload) { case INPUT_STREAM_CREATE | STDIN: { const stream = createReadStream(null, { fd: 0, - autoClose: false, highWaterMark: 64 * 1024, }); // for some reason fs streams dont emit readable on end @@ -789,7 +788,7 @@ function handle(call, id, payload) { for (const [idx, id] of payload.entries()) { if (!unfinishedPolls.has(id)) doneList.push(idx); } - if (doneList.length > 0) return doneList; + if (doneList.length > 0) return new Uint32Array(doneList); // if all polls are promise type, we just race them return Promise.race( payload.map((id) => unfinishedPolls.get(id)) @@ -799,7 +798,7 @@ function handle(call, id, payload) { } if (doneList.length === 0) throw new Error("poll promise did not unregister poll"); - return doneList; + return new Uint32Array(doneList); }); } diff --git a/submodules/wasmtime b/submodules/wasmtime index 80cc33beb..57632473b 160000 --- a/submodules/wasmtime +++ b/submodules/wasmtime @@ -1 +1 @@ -Subproject commit 80cc33beb3764f879c66393e7a3aabc46fe5e84d +Subproject commit 57632473b86ce295390b1424c7dd7a4c450c32a8