|
24 | 24 | memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "aGVsbG8s"); |
25 | 25 | memorySegments[1] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "d29ybGQh"); |
26 | 26 |
|
27 | | - function wasm2js_atomic_wait_i32(ptr, expected, timeoutLow, timeoutHigh) { |
| 27 | + function wasm2js_atomic_wait_i32(offset, ptr, expected, timeoutLow, timeoutHigh) { |
| 28 | + ptr = (ptr + offset) >> 2; |
28 | 29 | var timeout = Infinity; |
29 | 30 | if (timeoutHigh >= 0) { |
30 | 31 | // Convert from nanoseconds to milliseconds |
31 | 32 | // Taken from convertI32PairToI53 in emscripten's library_int53.js |
32 | 33 | timeout = ((timeoutLow >>> 0) / 1e6) + timeoutHigh * (4294967296 / 1e6); |
33 | 34 | } |
34 | 35 | var view = new Int32Array(bufferView.buffer); // TODO cache |
35 | | - var result = Atomics.wait(view, ptr >> 2, expected, timeout); |
| 36 | + var result = Atomics.wait(view, ptr, expected, timeout); |
36 | 37 | if (result == 'ok') return 0; |
37 | 38 | if (result == 'not-equal') return 1; |
38 | 39 | if (result == 'timed-out') return 2; |
@@ -117,7 +118,7 @@ function asmFunc(imports) { |
117 | 118 | Atomics.load(HEAPU16, 514); |
118 | 119 | Atomics.load(HEAP32, 257); |
119 | 120 | Atomics.store(HEAP32, 25, 200); |
120 | | - wasm2js_atomic_wait_i32(4, 8, -1, -1) | 0; |
| 121 | + wasm2js_atomic_wait_i32(4, 8, 16, -1, -1) | 0; |
121 | 122 | wasm2js_memory_init(0, 512, 0, 4); |
122 | 123 | wasm2js_memory_init(1, 1024, 4, 2); |
123 | 124 | Atomics.notify(HEAP32, 1, 2); |
|
0 commit comments