Skip to content

Commit 44522b1

Browse files
committed
bless disas/component-model tests
Signed-off-by: Joel Dice <[email protected]>
1 parent d40eb1b commit 44522b1

File tree

4 files changed

+127
-199
lines changed

4 files changed

+127
-199
lines changed

tests/disas/component-model/direct-adapter-calls-inlining.wat

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,25 @@
6363
;; gv5 = load.i64 notrap aligned readonly gv4+8
6464
;; gv6 = load.i64 notrap aligned gv5+16
6565
;; gv7 = vmctx
66-
;; gv8 = load.i64 notrap aligned readonly can_move gv7+96
67-
;; gv9 = load.i64 notrap aligned readonly can_move gv7+72
66+
;; gv8 = load.i64 notrap aligned readonly can_move gv7+144
67+
;; gv9 = load.i64 notrap aligned readonly can_move gv7+120
6868
;; gv10 = vmctx
6969
;; gv11 = load.i64 notrap aligned readonly gv10+8
7070
;; gv12 = load.i64 notrap aligned gv11+16
7171
;; sig0 = (i64 vmctx, i64, i32) -> i32 tail
72-
;; sig1 = (i64 vmctx, i64, i32) -> i32 tail
72+
;; sig1 = (i64 vmctx, i64, i32, i32, i32) tail
73+
;; sig2 = (i64 vmctx, i64, i32) -> i32 tail
74+
;; sig3 = (i64 vmctx, i64) tail
7375
;; fn0 = colocated u2:0 sig0
74-
;; fn1 = colocated u0:0 sig1
76+
;; fn1 = colocated u0:0 sig2
7577
;; stack_limit = gv2
7678
;;
7779
;; block0(v0: i64, v1: i64):
7880
;; @00ee jump block2
7981
;;
8082
;; block2:
8183
;; @00ee v5 = load.i64 notrap aligned readonly can_move v0+64
82-
;; v12 = load.i64 notrap aligned readonly can_move v5+96
84+
;; v12 = load.i64 notrap aligned readonly can_move v5+144
8385
;; v13 = load.i32 notrap aligned table v12
8486
;; v14 = iconst.i32 1
8587
;; v15 = band v13, v14 ; v14 = 1
@@ -90,56 +92,47 @@
9092
;; jump block5
9193
;;
9294
;; block5:
93-
;; v19 = load.i64 notrap aligned readonly can_move v5+72
94-
;; v20 = load.i32 notrap aligned table v19
95-
;; v21 = iconst.i32 2
96-
;; v22 = band v20, v21 ; v21 = 2
97-
;; v79 = iconst.i32 0
98-
;; v80 = icmp eq v22, v79 ; v79 = 0
99-
;; v25 = uextend.i32 v80
100-
;; trapnz v25, user11
95+
;; v23 = load.i64 notrap aligned readonly can_move v5+72
96+
;; v22 = load.i64 notrap aligned readonly can_move v5+88
97+
;; v19 = iconst.i32 2
98+
;; v60 = iconst.i32 0
99+
;; v61 = iconst.i32 1
100+
;; call_indirect sig1, v23(v22, v5, v19, v60, v61) ; v19 = 2, v60 = 0, v61 = 1
101+
;; v24 = load.i64 notrap aligned readonly can_move v5+120
102+
;; v25 = load.i32 notrap aligned table v24
103+
;; v26 = iconst.i32 -2
104+
;; v27 = band v25, v26 ; v26 = -2
105+
;; store notrap aligned table v27, v24
106+
;; v62 = bor v25, v61 ; v61 = 1
107+
;; store notrap aligned table v62, v24
108+
;; jump block6
109+
;;
110+
;; block6:
101111
;; jump block7
102112
;;
103113
;; block7:
104-
;; v27 = load.i32 notrap aligned table v19
105-
;; v28 = iconst.i32 -3
106-
;; v29 = band v27, v28 ; v28 = -3
107-
;; store notrap aligned table v29, v19
108-
;; v60 = iconst.i32 -4
109-
;; v66 = band v27, v60 ; v60 = -4
110-
;; store notrap aligned table v66, v19
111-
;; v81 = iconst.i32 1
112-
;; v82 = bor v29, v81 ; v81 = 1
113-
;; store notrap aligned table v82, v19
114114
;; jump block8
115115
;;
116116
;; block8:
117-
;; jump block9
118-
;;
119-
;; block9:
120-
;; jump block10
121-
;;
122-
;; block10:
123-
;; v45 = load.i32 notrap aligned table v12
124-
;; v33 = iconst.i32 -2
125-
;; v47 = band v45, v33 ; v33 = -2
126-
;; store notrap aligned table v47, v12
127-
;; v83 = iconst.i32 1
128-
;; v84 = bor v45, v83 ; v83 = 1
129-
;; store notrap aligned table v84, v12
130-
;; v55 = load.i32 notrap aligned table v19
131-
;; v85 = iconst.i32 2
132-
;; v86 = bor v55, v85 ; v85 = 2
133-
;; store notrap aligned table v86, v19
117+
;; v38 = load.i32 notrap aligned table v12
118+
;; v63 = iconst.i32 -2
119+
;; v64 = band v38, v63 ; v63 = -2
120+
;; store notrap aligned table v64, v12
121+
;; v65 = iconst.i32 1
122+
;; v66 = bor v38, v65 ; v65 = 1
123+
;; store notrap aligned table v66, v12
124+
;; v48 = load.i64 notrap aligned readonly can_move v5+96
125+
;; v47 = load.i64 notrap aligned readonly can_move v5+112
126+
;; call_indirect sig3, v48(v47, v5)
134127
;; jump block3
135128
;;
136129
;; block3:
137-
;; jump block11
130+
;; jump block9
138131
;;
139-
;; block11:
132+
;; block9:
140133
;; @00f0 jump block1
141134
;;
142135
;; block1:
143-
;; v70 = iconst.i32 1276
144-
;; @00f0 return v70 ; v70 = 1276
136+
;; v51 = iconst.i32 1276
137+
;; @00f0 return v51 ; v51 = 1276
145138
;; }

tests/disas/component-model/direct-adapter-calls-x64.wat

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -80,51 +80,64 @@
8080
;; retq
8181
;; 4f: ud2
8282
;;
83-
;; wasm[2]::function[1]:
83+
;; wasm[2]::function[3]:
8484
;; pushq %rbp
8585
;; movq %rsp, %rbp
8686
;; movq 8(%rdi), %r10
8787
;; movq 0x10(%r10), %r10
88-
;; addq $0x20, %r10
88+
;; addq $0x30, %r10
8989
;; cmpq %rsp, %r10
90-
;; ja 0xfe
91-
;; 79: subq $0x10, %rsp
90+
;; ja 0x13a
91+
;; 79: subq $0x20, %rsp
9292
;; movq %rbx, (%rsp)
93-
;; movq %r14, 8(%rsp)
94-
;; movq 0x60(%rdi), %rbx
95-
;; movl (%rbx), %r9d
96-
;; testl $1, %r9d
97-
;; je 0x100
98-
;; 9a: movq 0x48(%rdi), %r14
99-
;; movq %rdi, %r11
100-
;; movl (%r14), %esi
101-
;; testl $2, %esi
102-
;; je 0x102
103-
;; b0: movl (%r14), %ecx
104-
;; movq %rcx, %rax
105-
;; andl $0xfffffffd, %eax
106-
;; movl %eax, (%r14)
107-
;; andl $0xfffffffc, %ecx
108-
;; movl %ecx, (%r14)
109-
;; orl $1, %eax
110-
;; movl %eax, (%r14)
111-
;; movq %r11, %r10
112-
;; movq 0x40(%r10), %rdi
113-
;; movq %r10, %rsi
93+
;; movq %r12, 8(%rsp)
94+
;; movq %r13, 0x10(%rsp)
95+
;; movq %r14, 0x18(%rsp)
96+
;; movq %rdx, %r13
97+
;; movq %rdi, %r14
98+
;; movq 0x90(%rdi), %r12
99+
;; movl (%r12), %ecx
100+
;; testl $1, %ecx
101+
;; je 0x13c
102+
;; ad: movq %r14, %rdi
103+
;; movq 0x48(%rdi), %r9
104+
;; movq 0x58(%rdi), %rdi
105+
;; movl $2, %edx
106+
;; xorl %ecx, %ecx
107+
;; movl $1, %r8d
108+
;; movq %r14, %rsi
109+
;; callq *%r9
110+
;; movq %r14, %rbx
111+
;; movq 0x78(%rbx), %r10
112+
;; movl (%r10), %r8d
113+
;; movq %r8, %r11
114+
;; andl $0xfffffffe, %r11d
115+
;; movl %r11d, (%r10)
116+
;; orl $1, %r8d
117+
;; movl %r8d, (%r10)
118+
;; movq 0x40(%rbx), %rdi
119+
;; movq %r13, %rdx
120+
;; movq %rbx, %rsi
114121
;; callq 0
115-
;; movl (%rbx), %edx
116-
;; movq %rdx, %r9
117-
;; andl $0xfffffffe, %r9d
118-
;; movl %r9d, (%rbx)
119-
;; orl $1, %edx
120-
;; movl %edx, (%rbx)
121-
;; orl $2, (%r14)
122+
;; movq %rax, %r14
123+
;; movl (%r12), %r10d
124+
;; movq %r10, %rsi
125+
;; andl $0xfffffffe, %esi
126+
;; movl %esi, (%r12)
127+
;; orl $1, %r10d
128+
;; movl %r10d, (%r12)
129+
;; movq 0x60(%rbx), %rcx
130+
;; movq 0x70(%rbx), %rdi
131+
;; movq %rbx, %rsi
132+
;; callq *%rcx
133+
;; movq %r14, %rax
122134
;; movq (%rsp), %rbx
123-
;; movq 8(%rsp), %r14
124-
;; addq $0x10, %rsp
135+
;; movq 8(%rsp), %r12
136+
;; movq 0x10(%rsp), %r13
137+
;; movq 0x18(%rsp), %r14
138+
;; addq $0x20, %rsp
125139
;; movq %rbp, %rsp
126140
;; popq %rbp
127141
;; retq
128-
;; fe: ud2
129-
;; 100: ud2
130-
;; 102: ud2
142+
;; 13a: ud2
143+
;; 13c: ud2

tests/disas/component-model/direct-adapter-calls.wat

Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -96,59 +96,51 @@
9696
;; gv1 = load.i64 notrap aligned readonly gv0+8
9797
;; gv2 = load.i64 notrap aligned gv1+16
9898
;; gv3 = vmctx
99-
;; gv4 = load.i64 notrap aligned readonly can_move gv3+96
100-
;; gv5 = load.i64 notrap aligned readonly can_move gv3+72
101-
;; sig0 = (i64 vmctx, i64, i32) -> i32 tail
102-
;; fn0 = colocated u0:0 sig0
99+
;; gv4 = load.i64 notrap aligned readonly can_move gv3+144
100+
;; gv5 = load.i64 notrap aligned readonly can_move gv3+120
101+
;; sig0 = (i64 vmctx, i64, i32, i32, i32) tail
102+
;; sig1 = (i64 vmctx, i64, i32) -> i32 tail
103+
;; sig2 = (i64 vmctx, i64) tail
104+
;; fn0 = colocated u0:0 sig1
103105
;; stack_limit = gv2
104106
;;
105107
;; block0(v0: i64, v1: i64, v2: i32):
106-
;; @0064 v5 = load.i64 notrap aligned readonly can_move v0+96
107-
;; @0064 v6 = load.i32 notrap aligned table v5
108-
;; @0066 v7 = iconst.i32 1
109-
;; @0068 v8 = band v6, v7 ; v7 = 1
110-
;; @0062 v4 = iconst.i32 0
111-
;; @0069 v9 = icmp eq v8, v4 ; v4 = 0
112-
;; @0069 v10 = uextend.i32 v9
113-
;; @006c trapnz v10, user11
114-
;; @006a jump block3
108+
;; @009c v5 = load.i64 notrap aligned readonly can_move v0+144
109+
;; @009c v6 = load.i32 notrap aligned table v5
110+
;; @009e v7 = iconst.i32 1
111+
;; @00a0 v8 = band v6, v7 ; v7 = 1
112+
;; @009a v4 = iconst.i32 0
113+
;; @00a1 v9 = icmp eq v8, v4 ; v4 = 0
114+
;; @00a1 v10 = uextend.i32 v9
115+
;; @00a4 trapnz v10, user11
116+
;; @00a2 jump block3
115117
;;
116118
;; block3:
117-
;; @006e v11 = load.i64 notrap aligned readonly can_move v0+72
118-
;; @006e v12 = load.i32 notrap aligned table v11
119-
;; @0070 v13 = iconst.i32 2
120-
;; @0072 v14 = band v12, v13 ; v13 = 2
121-
;; v79 = iconst.i32 0
122-
;; v80 = icmp eq v14, v79 ; v79 = 0
123-
;; @0073 v16 = uextend.i32 v80
124-
;; @0076 trapnz v16, user11
125-
;; @0074 jump block5
126-
;;
127-
;; block5:
128-
;; @0078 v18 = load.i32 notrap aligned table v11
129-
;; @007a v19 = iconst.i32 -3
130-
;; @007c v20 = band v18, v19 ; v19 = -3
131-
;; @007d store notrap aligned table v20, v11
132-
;; v67 = iconst.i32 -4
133-
;; v73 = band v18, v67 ; v67 = -4
134-
;; @0084 store notrap aligned table v73, v11
135-
;; v81 = iconst.i32 1
136-
;; v82 = bor v20, v81 ; v81 = 1
137-
;; @008d store notrap aligned table v82, v11
138-
;; @008f v33 = load.i64 notrap aligned readonly can_move v0+64
139-
;; @008f v34 = call fn0(v33, v0, v2)
140-
;; @0093 v36 = load.i32 notrap aligned table v5
141-
;; @0081 v24 = iconst.i32 -2
142-
;; @0097 v38 = band v36, v24 ; v24 = -2
143-
;; @0098 store notrap aligned table v38, v5
144-
;; v83 = bor v36, v81 ; v81 = 1
145-
;; @00a1 store notrap aligned table v83, v5
146-
;; @00a3 v46 = load.i32 notrap aligned table v11
147-
;; v84 = iconst.i32 2
148-
;; v85 = bor v46, v84 ; v84 = 2
149-
;; @00a8 store notrap aligned table v85, v11
150-
;; @00aa jump block1
119+
;; @00ac v16 = load.i64 notrap aligned readonly can_move v0+72
120+
;; @00ac v15 = load.i64 notrap aligned readonly can_move v0+88
121+
;; @00a6 v11 = iconst.i32 2
122+
;; v57 = iconst.i32 0
123+
;; v58 = iconst.i32 1
124+
;; @00ac call_indirect sig0, v16(v15, v0, v11, v57, v58) ; v11 = 2, v57 = 0, v58 = 1
125+
;; @00ae v17 = load.i64 notrap aligned readonly can_move v0+120
126+
;; @00ae v18 = load.i32 notrap aligned table v17
127+
;; @00b0 v19 = iconst.i32 -2
128+
;; @00b2 v20 = band v18, v19 ; v19 = -2
129+
;; @00b3 store notrap aligned table v20, v17
130+
;; v59 = bor v18, v58 ; v58 = 1
131+
;; @00bc store notrap aligned table v59, v17
132+
;; @00be v28 = load.i64 notrap aligned readonly can_move v0+64
133+
;; @00be v29 = call fn0(v28, v0, v2)
134+
;; @00c2 v31 = load.i32 notrap aligned table v5
135+
;; @00c6 v33 = band v31, v19 ; v19 = -2
136+
;; @00c7 store notrap aligned table v33, v5
137+
;; v60 = bor v31, v58 ; v58 = 1
138+
;; @00d0 store notrap aligned table v60, v5
139+
;; @00d2 v42 = load.i64 notrap aligned readonly can_move v0+96
140+
;; @00d2 v41 = load.i64 notrap aligned readonly can_move v0+112
141+
;; @00d2 call_indirect sig2, v42(v41, v0)
142+
;; @00d4 jump block1
151143
;;
152144
;; block1:
153-
;; @00aa return v34
145+
;; @00d4 return v29
154146
;; }

tests/disas/component-model/enum.wat

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -31,73 +31,3 @@
3131
(with "f" (func $i1 "f"))))
3232
)
3333

34-
;; function u2:0(i64 vmctx, i64) -> i32 tail {
35-
;; gv0 = vmctx
36-
;; gv1 = load.i64 notrap aligned readonly gv0+8
37-
;; gv2 = load.i64 notrap aligned gv1+16
38-
;; gv3 = vmctx
39-
;; gv4 = load.i64 notrap aligned readonly can_move gv3+96
40-
;; gv5 = load.i64 notrap aligned readonly can_move gv3+72
41-
;; sig0 = (i64 vmctx, i64) -> i32 tail
42-
;; fn0 = colocated u0:0 sig0
43-
;; stack_limit = gv2
44-
;;
45-
;; block0(v0: i64, v1: i64):
46-
;; @0063 v4 = load.i64 notrap aligned readonly can_move v0+96
47-
;; @0063 v5 = load.i32 notrap aligned table v4
48-
;; @0065 v6 = iconst.i32 1
49-
;; @0067 v7 = band v5, v6 ; v6 = 1
50-
;; @0061 v3 = iconst.i32 0
51-
;; @0068 v8 = icmp eq v7, v3 ; v3 = 0
52-
;; @0068 v9 = uextend.i32 v8
53-
;; @006b trapnz v9, user11
54-
;; @0069 jump block3
55-
;;
56-
;; block3:
57-
;; @006d v10 = load.i64 notrap aligned readonly can_move v0+72
58-
;; @006d v11 = load.i32 notrap aligned table v10
59-
;; @006f v12 = iconst.i32 2
60-
;; @0071 v13 = band v11, v12 ; v12 = 2
61-
;; v79 = iconst.i32 0
62-
;; v80 = icmp eq v13, v79 ; v79 = 0
63-
;; @0072 v15 = uextend.i32 v80
64-
;; @0075 trapnz v15, user11
65-
;; @0073 jump block5
66-
;;
67-
;; block5:
68-
;; @0077 v17 = load.i32 notrap aligned table v10
69-
;; @0079 v18 = iconst.i32 -3
70-
;; @007b v19 = band v17, v18 ; v18 = -3
71-
;; @007c store notrap aligned table v19, v10
72-
;; v69 = iconst.i32 -4
73-
;; v75 = band v17, v69 ; v69 = -4
74-
;; @0083 store notrap aligned table v75, v10
75-
;; v81 = iconst.i32 1
76-
;; v82 = bor v19, v81 ; v81 = 1
77-
;; @008a store notrap aligned table v82, v10
78-
;; @008c v32 = load.i64 notrap aligned readonly can_move v0+64
79-
;; @008c v33 = call fn0(v32, v0)
80-
;; @0090 v35 = load.i32 notrap aligned table v4
81-
;; @0080 v23 = iconst.i32 -2
82-
;; @0094 v37 = band v35, v23 ; v23 = -2
83-
;; @0095 store notrap aligned table v37, v4
84-
;; @009b v39 = iconst.i32 3
85-
;; @009d v40 = icmp ugt v33, v39 ; v39 = 3
86-
;; @009d v41 = uextend.i32 v40
87-
;; @00a0 trapnz v41, user11
88-
;; @009e jump block7
89-
;;
90-
;; block7:
91-
;; @00a4 v43 = load.i32 notrap aligned table v4
92-
;; v83 = iconst.i32 1
93-
;; v84 = bor v43, v83 ; v83 = 1
94-
;; @00a9 store notrap aligned table v84, v4
95-
;; @00ab v48 = load.i32 notrap aligned table v10
96-
;; v85 = iconst.i32 2
97-
;; v86 = bor v48, v85 ; v85 = 2
98-
;; @00b0 store notrap aligned table v86, v10
99-
;; @00b2 jump block1
100-
;;
101-
;; block1:
102-
;; @00b2 return v33
103-
;; }

0 commit comments

Comments
 (0)