1;;! target = "x86_64"
2;;! test = "compile"
3;;! flags = ["-Wexceptions=yes", "-Wgc=yes"]
4
5(module
6 (tag $e0 (param i32 i64))
7
8 (func $throw (param i32 i64)
9       (throw $e0 (local.get 0) (local.get 1)))
10
11 (func $catch (export "catch") (param i32 i64) (result i32 i64)
12
13       (block $b (result i32 i64)
14              (try_table (result i32 i64)
15                         (catch $e0 $b)
16                         (call $throw (local.get 0) (local.get 1))
17                         (i32.const 42)
18                         (i64.const 100)))))
19;; wasm[0]::function[0]::throw:
20;;       pushq   %rbp
21;;       movq    %rsp, %rbp
22;;       movq    8(%rdi), %r10
23;;       movq    0x18(%r10), %r10
24;;       addq    $0x50, %r10
25;;       cmpq    %rsp, %r10
26;;       ja      0xa2
27;;   19: subq    $0x40, %rsp
28;;       movq    %rbx, 0x10(%rsp)
29;;       movq    %r12, 0x18(%rsp)
30;;       movq    %r13, 0x20(%rsp)
31;;       movq    %r14, 0x28(%rsp)
32;;       movq    %r15, 0x30(%rsp)
33;;       movq    %rdi, %r12
34;;       movq    %rcx, %r13
35;;       movq    %rdx, %r15
36;;       callq   0x3b2
37;;       movq    %rax, %r14
38;;       movl    $0x4000000, %esi
39;;       movl    $3, %edx
40;;       movl    $0x30, %ecx
41;;       movl    $8, %r8d
42;;       movq    %r12, %rdi
43;;       callq   0x34f
44;;       movq    8(%r12), %r8
45;;       movq    0x20(%r8), %r8
46;;       movl    %eax, %r9d
47;;       movq    %r15, %rdx
48;;       movl    %edx, 0x20(%r8, %r9)
49;;       movq    %r13, %rcx
50;;       movq    %rcx, 0x28(%r8, %r9)
51;;       movq    %r14, %r10
52;;       movl    %r10d, 0x18(%r8, %r9)
53;;       movl    $0, 0x1c(%r8, %r9)
54;;       movq    %rax, %rsi
55;;       movq    %r12, %rdi
56;;       movq    %r12, (%rsp)
57;;       callq   0x3de
58;;       ud2
59;;       ud2
60;;
61;; wasm[0]::function[1]::catch:
62;;       pushq   %rbp
63;;       movq    %rsp, %rbp
64;;       movq    8(%rdi), %r10
65;;       movq    0x18(%r10), %r10
66;;       addq    $0x50, %r10
67;;       cmpq    %rsp, %r10
68;;       ja      0x14f
69;;   d9: subq    $0x40, %rsp
70;;       movq    %rbx, 0x10(%rsp)
71;;       movq    %r12, 0x18(%rsp)
72;;       movq    %r13, 0x20(%rsp)
73;;       movq    %r14, 0x28(%rsp)
74;;       movq    %r15, 0x30(%rsp)
75;;       movq    %rdi, (%rsp)
76;;       movq    (%rsp), %rsi
77;;       movq    (%rsp), %rdi
78;;       callq   0
79;;       ├─╼ exception frame offset: SP = FP - 0x40
80;;       ╰─╼ exception handler: tag=0, context at [SP+0x0], handler=0x116
81;;       movl    $0x2a, %eax
82;;       movl    $0x64, %ecx
83;;       jmp     0x12d
84;;  116: movq    (%rsp), %rdi
85;;       movq    8(%rdi), %rcx
86;;       movq    0x20(%rcx), %rcx
87;;       movl    %eax, %edx
88;;       movl    0x20(%rcx, %rdx), %eax
89;;       movq    0x28(%rcx, %rdx), %rcx
90;;       movq    0x10(%rsp), %rbx
91;;       movq    0x18(%rsp), %r12
92;;       movq    0x20(%rsp), %r13
93;;       movq    0x28(%rsp), %r14
94;;       movq    0x30(%rsp), %r15
95;;       addq    $0x40, %rsp
96;;       movq    %rbp, %rsp
97;;       popq    %rbp
98;;       retq
99;;  14f: ud2
100