mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
feat(core): enable wasm threading support (#10116)
This commit is contained in:
parent
791513d608
commit
e4e7d957e8
6 changed files with 20 additions and 51 deletions
3
cli/dts/lib.deno.shared_globals.d.ts
vendored
3
cli/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -89,7 +89,7 @@ declare namespace WebAssembly {
|
||||||
constructor(descriptor: MemoryDescriptor);
|
constructor(descriptor: MemoryDescriptor);
|
||||||
|
|
||||||
/** An accessor property that returns the buffer contained in the memory. */
|
/** An accessor property that returns the buffer contained in the memory. */
|
||||||
readonly buffer: ArrayBuffer;
|
readonly buffer: ArrayBuffer | SharedArrayBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increases the size of the memory instance by a specified number of WebAssembly
|
* Increases the size of the memory instance by a specified number of WebAssembly
|
||||||
|
@ -170,6 +170,7 @@ declare namespace WebAssembly {
|
||||||
export interface MemoryDescriptor {
|
export interface MemoryDescriptor {
|
||||||
initial: number;
|
initial: number;
|
||||||
maximum?: number;
|
maximum?: number;
|
||||||
|
shared?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A `ModuleExportDescriptor` is the description of a declared export in a `WebAssembly.Module`. */
|
/** A `ModuleExportDescriptor` is the description of a declared export in a `WebAssembly.Module`. */
|
||||||
|
|
|
@ -3446,6 +3446,11 @@ console.log("finish");
|
||||||
output: "wasm.ts.out",
|
output: "wasm.ts.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(wasm_shared {
|
||||||
|
args: "run --quiet wasm_shared.ts",
|
||||||
|
output: "wasm_shared.out",
|
||||||
|
});
|
||||||
|
|
||||||
itest!(wasm_async {
|
itest!(wasm_async {
|
||||||
args: "run wasm_async.js",
|
args: "run wasm_async.js",
|
||||||
output: "wasm_async.out",
|
output: "wasm_async.out",
|
||||||
|
|
0
cli/tests/wasm_shared.out
Normal file
0
cli/tests/wasm_shared.out
Normal file
6
cli/tests/wasm_shared.ts
Normal file
6
cli/tests/wasm_shared.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
const memory = new WebAssembly.Memory({
|
||||||
|
initial: 1,
|
||||||
|
maximum: 10,
|
||||||
|
shared: true,
|
||||||
|
});
|
||||||
|
console.assert(memory.buffer instanceof SharedArrayBuffer);
|
|
@ -160,6 +160,7 @@ fn v8_init(v8_platform: Option<v8::UniquePtr<v8::Platform>>) {
|
||||||
// remove this to make it work asynchronously too. But that requires getting
|
// remove this to make it work asynchronously too. But that requires getting
|
||||||
// PumpMessageLoop and RunMicrotasks setup correctly.
|
// PumpMessageLoop and RunMicrotasks setup correctly.
|
||||||
// See https://github.com/denoland/deno/issues/2544
|
// See https://github.com/denoland/deno/issues/2544
|
||||||
|
" --experimental-wasm-threads",
|
||||||
" --no-wasm-async-compilation",
|
" --no-wasm-async-compilation",
|
||||||
" --harmony-top-level-await",
|
" --harmony-top-level-await",
|
||||||
" --harmony-import-assertions",
|
" --harmony-import-assertions",
|
||||||
|
|
|
@ -39,30 +39,6 @@
|
||||||
"api-replacement-encodings.any.js": true,
|
"api-replacement-encodings.any.js": true,
|
||||||
"api-surrogates-utf8.any.js": true,
|
"api-surrogates-utf8.any.js": true,
|
||||||
"encodeInto.any.js": [
|
"encodeInto.any.js": [
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 0, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 4, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 0, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 4, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 0, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with Hi and destination length 0, offset 4, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 0, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 4, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 0, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 4, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 0, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with A and destination length 10, offset 4, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 0, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 4, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 0, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 4, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 0, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆 and destination length 4, offset 4, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 0, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 4, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 0, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 4, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 0, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with 𝌆A and destination length 3, offset 4, filler random",
|
|
||||||
"encodeInto() into ArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 0, filler 0",
|
"encodeInto() into ArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 0, filler 0",
|
||||||
"encodeInto() into SharedArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 0, filler 0",
|
"encodeInto() into SharedArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 0, filler 0",
|
||||||
"encodeInto() into ArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 4, filler 0",
|
"encodeInto() into ArrayBuffer with \ud834A\udf06A¥Hi and destination length 10, offset 4, filler 0",
|
||||||
|
@ -87,23 +63,7 @@
|
||||||
"encodeInto() into SharedArrayBuffer with A\udf06 and destination length 4, offset 0, filler random",
|
"encodeInto() into SharedArrayBuffer with A\udf06 and destination length 4, offset 0, filler random",
|
||||||
"encodeInto() into ArrayBuffer with A\udf06 and destination length 4, offset 4, filler random",
|
"encodeInto() into ArrayBuffer with A\udf06 and destination length 4, offset 4, filler random",
|
||||||
"encodeInto() into SharedArrayBuffer with A\udf06 and destination length 4, offset 4, filler random",
|
"encodeInto() into SharedArrayBuffer with A\udf06 and destination length 4, offset 4, filler random",
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 0, filler 0",
|
"encodeInto() and a detached output buffer"
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 4, filler 0",
|
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 0, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 4, filler 128",
|
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 0, filler random",
|
|
||||||
"encodeInto() into SharedArrayBuffer with ¥¥ and destination length 4, offset 4, filler random",
|
|
||||||
"encodeInto() and a detached output buffer",
|
|
||||||
"Invalid encodeInto() destination: DataView, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Int8Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Int16Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Int32Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Uint16Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Uint32Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Uint8ClampedArray, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Float32Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: Float64Array, backed by: SharedArrayBuffer",
|
|
||||||
"Invalid encodeInto() destination: SharedArrayBuffer"
|
|
||||||
],
|
],
|
||||||
"idlharness.any.js": [
|
"idlharness.any.js": [
|
||||||
"TextDecoder interface: existence and properties of interface object",
|
"TextDecoder interface: existence and properties of interface object",
|
||||||
|
@ -160,10 +120,7 @@
|
||||||
"realms.window.js": false
|
"realms.window.js": false
|
||||||
},
|
},
|
||||||
"textdecoder-byte-order-marks.any.js": true,
|
"textdecoder-byte-order-marks.any.js": true,
|
||||||
"textdecoder-copy.any.js": [
|
"textdecoder-copy.any.js": false,
|
||||||
"Modify buffer after passing it in (ArrayBuffer)",
|
|
||||||
"Modify buffer after passing it in (SharedArrayBuffer)"
|
|
||||||
],
|
|
||||||
"textdecoder-fatal-single-byte.any.js": true,
|
"textdecoder-fatal-single-byte.any.js": true,
|
||||||
"textdecoder-fatal-streaming.any.js": [
|
"textdecoder-fatal-streaming.any.js": [
|
||||||
"Fatal flag, streaming cases"
|
"Fatal flag, streaming cases"
|
||||||
|
@ -206,7 +163,8 @@
|
||||||
"Encoding argument supported for decode: x-user-defined"
|
"Encoding argument supported for decode: x-user-defined"
|
||||||
],
|
],
|
||||||
"textencoder-utf16-surrogates.any.js": true,
|
"textencoder-utf16-surrogates.any.js": true,
|
||||||
"unsupported-encodings.any.js": false
|
"unsupported-encodings.any.js": false,
|
||||||
|
"textdecoder-arguments.any.js": false
|
||||||
},
|
},
|
||||||
"hr-time": {
|
"hr-time": {
|
||||||
"monotonic-clock.any.js": true,
|
"monotonic-clock.any.js": true,
|
||||||
|
@ -643,12 +601,10 @@
|
||||||
"Setting (sloppy mode)"
|
"Setting (sloppy mode)"
|
||||||
],
|
],
|
||||||
"constructor.any.js": true,
|
"constructor.any.js": true,
|
||||||
"grow.any.js": [
|
"grow.any.js": true,
|
||||||
"Growing shared memory does not detach old buffer"
|
|
||||||
],
|
|
||||||
"toString.any.js": true,
|
"toString.any.js": true,
|
||||||
"type.tentative.any.js": false,
|
"type.tentative.any.js": false,
|
||||||
"constructor-shared.tentative.any.js": false,
|
"constructor-shared.tentative.any.js": true,
|
||||||
"constructor-types.tentative.any.js": false
|
"constructor-types.tentative.any.js": false
|
||||||
},
|
},
|
||||||
"module": {
|
"module": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue