Skip to content

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

Tweak some sync adapter disas tests (#14109)

Nick Fitzgeralda581bde57a51
diff --git a/tests/disas/component-model/sync-adapter-calls-x64.wat b/tests/disas/component-model/sync-adapter-calls-x64.wat
new file mode 100644
index 0000000000..432e14bd40
--- /dev/null
+++ b/tests/disas/component-model/sync-adapter-calls-x64.wat
@@ -0,0 +1,123 @@
+;;! target = "x86_64"
+;;! test = "compile"
+;;! filter = "wasm[1]"
+;;! flags = "-C inlining=y -Wconcurrency-support=y"
+
+(component
+ (component $A
+ (core module $M
+ (func (export "f'") (param i32) (result i32)
+ (i32.add (local.get 0) (i32.const 42))
+ )
+ )
+
+ (core instance $m (instantiate $M))
+
+ (func (export "f") (param "x" u32) (result u32)
+ (canon lift (core func $m "f'"))
+ )
+ )
+
+ (component $B
+ (import "f" (func $f (param "x" u32) (result u32)))
+
+ (core func $f' (canon lower (func $f)))
+
+ (core module $N
+ (import "" "f'" (func $f' (param i32) (result i32)))
+ (func (export "g'") (result i32)
+ (call $f' (i32.const 1234))
+ )
+ )
+
+ (core instance $n
+ (instantiate $N
+ (with "" (instance (export "f'" (func $f'))))
+ )
+ )
+
+ (func (export "g") (result u32)
+ (canon lift (core func $n "g'"))
+ )
+ )
+
+ (instance $a (instantiate $A))
+ (instance $b
+ (instantiate $B
+ (with "f" (func $a "f"))
+ )
+ )
+
+ (export "g" (func $b "g"))
+)
+
+;; wasm[1]::function[1]:
+;; pushq %rbp
+;; movq %rsp, %rbp
+;; movq 8(%rdi), %r10
+;; movq 0x18(%r10), %r10
+;; addq $0x70, %r10
+;; cmpq %rsp, %r10
+;; ja 0x156
+;; 39: subq $0x60, %rsp
+;; movq %rbx, 0x30(%rsp)
+;; movq %r12, 0x38(%rsp)
+;; movq %r13, 0x40(%rsp)
+;; movq %r14, 0x48(%rsp)
+;; movq %r15, 0x50(%rsp)
+;; movq 0x48(%rdi), %rsi
+;; movq 0xc8(%rsi), %rax
+;; movl (%rax), %ecx
+;; testl %ecx, %ecx
+;; jne 0x84
+;; 6b: movq 0x58(%rsi), %rax
+;; movq 0x68(%rsi), %rdi
+;; movq %rsi, 0x20(%rsp)
+;; movl $0x17, %edx
+;; callq *%rax
+;; ├─╼ exception frame offset: SP = FP - 0x60
+;; ╰─╼ exception handler: default handler, context at [SP+0x20], handler=0x140
+;; jmp 0x13e
+;; 84: movq 0xe0(%rsi), %rdx
+;; movl (%rdx), %r8d
+;; movl $0, (%rdx)
+;; movq 8(%rsi), %rdi
+;; movq 0x88(%rdi), %r9
+;; leaq (%rsp), %rbx
+;; movq %r9, (%rsp)
+;; movl $2, 8(%rsp)
+;; movl $0, 0xc(%rsp)
+;; movl $1, 0x10(%rsp)
+;; movl 0x80(%rdi), %r10d
+;; movl %r10d, 0x14(%rsp)
+;; movl $0, 0x80(%rdi)
+;; movl 0x84(%rdi), %r11d
+;; movl %r11d, 0x18(%rsp)
+;; movl $0, 0x84(%rdi)
+;; movq %rbx, 0x88(%rdi)
+;; movq 0xb0(%rsi), %rsi
+;; movl (%rsi), %ebx
+;; movl %ebx, (%rsi)
+;; movq %r9, 0x88(%rdi)
+;; movl %r10d, 0x80(%rdi)
+;; movl %r11d, 0x84(%rdi)
+;; movl %ecx, (%rax)
+;; movl %r8d, (%rdx)
+;; movl $0x4fc, %eax
+;; movq 0x30(%rsp), %rbx
+;; movq 0x38(%rsp), %r12
+;; movq 0x40(%rsp), %r13
+;; movq 0x48(%rsp), %r14
+;; movq 0x50(%rsp), %r15
+;; addq $0x60, %rsp
+;; movq %rbp, %rsp
+;; popq %rbp
+;; retq
+;; 13e: ud2
+;; 140: movq 0x20(%rsp), %rsi
+;; 145: movq 0x58(%rsi), %rax
+;; 149: movq 0x68(%rsi), %rdi
+;; 14d: movl $0x31, %edx
+;; 152: callq *%rax
+;; 154: ud2
+;; 156: ud2
diff --git a/tests/disas/component-model/sync-adapter-calls.wat b/tests/disas/component-model/sync-adapter-calls.wat
index 36536000f4..f5c9398bc6 100644
--- a/tests/disas/component-model/sync-adapter-calls.wat
+++ b/tests/disas/component-model/sync-adapter-calls.wat
@@ -1,6 +1,6 @@
;;! target = "x86_64"
;;! test = "optimize"
-;;! filter = "function"
+;;! filter = "wasm[1]--function"
;;! flags = "-C inlining=y -Wconcurrency-support=y"
(component
@@ -50,23 +50,7 @@
(export "g" (func $b "g"))
)
-;; function u0:0(i64 vmctx, i64, i32) -> i32 tail {
-;; region0 = 8 "VMContext+0x8"
-;; region1 = 67108888 "VMStoreContext+0x18"
-;; gv0 = vmctx
-;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
-;; gv2 = load.i64 notrap aligned region1 gv1+24
-;; stack_limit = gv2
-;;
-;; block0(v0: i64, v1: i64, v2: i32):
-;; @003b jump block1
-;;
-;; block1:
-;; @0038 v3 = iconst.i32 42
-;; v4 = iadd.i32 v2, v3 ; v3 = 42
-;; @003b return v4
-;; }
-;;
+
;; function u1:0(i64 vmctx, i64) -> i32 tail {
;; ss0 = explicit_slot 32, align = 8
;; region0 = 8 "VMContext+0x8"
@@ -195,118 +179,3 @@
;; v54 = iconst.i32 1276
;; @00f0 return v54 ; v54 = 1276
;; }
-;;
-;; function u2:0(i64 vmctx, i64, i32) -> i32 tail {
-;; ss0 = explicit_slot 32, align = 8
-;; region0 = 8 "VMContext+0x8"
-;; region1 = 67108888 "VMStoreContext+0x18"
-;; region2 = 1476395008 "VMGlobalImport+0x0"
-;; region3 = 402653184 "PublicGlobal"
-;; region4 = 1207959576 "VMFunctionImport+0x18"
-;; region5 = 1207959560 "VMFunctionImport+0x8"
-;; region6 = 67109000 "VMStoreContext+0x88"
-;; region7 = 1006632960 "VMDeferredThread+0x0"
-;; region8 = 1006632968 "VMDeferredThread+0x8"
-;; region9 = 1006632972 "VMDeferredThread+0xc"
-;; region10 = 1006632976 "VMDeferredThread+0x10"
-;; region11 = 67108992 "VMStoreContext+0x80"
-;; region12 = 1006632980 "VMDeferredThread+0x14"
-;; region13 = 67108996 "VMStoreContext+0x84"
-;; region14 = 1006632984 "VMDeferredThread+0x18"
-;; gv0 = vmctx
-;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
-;; gv2 = load.i64 notrap aligned region1 gv1+24
-;; gv3 = vmctx
-;; gv4 = load.i64 notrap aligned readonly can_move region0 gv3+8
-;; gv5 = load.i64 notrap aligned region1 gv4+24
-;; sig0 = (i64 vmctx, i64, i32) tail
-;; sig1 = (i64 vmctx, i64, i32, i32, i32) tail
-;; sig2 = (i64 vmctx, i64, i32) -> i32 tail
-;; sig3 = (i64 vmctx, i64) tail
-;; fn0 = colocated u0:0 sig2
-;; stack_limit = gv2
-;;
-;; block0(v0: i64, v1: i64, v2: i32):
-;; @00cf jump block4
-;;
-;; block6(v4: i64):
-;; @00cf jump block3
-;;
-;; block4:
-;; @00d6 v6 = load.i64 notrap aligned readonly can_move region2 v0+200
-;; @00d6 v7 = load.i32 notrap aligned region3 v6
-;; @00da brif v7, block7, block8
-;;
-;; block8:
-;; @00de v10 = load.i64 notrap aligned readonly can_move region5 v0+88
-;; @00de v9 = load.i64 notrap aligned readonly can_move region4 v0+104
-;; @00dc v8 = iconst.i32 23
-;; @00de try_call_indirect v10(v9, v0, v8), sig0, block9, [ context v0, default: block6(exn0) ] ; v8 = 23
-;;
-;; block9:
-;; @00e0 trap user12
-;;
-;; block7:
-;; @00e2 v11 = load.i64 notrap aligned readonly can_move region2 v0+224
-;; @00e2 v12 = load.i32 notrap aligned region3 v11
-;; @00c9 v3 = iconst.i32 0
-;; @00e8 store notrap aligned region3 v3, v11 ; v3 = 0
-;; @00f0 v20 = load.i64 notrap aligned readonly can_move region0 v0+8
-;; @00f0 v21 = load.i64 notrap aligned region6 v20+136
-;; @00f0 v19 = stack_addr.i64 ss0
-;; @00f0 store notrap aligned region7 v21, v19
-;; @00ea v15 = iconst.i32 2
-;; @00f0 store notrap aligned region8 v15, v19+8 ; v15 = 2
-;; @00f0 store notrap aligned region9 v3, v19+12 ; v3 = 0
-;; @00ee v17 = iconst.i32 1
-;; @00f0 store notrap aligned region10 v17, v19+16 ; v17 = 1
-;; @00f0 v22 = load.i32 notrap aligned region11 v20+128
-;; @00f0 store notrap aligned region12 v22, v19+20
-;; @00f0 store notrap aligned region11 v3, v20+128 ; v3 = 0
-;; @00f0 v24 = load.i32 notrap aligned region13 v20+132
-;; @00f0 store notrap aligned region14 v24, v19+24
-;; @00f0 store notrap aligned region13 v3, v20+132 ; v3 = 0
-;; @00f0 store notrap aligned region6 v19, v20+136
-;; @00f2 v26 = load.i64 notrap aligned readonly can_move region2 v0+176
-;; @00f2 v27 = load.i32 notrap aligned region3 v26
-;; @00fe store notrap aligned region3 v27, v26
-;; @0100 jump block15
-;;
-;; block15:
-;; jump block16
-;;
-;; block16:
-;; jump block10
-;;
-;; block10:
-;; @0104 jump block11
-;;
-;; block11:
-;; @0104 store.i64 notrap aligned region6 v21, v20+136
-;; @0104 store.i32 notrap aligned region11 v22, v20+128
-;; @0104 store.i32 notrap aligned region13 v24, v20+132
-;; @0104 jump block13
-;;
-;; block13:
-;; @010e store.i32 notrap aligned region3 v7, v6
-;; @0112 store.i32 notrap aligned region3 v12, v11
-;; @0114 jump block5
-;;
-;; block5:
-;; @0115 jump block2
-;;
-;; block3:
-;; v55 = load.i64 notrap aligned readonly can_move region5 v0+88
-;; v56 = load.i64 notrap aligned readonly can_move region4 v0+104
-;; @0118 v49 = iconst.i32 49
-;; @011a call_indirect sig0, v55(v56, v0, v49) ; v49 = 49
-;; @011c trap user12
-;;
-;; block2:
-;; @011e jump block1
-;;
-;; block1:
-;; v52 = iconst.i32 42
-;; v53 = iadd.i32 v2, v52 ; v52 = 42
-;; @011e return v53
-;; }