Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,7 @@ jobs:
- run:
name: install bun
command: |
# Temporally pin to 1.3.14 (the last non-rust version) until we
# can investigate the breakages:
# https://github.com/emscripten-core/emscripten/issues/27580
curl -fsSL https://bun.com/install | bash -s "bun-v1.3.14"
curl -fsSL https://bun.com/install | bash
echo "BUN = '~/.bun/bin/bun'" >> ~/emsdk/.emscripten
echo "JS_ENGINES = [BUN]" >> ~/emsdk/.emscripten
- run-tests:
Expand Down
9 changes: 2 additions & 7 deletions src/pthread_esm_startup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ if ({{{ nodeDetectionCode() }}}) {
var worker_threads = await import('node:worker_threads');
globalThis.Worker = worker_threads.Worker;
var parentPort = worker_threads.parentPort;
// Deno and Bun already have `postMessage` defined on the global scope and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this isn't a problem for deno?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems not no.

Sadly this change does beak bun < 1.4 (since it ends up delivering messages twice).. but I'm not sure we care about back compat at this point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the original reason for the guard was fixed in denoland/deno#32596.

// deliver messages to `globalThis.onmessage`, so we must not duplicate that
// behavior here if `postMessage` is already present.
if (!globalThis.postMessage) {
parentPort.on('message', (msg) => globalThis.onmessage?.({ data: msg }));
globalThis.postMessage = (msg) => parentPort.postMessage(msg);
}
parentPort.on('message', (msg) => globalThis.onmessage?.({ data: msg }));
globalThis.postMessage = (msg) => parentPort.postMessage(msg);
}
#endif

Expand Down
9 changes: 2 additions & 7 deletions src/runtime_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,8 @@ if (ENVIRONMENT_IS_NODE && {{{ ENVIRONMENT_IS_WORKER_THREAD() }}}) {
// Create as web-worker-like an environment as we can.
globalThis.self = globalThis;
var parentPort = worker_threads.parentPort;
// Deno and Bun already have `postMessage` defined on the global scope and
// deliver messages to `globalThis.onmessage`, so we must not duplicate that
// behavior here if `postMessage` is already present.
if (!globalThis.postMessage) {
parentPort.on('message', (msg) => globalThis.onmessage?.({ data: msg }));
globalThis.postMessage = (msg) => parentPort.postMessage(msg);
}
parentPort.on('message', (msg) => globalThis.onmessage?.({ data: msg }));
globalThis.postMessage = (msg) => parentPort.postMessage(msg);
// Node.js Workers do not pass postMessage()s and uncaught exception events to the parent
// thread necessarily in the same order where they were generated in sequential program order.
// See https://github.com/nodejs/node/issues/59617
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 6883,
"a.out.js.gz": 3422,
"a.out.js": 6857,
"a.out.js.gz": 3416,
"a.out.nodebug.wasm": 19132,
"a.out.nodebug.wasm.gz": 8845,
"total": 26015,
"total_gz": 12267,
"total": 25989,
"total_gz": 12261,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7341,
"a.out.js.gz": 3639,
"a.out.js": 7315,
"a.out.js.gz": 3633,
"a.out.nodebug.wasm": 19133,
"a.out.nodebug.wasm.gz": 8846,
"total": 26474,
"total_gz": 12485,
"total": 26448,
"total_gz": 12479,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
Loading