From 7ab235dec06bbc3d82cffd0527fa2bea37a07b37 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) --- 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 30c0d4dea56..7395f98d58a 100755 --- a/utils/jsffi/dyld.mjs +++ b/utils/jsffi/dyld.mjs @@ -231,10 +231,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