Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Leverage same-`vmctx` analysis results in Wasm-to-CLIF translation (#14412)

Nick Fitzgeraldac7ba12bebff
diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rs
index fa80f61474..421211aa0b 100644
--- a/crates/cranelift/src/func_environ.rs
+++ b/crates/cranelift/src/func_environ.rs
@@ -1964,8 +1964,17 @@ impl<'a, 'func, 'module_env> Call<'a, 'func, 'module_env> {
// so that we don't have to patch the code at runtime.
// First append the callee vmctx address.
+ //
+ // If the same-`vmctx` analysis proved that this import always shares
+ // its `vmctx` with an earlier import, load it from that import's slot.
+ // The value is identical either way, but funneling a whole set through
+ // one slot lets GVN collapse those loads, and everything downstream of
+ // them, into one.
let vmctx = self.env.vmctx_val(&mut self.builder.cursor());
- let import_off = self.env.offsets.imported_functions().at(callee_index);
+ let vmctx_index = self.env.translation.imported_func_vmctx_representative[callee_index]
+ .expand()
+ .unwrap_or(callee_index);
+ let import_off = self.env.offsets.imported_functions().at(vmctx_index);
let callee_vmctx = self
.env
.alias_regions
diff --git a/tests/disas/component-model/compile-time-builtins-x64.wat b/tests/disas/component-model/compile-time-builtins-x64.wat
index d9737537c3..29c0dad0cd 100644
--- a/tests/disas/component-model/compile-time-builtins-x64.wat
+++ b/tests/disas/component-model/compile-time-builtins-x64.wat
@@ -176,52 +176,37 @@
;; wasm[1]::function[3]:
;; pushq %rbp
;; movq %rsp, %rbp
-;; movq 0x88(%rdi), %rax
-;; movq 0xe8(%rax), %rcx
-;; movl (%rcx), %ecx
-;; testl %ecx, %ecx
-;; je 0x1c2
-;; 11c: movq 0xc8(%rax), %rax
-;; movq 8(%rax), %rax
-;; movq 0x68(%rax), %rax
-;; movq 8(%rax), %rax
-;; xorq %rcx, %rcx
-;; movq 0x48(%rdi), %rsi
-;; movq 0xe8(%rsi), %rdx
-;; movq 0x48(%rsi), %rsi
-;; movq 8(%rsi), %rsi
-;; movq 0x68(%rsi), %rsi
-;; movq 0x68(%rdi), %r8
-;; movq 0xe8(%r8), %rdi
-;; movq 0xa8(%r8), %r8
-;; movq 8(%r8), %r8
-;; movq 0x68(%r8), %r8
-;; cmpq %rax, %rcx
-;; jae 0x1bd
-;; 16c: movl (%rdx), %r9d
+;; movq 0x48(%rdi), %rcx
+;; movq 0xe8(%rcx), %rax
+;; movl (%rax), %edx
+;; testl %edx, %edx
+;; je 0x179
+;; 119: movq 0x48(%rcx), %rcx
+;; movq 8(%rcx), %rcx
+;; movq 0x68(%rcx), %rcx
+;; movq 8(%rcx), %rdx
+;; xorq %rsi, %rsi
+;; cmpq %rdx, %rsi
+;; jae 0x174
+;; 135: movl (%rax), %edi
+;; testl %edi, %edi
+;; je 0x17b
+;; 13f: movq 8(%rcx), %rdi
+;; cmpq %rdi, %rsi
+;; jae 0x17d
+;; 14c: movq (%rcx), %rdi
+;; movzbq (%rdi, %rsi), %r8
+;; movl (%rax), %r9d
;; testl %r9d, %r9d
-;; je 0x1c4
-;; 178: movq 8(%rsi), %r9
-;; cmpq %r9, %rcx
-;; jae 0x1c6
-;; 185: movq (%rsi), %r9
-;; movzbq (%r9, %rcx), %r9
-;; movl (%rdi), %r10d
-;; testl %r10d, %r10d
-;; je 0x1c8
-;; 199: movq 8(%r8), %r10
-;; cmpq %r10, %rcx
-;; jae 0x1ca
-;; 1a6: movq (%r8), %r10
-;; addb $1, %r9b
-;; movb %r9b, (%r10, %rcx)
-;; addq $1, %rcx
-;; jmp 0x163
-;; 1bd: movq %rbp, %rsp
+;; je 0x17f
+;; 160: addb $1, %r8b
+;; movb %r8b, (%rdi, %rsi)
+;; addq $1, %rsi
+;; jmp 0x12c
+;; 174: movq %rbp, %rsp
;; popq %rbp
;; retq
-;; 1c2: ud2
-;; 1c4: ud2
-;; 1c6: ud2
-;; 1c8: ud2
-;; 1ca: ud2
+;; 179: ud2
+;; 17b: ud2
+;; 17d: ud2
+;; 17f: ud2
diff --git a/tests/disas/component-model/compile-time-builtins.wat b/tests/disas/component-model/compile-time-builtins.wat
index fe0c183a8f..b583fce136 100644
--- a/tests/disas/component-model/compile-time-builtins.wat
+++ b/tests/disas/component-model/compile-time-builtins.wat
@@ -286,7 +286,7 @@
;; jump block10
;;
;; block10:
-;; @0579 v4 = load.i64 notrap aligned readonly can_move region2 v0+136
+;; @0579 v4 = load.i64 notrap aligned readonly can_move region2 v0+72
;; v23 = load.i64 notrap aligned readonly can_move region3 v4+232
;; v24 = load.i32 notrap aligned region4 v23
;; trapz v24, user26
@@ -301,7 +301,7 @@
;; jump block18
;;
;; block18:
-;; v30 = load.i64 notrap aligned readonly can_move region2 v4+200
+;; v30 = load.i64 notrap aligned readonly can_move region2 v4+72
;; v32 = load.i64 notrap aligned readonly can_move region0 v30+8
;; v33 = load.i64 notrap aligned readonly can_move region6 v32+104
;; v34 = iconst.i64 8
@@ -332,21 +332,6 @@
;;
;; block21:
;; @0573 v2 = iconst.i64 0
-;; @058c v10 = load.i64 notrap aligned readonly can_move region2 v0+72
-;; v48 = load.i64 notrap aligned readonly can_move region3 v10+232
-;; v50 = load.i64 notrap aligned readonly can_move region3 v10+208
-;; v55 = load.i64 notrap aligned readonly can_move region2 v10+72
-;; v57 = load.i64 notrap aligned readonly can_move region0 v55+8
-;; v58 = load.i64 notrap aligned readonly can_move region6 v57+104
-;; v131 = iconst.i64 8
-;; v132 = iadd v58, v131 ; v131 = 8
-;; @0591 v14 = load.i64 notrap aligned readonly can_move region2 v0+104
-;; v86 = load.i64 notrap aligned readonly can_move region3 v14+232
-;; v88 = load.i64 notrap aligned readonly can_move region3 v14+208
-;; v95 = load.i64 notrap aligned readonly can_move region2 v14+168
-;; v97 = load.i64 notrap aligned readonly can_move region0 v95+8
-;; v98 = load.i64 notrap aligned readonly can_move region6 v97+104
-;; v133 = iadd v98, v131 ; v131 = 8
;; v127 = iconst.i8 1
;; @0595 v15 = iconst.i64 1
;; @057d jump block2(v2) ; v2 = 0
@@ -365,12 +350,12 @@
;; jump block26
;;
;; block26:
-;; v49 = load.i32 notrap aligned region4 v48
+;; v49 = load.i32 notrap aligned region4 v23
;; trapz v49, user26
;; jump block29
;;
;; block29:
-;; v51 = load.i32 notrap aligned region5 v50
+;; v51 = load.i32 notrap aligned region5 v25
;; jump block32
;;
;; block32:
@@ -380,7 +365,8 @@
;; jump block39
;;
;; block39:
-;; v62 = load.i64 notrap aligned region7 v132
+;; v131 = iadd.i64 v33, v34 ; v34 = 8
+;; v62 = load.i64 notrap aligned region7 v131
;; jump block40
;;
;; block40:
@@ -398,7 +384,7 @@
;; jump block43
;;
;; block43:
-;; v71 = load.i64 notrap aligned region7 v58
+;; v71 = load.i64 notrap aligned region7 v33
;; jump block44
;;
;; block44:
@@ -431,12 +417,12 @@
;; jump block51
;;
;; block51:
-;; v87 = load.i32 notrap aligned region4 v86
+;; v87 = load.i32 notrap aligned region4 v23
;; trapz v87, user26
;; jump block54
;;
;; block54:
-;; v89 = load.i32 notrap aligned region5 v88
+;; v89 = load.i32 notrap aligned region5 v25
;; jump block57
;;
;; block57:
@@ -446,15 +432,12 @@
;; jump block64
;;
;; block64:
-;; v102 = load.i64 notrap aligned region7 v133
;; jump block65
;;
;; block65:
;; jump block66
;;
;; block66:
-;; v103 = icmp.i64 ult v6, v102
-;; trapz v103, user12
;; jump block61
;;
;; block61:
@@ -464,17 +447,15 @@
;; jump block68
;;
;; block68:
-;; v111 = load.i64 notrap aligned region7 v98
;; jump block69
;;
;; block69:
;; jump block70
;;
;; block70:
-;; v134 = iconst.i8 1
-;; v135 = iadd.i8 v74, v134 ; v134 = 1
-;; v112 = iadd.i64 v111, v6
-;; store notrap aligned region7 v135, v112
+;; v132 = iconst.i8 1
+;; v133 = iadd.i8 v74, v132 ; v132 = 1
+;; store notrap aligned region7 v133, v72
;; jump block58
;;
;; block58:
@@ -493,7 +474,7 @@
;; jump block71
;;
;; block71:
-;; v136 = iconst.i64 1
-;; v137 = iadd.i64 v6, v136 ; v136 = 1
-;; @059a jump block2(v137)
+;; v134 = iconst.i64 1
+;; v135 = iadd.i64 v6, v134 ; v134 = 1
+;; @059a jump block2(v135)
;; }
diff --git a/tests/disas/component-model/inlining-bug.wat b/tests/disas/component-model/inlining-bug.wat
index 8be39abc80..7d971fc1ee 100644
--- a/tests/disas/component-model/inlining-bug.wat
+++ b/tests/disas/component-model/inlining-bug.wat
@@ -63,7 +63,7 @@
;;
;; block4:
;; @00d4 v2 = load.i64 notrap aligned readonly can_move region2 v0+72
-;; v6 = load.i64 notrap aligned readonly can_move region2 v2+104
+;; v6 = load.i64 notrap aligned readonly can_move region2 v2+72
;; call fn2(v6, v6)
;; jump block5
;;
diff --git a/tests/disas/component-model/known-imported-adapter-memory.wat b/tests/disas/component-model/known-imported-adapter-memory.wat
index 2635e33e8c..5fd5368960 100644
--- a/tests/disas/component-model/known-imported-adapter-memory.wat
+++ b/tests/disas/component-model/known-imported-adapter-memory.wat
@@ -181,7 +181,7 @@
;; block7:
;; @0103 v10 = load.i64 notrap aligned readonly can_move region2 v0+320
;; @0103 v11 = load.i32 notrap aligned region5 v10
-;; @0111 v15 = load.i64 notrap aligned readonly can_move region4 v0+184
+;; @0111 v15 = load.i64 notrap aligned readonly can_move region4 v0+120
;; @0111 try_call fn0(v15, v0, v2), sig1, block9(ret0), [ context v0, default: block6(exn0) ]
;;
;; block9(v16: i32):
diff --git a/tests/disas/component-model/same-vmctx/disagreeing-instantiations.wat b/tests/disas/component-model/same-vmctx/disagreeing-instantiations.wat
new file mode 100644
index 0000000000..aadab128ee
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/disagreeing-instantiations.wat
@@ -0,0 +1,62 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[1]--function"
+;;! flags = "-C inlining=n"
+
+;; `$C` is instantiated twice: once with all of its function imports coming from
+;; a single instance, and once with each import coming from a different one, so
+;; each call loads its callee `vmctx` from its own slot.
+
+(component
+ (core module $M
+ (func (export "f0"))
+ (func (export "f1"))
+ (func (export "f2"))
+ )
+ (core instance $m0 (instantiate $M))
+ (core instance $m1 (instantiate $M))
+ (core instance $m2 (instantiate $M))
+ (core instance $m3 (instantiate $M))
+
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2)
+ )
+ (core instance $c1 (instantiate $C (with "" (instance $m0))))
+ (core instance $c2 (instantiate $C (with "" (instance
+ (export "f0" (func $m1 "f0"))
+ (export "f1" (func $m2 "f1"))
+ (export "f2" (func $m3 "f2"))
+ ))))
+)
+;; function u1:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; region3 = 68 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @008b v3 = load.i64 notrap aligned readonly can_move region3 v0+56
+;; @008b v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @008b call_indirect sig0, v3(v2, v0)
+;; @008d v5 = load.i64 notrap aligned readonly can_move region3 v0+88
+;; @008d v4 = load.i64 notrap aligned readonly can_move region2 v0+104
+;; @008d call_indirect sig0, v5(v4, v0)
+;; @008f v7 = load.i64 notrap aligned readonly can_move region3 v0+120
+;; @008f v6 = load.i64 notrap aligned readonly can_move region2 v0+136
+;; @008f call_indirect sig0, v7(v6, v0)
+;; @0091 jump block1
+;;
+;; block1:
+;; @0091 return
+;; }
diff --git a/tests/disas/component-model/same-vmctx/multiple-instantiations-same-instance-each.wat b/tests/disas/component-model/same-vmctx/multiple-instantiations-same-instance-each.wat
new file mode 100644
index 0000000000..78baa7de73
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/multiple-instantiations-same-instance-each.wat
@@ -0,0 +1,55 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[1]--function"
+;;! flags = "-C inlining=n"
+
+;; `$C` is instantiated twice from two *different* core instances, but within
+;; each instantiation all of its function imports come from one instance. The
+;; analysis tracks the *partition* of the imports, not which instance satisfies
+;; them, so the two instantiations agree and all three loads still collapse.
+
+(component
+ (core module $M
+ (func (export "f0"))
+ (func (export "f1"))
+ (func (export "f2"))
+ )
+ (core instance $m1 (instantiate $M))
+ (core instance $m2 (instantiate $M))
+
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2)
+ )
+ (core instance $c1 (instantiate $C (with "" (instance $m1))))
+ (core instance $c2 (instantiate $C (with "" (instance $m2))))
+)
+;; function u1:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; region3 = 68 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @0085 v3 = load.i64 notrap aligned readonly can_move region3 v0+56
+;; @0085 v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @0085 call_indirect sig0, v3(v2, v0)
+;; @0087 v5 = load.i64 notrap aligned readonly can_move region3 v0+88
+;; @0087 call_indirect sig0, v5(v2, v0)
+;; @0089 v7 = load.i64 notrap aligned readonly can_move region3 v0+120
+;; @0089 call_indirect sig0, v7(v2, v0)
+;; @008b jump block1
+;;
+;; block1:
+;; @008b return
+;; }
diff --git a/tests/disas/component-model/same-vmctx/no-instantiations.wat b/tests/disas/component-model/same-vmctx/no-instantiations.wat
new file mode 100644
index 0000000000..adbccdff80
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/no-instantiations.wat
@@ -0,0 +1,43 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! flags = "-C inlining=n"
+
+;; A module that is never instantiated has nothing to contradict the analysis's
+;; initial state, where all of its function imports trivially share one `vmctx`,
+;; so all three calls share one callee `vmctx`.
+
+(component
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2)
+ )
+)
+;; function u0:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; region3 = 68 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @003d v3 = load.i64 notrap aligned readonly can_move region3 v0+56
+;; @003d v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @003d call_indirect sig0, v3(v2, v0)
+;; @003f v5 = load.i64 notrap aligned readonly can_move region3 v0+88
+;; @003f call_indirect sig0, v5(v2, v0)
+;; @0041 v7 = load.i64 notrap aligned readonly can_move region3 v0+120
+;; @0041 call_indirect sig0, v7(v2, v0)
+;; @0043 jump block1
+;;
+;; block1:
+;; @0043 return
+;; }
diff --git a/tests/disas/component-model/same-vmctx/one-instantiation-same-instance.wat b/tests/disas/component-model/same-vmctx/one-instantiation-same-instance.wat
new file mode 100644
index 0000000000..56507e8258
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/one-instantiation-same-instance.wat
@@ -0,0 +1,50 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[1]--function"
+;;! flags = "-C inlining=n"
+
+;; `$C` is instantiated once, with all three of its function imports coming from
+;; the same core instance `$m`, so all three share a `vmctx`.
+
+(component
+ (core module $M
+ (func (export "f0"))
+ (func (export "f1"))
+ (func (export "f2"))
+ )
+ (core instance $m (instantiate $M))
+
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2)
+ )
+ (core instance $c (instantiate $C (with "" (instance $m))))
+)
+;; function u1:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; fn0 = colocated u0:0 sig0
+;; fn1 = colocated u0:1 sig0
+;; fn2 = colocated u0:2 sig0
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @0082 v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @0082 call fn0(v2, v0)
+;; @0084 call fn1(v2, v0)
+;; @0086 call fn2(v2, v0)
+;; @0088 jump block1
+;;
+;; block1:
+;; @0088 return
+;; }
diff --git a/tests/disas/component-model/same-vmctx/one-instantiation-two-instances.wat b/tests/disas/component-model/same-vmctx/one-instantiation-two-instances.wat
new file mode 100644
index 0000000000..bb247c26de
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/one-instantiation-two-instances.wat
@@ -0,0 +1,63 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[1]--function"
+;;! flags = "-C inlining=n"
+
+;; `$C` is instantiated once, with its first two function imports coming from
+;; `$a` and its last two from `$b`. Each half shares a `vmctx` internally but
+;; not with the other half, leaving exactly two `vmctx` loads, one per half.
+
+(component
+ (core module $M
+ (func (export "f0"))
+ (func (export "f1"))
+ (func (export "f2"))
+ (func (export "f3"))
+ )
+ (core instance $a (instantiate $M))
+ (core instance $b (instantiate $M))
+
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (import "" "f3" (func $f3))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2
+ call $f3)
+ )
+ (core instance $c (instantiate $C (with "" (instance
+ (export "f0" (func $a "f0"))
+ (export "f1" (func $a "f1"))
+ (export "f2" (func $b "f2"))
+ (export "f3" (func $b "f3"))
+ ))))
+)
+;; function u1:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; fn0 = colocated u0:0 sig0
+;; fn1 = colocated u0:1 sig0
+;; fn2 = colocated u0:2 sig0
+;; fn3 = colocated u0:3 sig0
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @0094 v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @0094 call fn0(v2, v0)
+;; @0096 call fn1(v2, v0)
+;; @0098 v4 = load.i64 notrap aligned readonly can_move region2 v0+136
+;; @0098 call fn2(v4, v0)
+;; @009a call fn3(v4, v0)
+;; @009c jump block1
+;;
+;; block1:
+;; @009c return
+;; }
diff --git a/tests/disas/component-model/same-vmctx/partially-disagreeing-instantiations.wat b/tests/disas/component-model/same-vmctx/partially-disagreeing-instantiations.wat
new file mode 100644
index 0000000000..083daf5ff0
--- /dev/null
+++ b/tests/disas/component-model/same-vmctx/partially-disagreeing-instantiations.wat
@@ -0,0 +1,66 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[1]--function"
+;;! flags = "-C inlining=n"
+
+;; `$C` is instantiated twice: once with all of its function imports coming from
+;; a single instance, and once with the first half coming from `$m1` and the
+;; second half from `$m2`, so we get two `vmctx` loads.
+
+(component
+ (core module $M
+ (func (export "f0"))
+ (func (export "f1"))
+ (func (export "f2"))
+ (func (export "f3"))
+ )
+ (core instance $m0 (instantiate $M))
+ (core instance $m1 (instantiate $M))
+ (core instance $m2 (instantiate $M))
+
+ (core module $C
+ (import "" "f0" (func $f0))
+ (import "" "f1" (func $f1))
+ (import "" "f2" (func $f2))
+ (import "" "f3" (func $f3))
+ (func (export "g")
+ call $f0
+ call $f1
+ call $f2
+ call $f3)
+ )
+ (core instance $c1 (instantiate $C (with "" (instance $m0))))
+ (core instance $c2 (instantiate $C (with "" (instance
+ (export "f0" (func $m1 "f0"))
+ (export "f1" (func $m1 "f1"))
+ (export "f2" (func $m2 "f2"))
+ (export "f3" (func $m2 "f3"))
+ ))))
+)
+;; function u1:0(i64 vmctx, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 25 ""
+;; region3 = 68 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; sig0 = (i64 vmctx, i64) tail
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64):
+;; @0097 v3 = load.i64 notrap aligned readonly can_move region3 v0+56
+;; @0097 v2 = load.i64 notrap aligned readonly can_move region2 v0+72
+;; @0097 call_indirect sig0, v3(v2, v0)
+;; @0099 v5 = load.i64 notrap aligned readonly can_move region3 v0+88
+;; @0099 call_indirect sig0, v5(v2, v0)
+;; @009b v7 = load.i64 notrap aligned readonly can_move region3 v0+120
+;; @009b v6 = load.i64 notrap aligned readonly can_move region2 v0+136
+;; @009b call_indirect sig0, v7(v6, v0)
+;; @009d v9 = load.i64 notrap aligned readonly can_move region3 v0+152
+;; @009d call_indirect sig0, v9(v6, v0)
+;; @009f jump block1
+;;
+;; block1:
+;; @009f return
+;; }