From 9308464f677b259a24aa968c5809a3f0b0615f78 Mon Sep 17 00:00:00 2001 From: Cheng Shao <terrorjack@type.dance> Date: Fri, 7 Mar 2025 22:27:11 +0000 Subject: [PATCH] wasm: don't create a wasm global for dyld poison There's a much more efficient way to convert an unsigned i32 to a signed one. Thanks, o3-mini-high. (cherry picked from commit 75fcc5c9ab900cb80834802c581283681cf8c398) (cherry picked from commit 733b4c56d910ed780c2b4b813e0a9fe43d02e7ef) --- utils/jsffi/dyld.mjs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utils/jsffi/dyld.mjs b/utils/jsffi/dyld.mjs index bcd08cbb43b..fb0e229cf58 100755 --- a/utils/jsffi/dyld.mjs +++ b/utils/jsffi/dyld.mjs @@ -229,10 +229,7 @@ class DyLD { // memory access near this address will trap immediately. // // In JS API i32 is signed, hence this layer of redirection. - static #poison = new WebAssembly.Global( - { value: "i32", mutable: false }, - 0xffffffff - DyLD.#pageSize - ).value; + static #poison = (0xffffffff - DyLD.#pageSize) | 0; // When processing exports, skip the following ones since they're // generated by wasm-ld. -- GitLab