From 8a1d39e2dd5cc1623ec58b84cb6c4e29386917d8 Mon Sep 17 00:00:00 2001 From: Benjamin Ling Date: Tue, 30 Sep 2025 23:15:08 +0800 Subject: [PATCH 1/3] Fix wasm table access We can use the `toIndexType` utility function to access the wasm table --- src/preamble.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preamble.js b/src/preamble.js index fb8954566aa82..b853a47623b02 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -503,9 +503,9 @@ var splitModuleProxyHandler = { // When the table is dynamically laid out, the placeholder functions names // are offsets from the table base. In the main module, the table base is // always 1. - return wasmTable.get(1 + parseInt(prop))(...args); + return wasmTable.get(toIndexType(1 + parseInt(prop)))(...args); #else - return wasmTable.get(prop)(...args); + return wasmTable.get(toIndexType(prop))(...args); #endif #endif } From 5269096489a09428ada8ee7bdbab49bb0cb6baff Mon Sep 17 00:00:00 2001 From: Benjamin Ling Date: Tue, 30 Sep 2025 23:46:52 +0800 Subject: [PATCH 2/3] Combine logic to have a single return statement Changes from comments --- src/preamble.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/preamble.js b/src/preamble.js index b853a47623b02..9b62b72c77645 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -503,10 +503,9 @@ var splitModuleProxyHandler = { // When the table is dynamically laid out, the placeholder functions names // are offsets from the table base. In the main module, the table base is // always 1. - return wasmTable.get(toIndexType(1 + parseInt(prop)))(...args); -#else - return wasmTable.get(toIndexType(prop))(...args); + prop = 1 + parseInt(prop) #endif + return wasmTable.get({{{ toIndexType('prop') }}})(...args); #endif } } From a01c9311f9546452837b5b788bf2ee5a100b5c8e Mon Sep 17 00:00:00 2001 From: Benjamin Ling Date: Tue, 30 Sep 2025 23:59:48 +0800 Subject: [PATCH 3/3] Add missing semi colon --- src/preamble.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preamble.js b/src/preamble.js index 9b62b72c77645..eb885e27c21a8 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -503,7 +503,7 @@ var splitModuleProxyHandler = { // When the table is dynamically laid out, the placeholder functions names // are offsets from the table base. In the main module, the table base is // always 1. - prop = 1 + parseInt(prop) + prop = 1 + parseInt(prop); #endif return wasmTable.get({{{ toIndexType('prop') }}})(...args); #endif