|
| 1 | +;;! target = "x86_64" |
| 2 | +;;! flags = "-W gc,exceptions" |
| 3 | +;;! test = "compile" |
| 4 | +;;! objdump = "--stack-maps=true" |
| 5 | + |
| 6 | +(module |
| 7 | + (type $s (struct (field (mut i32)))) |
| 8 | + |
| 9 | + (import "" "gc" (func $gc)) |
| 10 | + |
| 11 | + (func (export "run") (result i32) |
| 12 | + (struct.new $s (i32.const 42)) |
| 13 | + |
| 14 | + block $b |
| 15 | + try_table (catch_all $b) |
| 16 | + ;; This should have both exception handlers and stack maps in the |
| 17 | + ;; disassembly below. |
| 18 | + call $gc |
| 19 | + end |
| 20 | + end |
| 21 | + |
| 22 | + struct.get $s 0 |
| 23 | + ) |
| 24 | +) |
| 25 | +;; wasm[0]::function[1]: |
| 26 | +;; pushq %rbp |
| 27 | +;; movq %rsp, %rbp |
| 28 | +;; movq 8(%rdi), %r10 |
| 29 | +;; movq 0x18(%r10), %r10 |
| 30 | +;; addq $0x60, %r10 |
| 31 | +;; cmpq %rsp, %r10 |
| 32 | +;; ja 0xbe |
| 33 | +;; 19: subq $0x50, %rsp |
| 34 | +;; movq %rbx, 0x20(%rsp) |
| 35 | +;; movq %r12, 0x28(%rsp) |
| 36 | +;; movq %r13, 0x30(%rsp) |
| 37 | +;; movq %r14, 0x38(%rsp) |
| 38 | +;; movq %r15, 0x40(%rsp) |
| 39 | +;; movq %rdi, 8(%rsp) |
| 40 | +;; movl $0xb0000000, %esi |
| 41 | +;; xorl %edx, %edx |
| 42 | +;; movl $0x20, %ecx |
| 43 | +;; movl $8, %r8d |
| 44 | +;; movq 8(%rsp), %rbx |
| 45 | +;; movq %rbx, %rdi |
| 46 | +;; callq 0x215 |
| 47 | +;; movl %eax, (%rsp) |
| 48 | +;; movq 8(%rbx), %rcx |
| 49 | +;; movq 0x20(%rcx), %rcx |
| 50 | +;; movl %eax, %eax |
| 51 | +;; movl $0x2a, 0x18(%rcx, %rax) |
| 52 | +;; movq %rcx, 0x10(%rsp) |
| 53 | +;; movq 0x30(%rbx), %rax |
| 54 | +;; movq 0x40(%rbx), %rdi |
| 55 | +;; movq %rbx, %rsi |
| 56 | +;; movq %rbx, 8(%rsp) |
| 57 | +;; callq *%rax |
| 58 | +;; ├─╼ exception frame offset: SP = FP - 0x50 |
| 59 | +;; ╰─╼ exception handler: default handler, context at [SP+0x8], handler=0x86 |
| 60 | +;; movl (%rsp), %eax |
| 61 | +;; ╰─╼ stack_map: frame_size=80, frame_offsets=[0] |
| 62 | +;; testl %eax, %eax |
| 63 | +;; je 0xc0 |
| 64 | +;; 91: movl %eax, %eax |
| 65 | +;; movq 0x10(%rsp), %rcx |
| 66 | +;; movl 0x18(%rcx, %rax), %eax |
| 67 | +;; movq 0x20(%rsp), %rbx |
| 68 | +;; movq 0x28(%rsp), %r12 |
| 69 | +;; movq 0x30(%rsp), %r13 |
| 70 | +;; movq 0x38(%rsp), %r14 |
| 71 | +;; movq 0x40(%rsp), %r15 |
| 72 | +;; addq $0x50, %rsp |
| 73 | +;; movq %rbp, %rsp |
| 74 | +;; popq %rbp |
| 75 | +;; retq |
| 76 | +;; be: ud2 |
| 77 | +;; ╰─╼ trap: StackOverflow |
| 78 | +;; c0: ud2 |
| 79 | +;; ╰─╼ trap: NullReference |
0 commit comments