Skip to content

Commit 1c4a3ca

Browse files
authored
Add golden tests for entry trampoline output (#11586)
This commit adds a set of tests to the `disas` test suite which reflect the generated assembly for entry trampolines to Wasmtime. I plan on making some large-ish changes to these in the near future and I figured it'd be good to have examples in-tree of how these are changing over time.
1 parent 3142941 commit 1c4a3ca

5 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;;! target = "aarch64"
2+
;;! test = "compile"
3+
;;! objdump = "--filter array_to_wasm --funcs all"
4+
5+
(module (func (export "")))
6+
7+
;; wasm[0]::array_to_wasm_trampoline[0]:
8+
;; stp x29, x30, [sp, #-0x10]!
9+
;; mov x29, sp
10+
;; ldr w10, [x0]
11+
;; mov w9, #0x6f63
12+
;; movk w9, #0x6572, lsl #16
13+
;; cmp w10, w9
14+
;; cset x13, eq
15+
;; uxtb w11, w13
16+
;; cbz x11, #0x58
17+
;; 34: ldr x12, [x0, #8]
18+
;; mov x13, x29
19+
;; str x13, [x12, #0x38]
20+
;; mov x2, x0
21+
;; mov x3, x1
22+
;; bl #0
23+
;; 4c: mov w0, #1
24+
;; ldp x29, x30, [sp], #0x10
25+
;; ret
26+
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
;;! target = "pulley64"
2+
;;! test = "compile"
3+
;;! objdump = "--filter array_to_wasm --funcs all"
4+
5+
(module (func (export "")))
6+
7+
;; wasm[0]::array_to_wasm_trampoline[0]:
8+
;; push_frame
9+
;; xload32le_o32 x6, x0, 0
10+
;; br_if_xneq32_i32 x6, 1701998435, 0x25 // target = 0x30
11+
;; 15: xload64le_o32 x7, x0, 8
12+
;; xmov_fp x8
13+
;; xstore64le_o32 x7, 56, x8
14+
;; call -0x27 // target = 0x0
15+
;; xone x0
16+
;; pop_frame
17+
;; ret
18+
;; 30: trap
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;;! target = "riscv64"
2+
;;! test = "compile"
3+
;;! objdump = "--filter array_to_wasm --funcs all"
4+
5+
(module (func (export "")))
6+
7+
;; wasm[0]::array_to_wasm_trampoline[0]:
8+
;; addi sp, sp, -0x10
9+
;; sd ra, 8(sp)
10+
;; sd s0, 0(sp)
11+
;; mv s0, sp
12+
;; lw a2, 0(a0)
13+
;; lui a3, 0x65727
14+
;; addi a3, a3, -0x9d
15+
;; beq a2, a3, 8
16+
;; .byte 0x00, 0x00, 0x00, 0x00
17+
;; ld a3, 8(a0)
18+
;; mv a4, s0
19+
;; sd a4, 0x38(a3)
20+
;; auipc ra, 0
21+
;; jalr ra, ra, -0x50
22+
;; addi a0, zero, 1
23+
;; ld ra, 8(sp)
24+
;; ld s0, 0(sp)
25+
;; addi sp, sp, 0x10
26+
;; ret
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
;;! target = "s390x"
2+
;;! test = "compile"
3+
;;! objdump = "--filter array_to_wasm --funcs all"
4+
5+
(module (func (export "")))
6+
7+
;; wasm[0]::array_to_wasm_trampoline[0]:
8+
;; stmg %r6, %r15, 0x30(%r15)
9+
;; lgr %r1, %r15
10+
;; aghi %r15, -0xe0
11+
;; stg %r1, 0(%r15)
12+
;; std %f8, 0xa0(%r15)
13+
;; std %f9, 0xa8(%r15)
14+
;; std %f10, 0xb0(%r15)
15+
;; std %f11, 0xb8(%r15)
16+
;; std %f12, 0xc0(%r15)
17+
;; std %f13, 0xc8(%r15)
18+
;; std %f14, 0xd0(%r15)
19+
;; std %f15, 0xd8(%r15)
20+
;; l %r4, 0(%r2)
21+
;; clfi %r4, 0x65726f63
22+
;; jgne 0x70
23+
;; lg %r4, 8(%r2)
24+
;; lg %r5, 0(%r15)
25+
;; stg %r5, 0x38(%r4)
26+
;; brasl %r14, 0
27+
;; lhi %r2, 1
28+
;; ld %f8, 0xa0(%r15)
29+
;; ld %f9, 0xa8(%r15)
30+
;; ld %f10, 0xb0(%r15)
31+
;; ld %f11, 0xb8(%r15)
32+
;; ld %f12, 0xc0(%r15)
33+
;; ld %f13, 0xc8(%r15)
34+
;; ld %f14, 0xd0(%r15)
35+
;; ld %f15, 0xd8(%r15)
36+
;; lmg %r6, %r15, 0x110(%r15)
37+
;; br %r14
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
;;! target = "x86_64"
2+
;;! test = "compile"
3+
;;! objdump = "--filter array_to_wasm --funcs all"
4+
5+
(module (func (export "")))
6+
7+
;; wasm[0]::array_to_wasm_trampoline[0]:
8+
;; pushq %rbp
9+
;; movq %rsp, %rbp
10+
;; movl (%rdi), %r9d
11+
;; cmpl $0x65726f63, %r9d
12+
;; jne 0x37
13+
;; 1d: movq 8(%rdi), %r11
14+
;; movq %rbp, %rax
15+
;; movq %rax, 0x38(%r11)
16+
;; callq 0
17+
;; movl $1, %eax
18+
;; movq %rbp, %rsp
19+
;; popq %rbp
20+
;; retq
21+
;; 37: ud2

0 commit comments

Comments
 (0)