Skip to content

Tail recursion optimization not trapping #150

@jcbeyler

Description

@jcbeyler

In the fac.wast there is an assert_trap:

(assert_trap (invoke "fac-rec" (i64.const 1073741824)) "runtime: callstack exhausted")

However, in my wasm-to-llvm-prototype code, LLVM removes the tail recursion and therefore this no longer traps.

Now I've seen here and there some comments about testing that we are not optimizing things away. So my first question relates directly to this test:

  • Are we not going to allow that the Wasm compiler performs optimizations such as tail recursion if it wants to?
    • Is that true only for Web browser case or also the AOT case?
  • What about the other tests then? Should we not allow the compiler to optimize things away if possible?
    • If for testing purposes, we could perhaps flag the module in a way to say: don't optimize this, we are testing something and, without that flag, be able to optimize away...

Ps: now that we have the awesome mirror: https://github.com/WebAssembly/testsuite; should these questions go there or is it simpler to keep them here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions