From 657bc4465c8a6f8f29d69b2aeb9cac3dae754486 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 20 May 2026 16:17:57 -0700 Subject: [PATCH 1/2] fix --- src/passes/PrintBoundary.cpp | 9 ++++---- test/lit/passes/print-boundary.wast | 34 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/passes/PrintBoundary.cpp b/src/passes/PrintBoundary.cpp index 371e642e2d8..725edbb19fe 100644 --- a/src/passes/PrintBoundary.cpp +++ b/src/passes/PrintBoundary.cpp @@ -135,15 +135,16 @@ struct PrintBoundary : public Pass { switch (kind) { case ExternalKind::Function: return getTypes(wasm.getFunction(name)->type); - break; case ExternalKind::Table: - break; + return getTypes(wasm.getTable(name)->type); case ExternalKind::Memory: - break; + return getTypes(wasm.getMemory(name)->addressType); case ExternalKind::Global: return getTypes(wasm.getGlobal(name)->type); case ExternalKind::Tag: - break; + // Wrap it in a Type so that getTypes can handle it. That will print the + // params and results as we expect. + return getTypes(Type(wasm.getTag(name)->type, NonNullable)); case ExternalKind::Invalid: WASM_UNREACHABLE("invalid ExternalKind"); } diff --git a/test/lit/passes/print-boundary.wast b/test/lit/passes/print-boundary.wast index 850618f07b1..27578366cb3 100644 --- a/test/lit/passes/print-boundary.wast +++ b/test/lit/passes/print-boundary.wast @@ -5,10 +5,22 @@ (import "module2" "other" (func $bar (result i32 f32))) + (memory $mem 10 20) + + (table 10 20 funcref) + + (tag $e (param i32)) + (global $g (mut i32) (i32.const 42)) (export "one" (func $one)) + (export "m" (memory $mem)) + + (export "tab" (table 0)) + + (export "tag" (tag $e)) + (export "glob" (global $g)) (func $one (param $x (ref $struct)) (result i32 i32 i32) @@ -64,9 +76,31 @@ ;; CHECK-NEXT: } ;; CHECK-NEXT: }, ;; CHECK-NEXT: { +;; CHECK-NEXT: "name": "m", +;; CHECK-NEXT: "kind": "memory", +;; CHECK-NEXT: "type": "i32" +;; CHECK-NEXT: }, +;; CHECK-NEXT: { +;; CHECK-NEXT: "name": "tab", +;; CHECK-NEXT: "kind": "table", +;; CHECK-NEXT: "type": "funcref" +;; CHECK-NEXT: }, +;; CHECK-NEXT: { +;; CHECK-NEXT: "name": "tag", +;; CHECK-NEXT: "kind": "tag", +;; CHECK-NEXT: "type": { +;; CHECK-NEXT: "params": [ +;; CHECK-NEXT: "i32" +;; CHECK-NEXT: ], +;; CHECK-NEXT: "results": [ +;; CHECK-NEXT: ] +;; CHECK-NEXT: } +;; CHECK-NEXT: }, +;; CHECK-NEXT: { ;; CHECK-NEXT: "name": "glob", ;; CHECK-NEXT: "kind": "global", ;; CHECK-NEXT: "type": "i32" ;; CHECK-NEXT: } ;; CHECK-NEXT: ] ;; CHECK-NEXT: } + From 468d437ee552d59721c79c010094841f78d12259 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 20 May 2026 16:19:11 -0700 Subject: [PATCH 2/2] cleanup --- src/passes/PrintBoundary.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/passes/PrintBoundary.cpp b/src/passes/PrintBoundary.cpp index 725edbb19fe..2bd63f256e3 100644 --- a/src/passes/PrintBoundary.cpp +++ b/src/passes/PrintBoundary.cpp @@ -146,9 +146,9 @@ struct PrintBoundary : public Pass { // params and results as we expect. return getTypes(Type(wasm.getTag(name)->type, NonNullable)); case ExternalKind::Invalid: - WASM_UNREACHABLE("invalid ExternalKind"); + break; } - return {}; + WASM_UNREACHABLE("invalid ExternalKind"); } json::Value::Ref getKindName(ExternalKind kind) {