Stream: git-cranelift

Topic: cranelift / Issue #1372 FDE is not compelete for function...


view this post on Zulip GitHub (Feb 01 2020 at 11:57):

yurydelendik opened Issue #1372:

Based on https://github.com/bytecodealliance/wasmtime/issues/841

The following wasm function has multiple exits:

      (func $test_conditional_panic (result i64)
        block
          i32.const 1
          br_if 0
          i64.const 0
          return
        end
        unreachable
      )

It generates machine code for x86_64:

   0:   40 55                   push    rbp
   2:   48 89 e5                mov rbp, rsp
   5:   40 b8 01 00 00 00       mov eax, 1
   b:   40 85 c0                test    eax, eax
   e:   75 09                   jne 0x19
  10:   40 b8 00 00 00 00       mov eax, 0
  16:   40 5d                   pop rbp
  18:   c3                      ret
  19:   0f 0b                   ud2

The generated FDE looks like:

The issue we are having is with stack traces below first function exit, due to FDE restructuring frame info for ret, though not restoring it back for ud2.

view this post on Zulip GitHub (Feb 01 2020 at 11:57):

yurydelendik labeled Issue #1372:

Based on https://github.com/bytecodealliance/wasmtime/issues/841

The following wasm function has multiple exits:

      (func $test_conditional_panic (result i64)
        block
          i32.const 1
          br_if 0
          i64.const 0
          return
        end
        unreachable
      )

It generates machine code for x86_64:

   0:   40 55                   push    rbp
   2:   48 89 e5                mov rbp, rsp
   5:   40 b8 01 00 00 00       mov eax, 1
   b:   40 85 c0                test    eax, eax
   e:   75 09                   jne 0x19
  10:   40 b8 00 00 00 00       mov eax, 0
  16:   40 5d                   pop rbp
  18:   c3                      ret
  19:   0f 0b                   ud2

The generated FDE looks like:

The issue we are having is with stack traces below first function exit, due to FDE restructuring frame info for ret, though not restoring it back for ud2.

view this post on Zulip GitHub (Feb 02 2020 at 06:45):

yurydelendik edited Issue #1372:

Based on https://github.com/bytecodealliance/wasmtime/issues/841

The following wasm function has multiple exits:

      (func $test_conditional_panic (result i64)
        block
          i32.const 1
          br_if 0
          i64.const 0
          return
        end
        unreachable
      )

It generates machine code for x86_64:

   0:   40 55                   push    rbp
   2:   48 89 e5                mov rbp, rsp
   5:   40 b8 01 00 00 00       mov eax, 1
   b:   40 85 c0                test    eax, eax
   e:   75 09                   jne 0x19
  10:   40 b8 00 00 00 00       mov eax, 0
  16:   40 5d                   pop rbp
  18:   c3                      ret
  19:   0f 0b                   ud2

The generated FDE looks like:

The issue we are having is with stack traces below first function exit -- the FDE does not restore initial state after the ret for other block/branch (in our caseud2).

view this post on Zulip GitHub (Feb 03 2020 at 22:08):

iximeow closed Issue #1372:

Based on https://github.com/bytecodealliance/wasmtime/issues/841

The following wasm function has multiple exits:

      (func $test_conditional_panic (result i64)
        block
          i32.const 1
          br_if 0
          i64.const 0
          return
        end
        unreachable
      )

It generates machine code for x86_64:

   0:   40 55                   push    rbp
   2:   48 89 e5                mov rbp, rsp
   5:   40 b8 01 00 00 00       mov eax, 1
   b:   40 85 c0                test    eax, eax
   e:   75 09                   jne 0x19
  10:   40 b8 00 00 00 00       mov eax, 0
  16:   40 5d                   pop rbp
  18:   c3                      ret
  19:   0f 0b                   ud2

The generated FDE looks like:

The issue we are having is with stack traces below first function exit -- the FDE does not restore initial state after the ret for other block/branch (in our caseud2).


Last updated: Nov 22 2024 at 16:03 UTC