| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | |
| ;; RUN: wasm-split -all -g --multi-split %s --manifest %S/multi-split.wast.manifest --out-prefix=%t -o %t.wasm | |
| ;; RUN: wasm-dis %t.wasm | filecheck %s --check-prefix=PRIMARY | |
| ;; RUN: wasm-dis %t1.wasm | filecheck %s --check-prefix=MOD1 | |
| ;; RUN: wasm-dis %t2.wasm | filecheck %s --check-prefix=MOD2 | |
| ;; RUN: wasm-dis %t3.wasm | filecheck %s --check-prefix=MOD3 | |
| ;; A regression test for the case the dispatch table was not correctly shared | |
| ;; with MOD1. Because func $A is not called by any function, MOD1 is a secondary | |
| ;; module who only acts as a caller. | |
| (module | |
| ;; MOD1: (type $0 (func)) | |
| ;; MOD1: (import "primary" "table" (table $timport$0 2 funcref)) | |
| ;; MOD1: (func $A | |
| ;; MOD1-NEXT: (call_indirect (type $0) | |
| ;; MOD1-NEXT: (i32.const 0) | |
| ;; MOD1-NEXT: ) | |
| ;; MOD1-NEXT: (call_indirect (type $0) | |
| ;; MOD1-NEXT: (i32.const 1) | |
| ;; MOD1-NEXT: ) | |
| ;; MOD1-NEXT: ) | |
| (func $A | |
| (call $B) | |
| (call $C) | |
| ) | |
| ;; MOD2: (type $0 (func)) | |
| ;; MOD2: (import "primary" "table" (table $timport$0 2 funcref)) | |
| ;; MOD2: (elem $0 (i32.const 0) $B) | |
| ;; MOD2: (func $B | |
| ;; MOD2-NEXT: (call_indirect (type $0) | |
| ;; MOD2-NEXT: (i32.const 1) | |
| ;; MOD2-NEXT: ) | |
| ;; MOD2-NEXT: ) | |
| (func $B | |
| (call $C) | |
| ) | |
| ;; MOD3: (type $0 (func)) | |
| ;; MOD3: (import "primary" "table" (table $timport$0 2 funcref)) | |
| ;; MOD3: (elem $0 (i32.const 1) $C) | |
| ;; MOD3: (func $C | |
| ;; MOD3-NEXT: ) | |
| (func $C | |
| ) | |
| ) | |
| ;; PRIMARY: (type $0 (func)) | |
| ;; PRIMARY: (import "placeholder.2" "0" (func $placeholder_0)) | |
| ;; PRIMARY: (import "placeholder.3" "1" (func $placeholder_1)) | |
| ;; PRIMARY: (table $0 2 funcref) | |
| ;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0 $placeholder_1) | |
| ;; PRIMARY: (export "table" (table $0)) |