diff options
author | Alon Zakai <azakai@google.com> | 2019-06-04 15:22:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-04 15:22:31 -0700 |
commit | 917fabf8fb8c2efbfadc608efa79c0937830ce10 (patch) | |
tree | be28d1217ce74f919ce06b749b493e674342ab10 | |
parent | 14e09685f1994327dec5aec3a7fd5349696600af (diff) | |
download | binaryen-917fabf8fb8c2efbfadc608efa79c0937830ce10.tar.gz binaryen-917fabf8fb8c2efbfadc608efa79c0937830ce10.tar.bz2 binaryen-917fabf8fb8c2efbfadc608efa79c0937830ce10.zip |
Reduce interpreter recursion limit (#2162)
This should be small enough to work in a 512K stack on Linux, which may then be small enough to work on all common OSes.
I had to update some spec tests which actually did more recursive calls, but I don't think the change reduces any relevant amount of test coverage.
This may fix the Mac bot finally, as with this it passes for me on the stack size I think Macs have by default.
-rw-r--r-- | src/wasm-interpreter.h | 2 | ||||
-rw-r--r-- | test/spec/call.wast | 8 | ||||
-rw-r--r-- | test/spec/call_indirect.wast | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 7dd9688c3..ca9b35bab 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -45,7 +45,7 @@ using namespace cashew; extern Name WASM, RETURN_FLOW; -enum { maxInterpreterDepth = 250 }; +enum { maxInterpreterDepth = 50 }; // Stuff that flows around during executing expressions: a literal, or a change // in control flow. diff --git a/test/spec/call.wast b/test/spec/call.wast index 83bc2abde..00bd97397 100644 --- a/test/spec/call.wast +++ b/test/spec/call.wast @@ -134,12 +134,12 @@ (assert_return (invoke "even" (i64.const 0)) (i32.const 44)) (assert_return (invoke "even" (i64.const 1)) (i32.const 99)) -(assert_return (invoke "even" (i64.const 100)) (i32.const 44)) -(assert_return (invoke "even" (i64.const 77)) (i32.const 99)) +(assert_return (invoke "even" (i64.const 10)) (i32.const 44)) +(assert_return (invoke "even" (i64.const 7)) (i32.const 99)) (assert_return (invoke "odd" (i64.const 0)) (i32.const 99)) (assert_return (invoke "odd" (i64.const 1)) (i32.const 44)) -(assert_return (invoke "odd" (i64.const 200)) (i32.const 99)) -(assert_return (invoke "odd" (i64.const 77)) (i32.const 44)) +(assert_return (invoke "odd" (i64.const 20)) (i32.const 99)) +(assert_return (invoke "odd" (i64.const 7)) (i32.const 44)) (assert_trap (invoke "runaway") "call stack exhausted") (assert_trap (invoke "mutual-runaway") "call stack exhausted") diff --git a/test/spec/call_indirect.wast b/test/spec/call_indirect.wast index 7394be5a3..41f4316f6 100644 --- a/test/spec/call_indirect.wast +++ b/test/spec/call_indirect.wast @@ -212,12 +212,12 @@ (assert_return (invoke "even" (i32.const 0)) (i32.const 44)) (assert_return (invoke "even" (i32.const 1)) (i32.const 99)) -(assert_return (invoke "even" (i32.const 100)) (i32.const 44)) -(assert_return (invoke "even" (i32.const 77)) (i32.const 99)) +(assert_return (invoke "even" (i32.const 10)) (i32.const 44)) +(assert_return (invoke "even" (i32.const 7)) (i32.const 99)) (assert_return (invoke "odd" (i32.const 0)) (i32.const 99)) (assert_return (invoke "odd" (i32.const 1)) (i32.const 44)) -(assert_return (invoke "odd" (i32.const 200)) (i32.const 99)) -(assert_return (invoke "odd" (i32.const 77)) (i32.const 44)) +(assert_return (invoke "odd" (i32.const 20)) (i32.const 99)) +(assert_return (invoke "odd" (i32.const 7)) (i32.const 44)) (assert_trap (invoke "runaway") "call stack exhausted") (assert_trap (invoke "mutual-runaway") "call stack exhausted") |