From c7c7113f52e71e0735720185928c8116a7484e0b Mon Sep 17 00:00:00 2001 From: MickaelK Date: Fri, 25 Apr 2025 10:18:09 +1000 Subject: [PATCH] chore (wasi): wasm bigint issue ecmscripten has this flag "-sWASM_BIGINT=1" which make functions like fd_pread and seek to have different signature where the uint64 offset are represented as offset_lo and offset_hi. With this flag, the offset become of type BigInt --- public/assets/helpers/loader_wasm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/helpers/loader_wasm.js b/public/assets/helpers/loader_wasm.js index 5201ee30..0051393a 100644 --- a/public/assets/helpers/loader_wasm.js +++ b/public/assets/helpers/loader_wasm.js @@ -291,14 +291,14 @@ export class Wasi { return 0; } - fd_pread(fd, iovs, iovs_len, offset64, nread) { + fd_pread(fd, iovs, iovs_len, offset_lo, offset_hi, nread) { const file = FS[fd]; if (!file) { console.error(`Invalid fd: ${fd}`); return -1; } - const start = Number(offset64); + const start = (offset_hi >>> 0) * 0x100000000 + (offset_lo >>> 0); const ioVec = new Uint32Array(this.#instance.exports.memory.buffer, iovs, iovs_len * 2); const mem = new Uint8Array(this.#instance.exports.memory.buffer);