Skip to content

Commit 2df2b07

Browse files
authored
Merge branch 'main' into fy/friendly-volhard
2 parents 5f69f8b + 6f24f88 commit 2df2b07

61 files changed

Lines changed: 908 additions & 954 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ rustflags = [
5555
[target.wasm32-wasip1-threads]
5656
rustflags = [
5757
"-C",
58-
"target-feature=+simd128",
58+
"target-feature=+simd128",
59+
"-C",
60+
# Set initial and max memory to 2GB to disable memory.grow at runtime.
61+
# The allocator uses this link-time value to decide whether to call memory.grow,
62+
# so it must match the runtime initial pages to ensure memory.grow is never called.
63+
"link-args=--initial-memory=2147483648 --max-memory=2147483648",
5964
"--cfg", "tokio_unstable"
6065
]
6166

.github/workflows/bench-rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
key: rust-bench-${{ inputs.target }}
5050

5151
- name: Install cargo-codspeed binary
52-
uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 # v2
52+
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2
5353
with:
5454
tool: cargo-codspeed@4.4.1
5555

.github/workflows/reusable-build-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070

7171
- name: Install cargo-zigbuild for musl build
7272
if: ${{ contains(inputs.target, 'musl') }}
73-
uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 # v2
73+
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2
7474
with:
7575
tool: cargo-zigbuild
7676

@@ -156,6 +156,7 @@ jobs:
156156
- name: Build wasm32-wasip1-threads with linux
157157
if: ${{ inputs.target == 'wasm32-wasip1-threads' && inputs.profile != 'release' }}
158158
run: |
159+
159160
DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 pnpm build:binding:${{ inputs.profile }}
160161
DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads pnpm build:binding:${{ inputs.profile }}
161162

.github/workflows/reusable-build-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ jobs:
172172
NODE_NO_WARNINGS: 1
173173
WASM: 1
174174
RSPACK_LOADER_WORKER_THREADS: 1
175-
NODE_OPTIONS: '--max_old_space_size=8192 --stack-trace-limit=100'
176-
run: pnpm run build:js && pnpm --filter "@rspack/cli" test && pnpm --filter "@rspack/tests" test
175+
run: pnpm run test:ci
177176

178177
- name: Upload Test Reporter
179178
if: always()

.github/workflows/reusable-rust-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
run: cargo codegen
9696

9797
- name: Install cargo-deny
98-
uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 # v2
98+
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2
9999
with:
100100
tool: cargo-deny@0.18.3
101101
- name: Check licenses

crates/node_binding/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"devDependencies": {
3636
"@emnapi/core": "1.9.2",
3737
"@emnapi/runtime": "1.9.2",
38-
"@napi-rs/cli": "3.6.0",
39-
"@napi-rs/wasm-runtime": "1.1.2",
38+
"@napi-rs/cli": "3.6.1",
39+
"@napi-rs/wasm-runtime": "1.1.3",
4040
"@types/node": "^20.19.39",
4141
"emnapi": "1.9.2",
4242
"typescript": "^6.0.2"

crates/node_binding/rspack.wasi-browser.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ const __wasmUrl = new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
2121
const __emnapiContext = __emnapiGetDefaultContext()
2222
__emnapiContext.feature.Buffer = Buffer
2323

24+
// Allocate 2GB fixed shared memory (initial == maximum to disable memory.grow).
2425
const __sharedMemory = new WebAssembly.Memory({
25-
initial: 16384,
26-
maximum: 65536,
26+
initial: 32768,
27+
maximum: 32768,
2728
shared: true,
2829
})
2930

@@ -57,6 +58,10 @@ const {
5758
...importObject.napi,
5859
...importObject.emnapi,
5960
memory: __sharedMemory,
61+
// Override emnapi's napi_adjust_external_memory to a no-op.
62+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
63+
// (initial == maximum).
64+
napi_adjust_external_memory() { return 0 },
6065
}
6166
return importObject
6267
},

crates/node_binding/rspack.wasi.cjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ const __wasi = new __nodeWASI({
2626

2727
const __emnapiContext = __emnapiGetDefaultContext()
2828

29+
// Allocate 2GB fixed shared memory (initial == maximum to disable memory.grow).
2930
const __sharedMemory = new WebAssembly.Memory({
30-
initial: 16384,
31-
maximum: 65536,
31+
initial: 32768,
32+
maximum: 32768,
3233
shared: true,
3334
})
3435

@@ -97,6 +98,10 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
9798
...importObject.napi,
9899
...importObject.emnapi,
99100
memory: __sharedMemory,
101+
// Override emnapi's napi_adjust_external_memory to a no-op.
102+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
103+
// (initial == maximum).
104+
napi_adjust_external_memory() { return 0 },
100105
}
101106
return importObject
102107
},

crates/node_binding/wasi-worker-browser.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const handler = new MessageHandler({
1616
// eslint-disable-next-line no-console
1717
console.log.apply(console, arguments)
1818
},
19-
printErr: function() {
19+
printErr: function () {
2020
// eslint-disable-next-line no-console
2121
console.error.apply(console, arguments)
22-
22+
2323
errorOutputs.push([...arguments])
2424
},
2525
})
@@ -32,6 +32,10 @@ const handler = new MessageHandler({
3232
...importObject.napi,
3333
...importObject.emnapi,
3434
memory: wasmMemory,
35+
// Override emnapi's napi_adjust_external_memory to a no-op.
36+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
37+
// (initial == maximum).
38+
napi_adjust_external_memory() { return 0 },
3539
}
3640
},
3741
})

crates/node_binding/wasi-worker.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Object.assign(globalThis, {
1919
require,
2020
Worker,
2121
importScripts: function (f) {
22-
;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
22+
; (0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
2323
},
2424
postMessage: function (msg) {
2525
if (parentPort) {
@@ -51,7 +51,11 @@ const handler = new MessageHandler({
5151
...importObject.env,
5252
...importObject.napi,
5353
...importObject.emnapi,
54-
memory: wasmMemory
54+
memory: wasmMemory,
55+
// Override emnapi's napi_adjust_external_memory to a no-op.
56+
// emnapi implements this by calling memory.grow, but we've disabled memory.grow
57+
// (initial == maximum).
58+
napi_adjust_external_memory() { return 0 },
5559
};
5660
},
5761
});

0 commit comments

Comments
 (0)