blob: 1354d34d4ecdbecaab8755729cf9b92c6a86fec9 [file] [log] [blame] [edit]
;; 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.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
;; Check if --import-namespace and --no-placeholders options work.
;; RUN: wasm-split -all -g --multi-split %s --manifest %s.manifest --out-prefix=%t --import-namespace=custom_env --no-placeholders -o %t.wasm
;; RUN: wasm-dis %t.wasm | filecheck %s --check-prefix=PRIMARY-OPTIONS
;; RUN: wasm-dis %t1.wasm | filecheck %s --check-prefix=MOD1-OPTIONS
;; RUN: wasm-dis %t2.wasm | filecheck %s --check-prefix=MOD2-OPTIONS
;; RUN: wasm-dis %t3.wasm | filecheck %s --check-prefix=MOD3-OPTIONS
(module
;; PRIMARY: (type $ret-i32 (func (result i32)))
;; PRIMARY-OPTIONS: (type $ret-i32 (func (result i32)))
(type $ret-i32 (func (result i32)))
;; PRIMARY: (type $ret-i64 (func (result i64)))
;; PRIMARY-OPTIONS: (type $ret-i64 (func (result i64)))
(type $ret-i64 (func (result i64)))
;; PRIMARY: (type $ret-f32 (func (result f32)))
;; PRIMARY-OPTIONS: (type $ret-f32 (func (result f32)))
(type $ret-f32 (func (result f32)))
;; MOD1: (type $0 (func (result i64)))
;; MOD1: (type $1 (func (result f32)))
;; MOD1: (type $2 (func (result i32)))
;; MOD1: (import "" "table" (table $timport$0 1 funcref))
;; MOD1: (import "" "B" (func $B (result i64)))
;; MOD1: (import "" "C" (func $C (result f32)))
;; MOD1: (elem $0 (i32.const 0) $A)
;; MOD1: (func $A (result i32)
;; MOD1-NEXT: (drop
;; MOD1-NEXT: (call_ref $2
;; MOD1-NEXT: (ref.func $A)
;; MOD1-NEXT: )
;; MOD1-NEXT: )
;; MOD1-NEXT: (drop
;; MOD1-NEXT: (call_ref $0
;; MOD1-NEXT: (ref.func $B)
;; MOD1-NEXT: )
;; MOD1-NEXT: )
;; MOD1-NEXT: (drop
;; MOD1-NEXT: (call_ref $1
;; MOD1-NEXT: (ref.func $C)
;; MOD1-NEXT: )
;; MOD1-NEXT: )
;; MOD1-NEXT: (i32.const 0)
;; MOD1-NEXT: )
;; MOD1-OPTIONS: (type $0 (func (result i64)))
;; MOD1-OPTIONS: (type $1 (func (result f32)))
;; MOD1-OPTIONS: (type $2 (func (result i32)))
;; MOD1-OPTIONS: (import "custom_env" "table" (table $timport$0 1 funcref))
;; MOD1-OPTIONS: (import "custom_env" "B" (func $B (result i64)))
;; MOD1-OPTIONS: (import "custom_env" "C" (func $C (result f32)))
;; MOD1-OPTIONS: (elem $0 (i32.const 0) $A)
;; MOD1-OPTIONS: (func $A (result i32)
;; MOD1-OPTIONS-NEXT: (drop
;; MOD1-OPTIONS-NEXT: (call_ref $2
;; MOD1-OPTIONS-NEXT: (ref.func $A)
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: (drop
;; MOD1-OPTIONS-NEXT: (call_ref $0
;; MOD1-OPTIONS-NEXT: (ref.func $B)
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: (drop
;; MOD1-OPTIONS-NEXT: (call_ref $1
;; MOD1-OPTIONS-NEXT: (ref.func $C)
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: )
;; MOD1-OPTIONS-NEXT: (i32.const 0)
;; MOD1-OPTIONS-NEXT: )
(func $A (type $ret-i32) (result i32)
(drop
(call_ref $ret-i32
(ref.func $A)
)
)
(drop
(call_ref $ret-i64
(ref.func $B)
)
)
(drop
(call_ref $ret-f32
(ref.func $C)
)
)
(i32.const 0)
)
;; MOD2: (type $0 (func (result f32)))
;; MOD2: (type $1 (func (result i32)))
;; MOD2: (type $2 (func (result i64)))
;; MOD2: (import "" "table_4" (table $timport$0 1 funcref))
;; MOD2: (import "" "C" (func $C (result f32)))
;; MOD2: (import "" "trampoline_A" (func $trampoline_A (result i32)))
;; MOD2: (elem $0 (i32.const 0) $B)
;; MOD2: (func $B (result i64)
;; MOD2-NEXT: (drop
;; MOD2-NEXT: (call_ref $1
;; MOD2-NEXT: (ref.func $trampoline_A)
;; MOD2-NEXT: )
;; MOD2-NEXT: )
;; MOD2-NEXT: (drop
;; MOD2-NEXT: (call_ref $2
;; MOD2-NEXT: (ref.func $B)
;; MOD2-NEXT: )
;; MOD2-NEXT: )
;; MOD2-NEXT: (drop
;; MOD2-NEXT: (call_ref $0
;; MOD2-NEXT: (ref.func $C)
;; MOD2-NEXT: )
;; MOD2-NEXT: )
;; MOD2-NEXT: (i64.const 0)
;; MOD2-NEXT: )
;; MOD2-OPTIONS: (type $0 (func (result f32)))
;; MOD2-OPTIONS: (type $1 (func (result i32)))
;; MOD2-OPTIONS: (type $2 (func (result i64)))
;; MOD2-OPTIONS: (import "custom_env" "table_4" (table $timport$0 1 funcref))
;; MOD2-OPTIONS: (import "custom_env" "C" (func $C (result f32)))
;; MOD2-OPTIONS: (import "custom_env" "trampoline_A" (func $trampoline_A (result i32)))
;; MOD2-OPTIONS: (elem $0 (i32.const 0) $B)
;; MOD2-OPTIONS: (func $B (result i64)
;; MOD2-OPTIONS-NEXT: (drop
;; MOD2-OPTIONS-NEXT: (call_ref $1
;; MOD2-OPTIONS-NEXT: (ref.func $trampoline_A)
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: (drop
;; MOD2-OPTIONS-NEXT: (call_ref $2
;; MOD2-OPTIONS-NEXT: (ref.func $B)
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: (drop
;; MOD2-OPTIONS-NEXT: (call_ref $0
;; MOD2-OPTIONS-NEXT: (ref.func $C)
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: )
;; MOD2-OPTIONS-NEXT: (i64.const 0)
;; MOD2-OPTIONS-NEXT: )
(func $B (type $ret-i64) (result i64)
(drop
(call_ref $ret-i32
(ref.func $A)
)
)
(drop
(call_ref $ret-i64
(ref.func $B)
)
)
(drop
(call_ref $ret-f32
(ref.func $C)
)
)
(i64.const 0)
)
;; MOD3: (type $0 (func (result i32)))
;; MOD3: (type $1 (func (result i64)))
;; MOD3: (type $2 (func (result f32)))
;; MOD3: (import "" "table_5" (table $timport$0 1 funcref))
;; MOD3: (import "" "trampoline_A" (func $trampoline_A (result i32)))
;; MOD3: (import "" "B" (func $trampoline_B (result i64)))
;; MOD3: (elem $0 (i32.const 0) $C)
;; MOD3: (func $C (result f32)
;; MOD3-NEXT: (drop
;; MOD3-NEXT: (call_ref $0
;; MOD3-NEXT: (ref.func $trampoline_A)
;; MOD3-NEXT: )
;; MOD3-NEXT: )
;; MOD3-NEXT: (drop
;; MOD3-NEXT: (call_ref $1
;; MOD3-NEXT: (ref.func $trampoline_B)
;; MOD3-NEXT: )
;; MOD3-NEXT: )
;; MOD3-NEXT: (drop
;; MOD3-NEXT: (call_ref $2
;; MOD3-NEXT: (ref.func $C)
;; MOD3-NEXT: )
;; MOD3-NEXT: )
;; MOD3-NEXT: (f32.const 0)
;; MOD3-NEXT: )
;; MOD3-OPTIONS: (type $0 (func (result i32)))
;; MOD3-OPTIONS: (type $1 (func (result i64)))
;; MOD3-OPTIONS: (type $2 (func (result f32)))
;; MOD3-OPTIONS: (import "custom_env" "table_5" (table $timport$0 1 funcref))
;; MOD3-OPTIONS: (import "custom_env" "trampoline_A" (func $trampoline_A (result i32)))
;; MOD3-OPTIONS: (import "custom_env" "B" (func $trampoline_B (result i64)))
;; MOD3-OPTIONS: (elem $0 (i32.const 0) $C)
;; MOD3-OPTIONS: (func $C (result f32)
;; MOD3-OPTIONS-NEXT: (drop
;; MOD3-OPTIONS-NEXT: (call_ref $0
;; MOD3-OPTIONS-NEXT: (ref.func $trampoline_A)
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: (drop
;; MOD3-OPTIONS-NEXT: (call_ref $1
;; MOD3-OPTIONS-NEXT: (ref.func $trampoline_B)
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: (drop
;; MOD3-OPTIONS-NEXT: (call_ref $2
;; MOD3-OPTIONS-NEXT: (ref.func $C)
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: )
;; MOD3-OPTIONS-NEXT: (f32.const 0)
;; MOD3-OPTIONS-NEXT: )
(func $C (type $ret-f32) (result f32)
(drop
(call_ref $ret-i32
(ref.func $A)
)
)
(drop
(call_ref $ret-i64
(ref.func $B)
)
)
(drop
(call_ref $ret-f32
(ref.func $C)
)
)
(f32.const 0)
)
)
;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (result i32)))
;; PRIMARY: (import "placeholder" "0" (func $placeholder_0_4 (result i64)))
;; PRIMARY: (import "placeholder" "0" (func $placeholder_0_5 (result f32)))
;; PRIMARY: (table $0 1 funcref)
;; PRIMARY: (table $1 1 funcref)
;; PRIMARY: (table $2 1 funcref)
;; PRIMARY: (elem $0 (table $0) (i32.const 0) func $placeholder_0)
;; PRIMARY: (elem $1 (table $1) (i32.const 0) func $placeholder_0_4)
;; PRIMARY: (elem $2 (table $2) (i32.const 0) func $placeholder_0_5)
;; PRIMARY: (export "B" (func $trampoline_B))
;; PRIMARY: (export "C" (func $trampoline_C))
;; PRIMARY: (export "table" (table $0))
;; PRIMARY: (export "trampoline_A" (func $trampoline_A))
;; PRIMARY: (export "table_4" (table $1))
;; PRIMARY: (export "table_5" (table $2))
;; PRIMARY: (func $trampoline_A (result i32)
;; PRIMARY-NEXT: (call_indirect (type $ret-i32)
;; PRIMARY-NEXT: (i32.const 0)
;; PRIMARY-NEXT: )
;; PRIMARY-NEXT: )
;; PRIMARY: (func $trampoline_B (result i64)
;; PRIMARY-NEXT: (call_indirect $1 (type $ret-i64)
;; PRIMARY-NEXT: (i32.const 0)
;; PRIMARY-NEXT: )
;; PRIMARY-NEXT: )
;; PRIMARY: (func $trampoline_C (result f32)
;; PRIMARY-NEXT: (call_indirect $2 (type $ret-f32)
;; PRIMARY-NEXT: (i32.const 0)
;; PRIMARY-NEXT: )
;; PRIMARY-NEXT: )
;; PRIMARY-OPTIONS: (table $0 1 funcref)
;; PRIMARY-OPTIONS: (table $1 1 funcref)
;; PRIMARY-OPTIONS: (table $2 1 funcref)
;; PRIMARY-OPTIONS: (elem $0 (table $0) (i32.const 0) funcref (item (ref.null nofunc)))
;; PRIMARY-OPTIONS: (elem $1 (table $1) (i32.const 0) funcref (item (ref.null nofunc)))
;; PRIMARY-OPTIONS: (elem $2 (table $2) (i32.const 0) funcref (item (ref.null nofunc)))
;; PRIMARY-OPTIONS: (export "B" (func $trampoline_B))
;; PRIMARY-OPTIONS: (export "C" (func $trampoline_C))
;; PRIMARY-OPTIONS: (export "table" (table $0))
;; PRIMARY-OPTIONS: (export "trampoline_A" (func $trampoline_A))
;; PRIMARY-OPTIONS: (export "table_4" (table $1))
;; PRIMARY-OPTIONS: (export "table_5" (table $2))
;; PRIMARY-OPTIONS: (func $trampoline_A (result i32)
;; PRIMARY-OPTIONS-NEXT: (call_indirect (type $ret-i32)
;; PRIMARY-OPTIONS-NEXT: (i32.const 0)
;; PRIMARY-OPTIONS-NEXT: )
;; PRIMARY-OPTIONS-NEXT: )
;; PRIMARY-OPTIONS: (func $trampoline_B (result i64)
;; PRIMARY-OPTIONS-NEXT: (call_indirect $1 (type $ret-i64)
;; PRIMARY-OPTIONS-NEXT: (i32.const 0)
;; PRIMARY-OPTIONS-NEXT: )
;; PRIMARY-OPTIONS-NEXT: )
;; PRIMARY-OPTIONS: (func $trampoline_C (result f32)
;; PRIMARY-OPTIONS-NEXT: (call_indirect $2 (type $ret-f32)
;; PRIMARY-OPTIONS-NEXT: (i32.const 0)
;; PRIMARY-OPTIONS-NEXT: )
;; PRIMARY-OPTIONS-NEXT: )