From 8627f9421656fbbac5b0a93914240098d65333ec Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 19 Nov 2025 08:48:44 -0800 Subject: [PATCH 1/3] fix --- src/passes/LegalizeJSInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp index e3b58f6f8b9..5eb43a36747 100644 --- a/src/passes/LegalizeJSInterface.cpp +++ b/src/passes/LegalizeJSInterface.cpp @@ -412,6 +412,7 @@ struct LegalizeAndPruneJSInterface : public LegalizeJSInterface { // RefFunc types etc. need updating. ReFinalize().run(getPassRunner(), module); + ReFinalize().runOnModuleCode(getPassRunner(), module); // TODO: globals etc. } From 0b8d4ba06b6ea64b6c8de1e7e93dde2452c08ee5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 19 Nov 2025 08:57:54 -0800 Subject: [PATCH 2/3] test --- test/lit/passes/legalize-and-prune-js-interface.wast | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/lit/passes/legalize-and-prune-js-interface.wast b/test/lit/passes/legalize-and-prune-js-interface.wast index 01b89d42912..8eeffcae443 100644 --- a/test/lit/passes/legalize-and-prune-js-interface.wast +++ b/test/lit/passes/legalize-and-prune-js-interface.wast @@ -21,6 +21,9 @@ ;; an unreachable. (import "env" "imported-v128-nondefaultable" (func $imported-v128-nondefaultable (result v128 (ref any)))) + ;; This func will turn from an import into an internal function. We would + ;; error if we do not update this ref.func while doing so, to make its type + ;; exact. ;; CHECK: (type $0 (func (result v128))) ;; CHECK: (type $1 (func (result i32 f64))) @@ -45,6 +48,9 @@ ;; CHECK: (import "env" "imported-64" (func $legalimport$imported-64 (type $9) (param i32 f64) (result i32))) + ;; CHECK: (global $global funcref (ref.func $imported-v128)) + (global $global funcref (ref.func $imported-v128)) + ;; CHECK: (func $imported-v128 (type $0) (result v128) ;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) ;; CHECK-NEXT: ) From 1bfc1780d9f8d25577c22793cde8d4be07252d24 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 19 Nov 2025 08:59:02 -0800 Subject: [PATCH 3/3] test --- test/lit/passes/legalize-and-prune-js-interface.wast | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/lit/passes/legalize-and-prune-js-interface.wast b/test/lit/passes/legalize-and-prune-js-interface.wast index 8eeffcae443..c1221959194 100644 --- a/test/lit/passes/legalize-and-prune-js-interface.wast +++ b/test/lit/passes/legalize-and-prune-js-interface.wast @@ -21,9 +21,6 @@ ;; an unreachable. (import "env" "imported-v128-nondefaultable" (func $imported-v128-nondefaultable (result v128 (ref any)))) - ;; This func will turn from an import into an internal function. We would - ;; error if we do not update this ref.func while doing so, to make its type - ;; exact. ;; CHECK: (type $0 (func (result v128))) ;; CHECK: (type $1 (func (result i32 f64))) @@ -49,7 +46,12 @@ ;; CHECK: (import "env" "imported-64" (func $legalimport$imported-64 (type $9) (param i32 f64) (result i32))) ;; CHECK: (global $global funcref (ref.func $imported-v128)) - (global $global funcref (ref.func $imported-v128)) + (global $global funcref + ;; The ref target will turn from an import into an internal function. We'd + ;; error if we do not update this ref.func while doing so, to make its type + ;; exact. + (ref.func $imported-v128) + ) ;; CHECK: (func $imported-v128 (type $0) (result v128) ;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)