boa
boa copied to clipboard
Some Test262 tests can cause a stack overflow
Describe the bug We are ignoring some Test262 tests because they cause a stack overflow in Boa. Here is the full list:
-
test/language/expressions/tagged-template/tco-call.js
-
test/language/expressions/tagged-template/tco-member.js
To Reproduce
You can reproduce the behaviour by running the following command, after removing them from the test_ignore.txt
file:
cargo run --release --bin boa_tester -- run -s {test_path}
Expected behavior The expected behaviour is, obviously, for them not to overflow the stack.
Loaded test/language/expressions/tagged-template/tco-call.js
into a debugger and got an exception during eval of EXC_BAD_ACCESS(code=2, address=...)
, seems to occur at a memory copy of some variety, will continue stepping through to work through it.
EDIT: The specific testcases mentioned create 7000 stack frames, compared to most testcases only having 20 stack frames.
Also, the specific cases seem to recurse into runs and call procedures that nests to this stack frame depth, with the sequence of 3 run
stack frames at mod.rs
108:23 315:37 114:27 , followed by 2 call
stack frames at context.rs
320:42 and gcobject.rs
327:9, followed by a call_construct
stack frame at gcobject.rs
300:30. Seems to be a recursive loop involving these calls... No idea which mod.rs it's referring to in LLDB, but any help would be appreciated.
This could be resolved by #1323 ?
I will try to give it a look in a couple of days, but something that can be tried is to see if the issue is in the parsing time or in the execution time, that would help a lot.
You can also try to extract a minimum example, especially if the issue is when parsing, and try to get all lexed tokens, to see if they make sense, by running the "boa" binary as mentioned in "DEBUGGING.md"
Actually, ended up actually reading up on the feature the testcase is testing, it's tail-call optimisation, and explains why the number of stack frames is so large, i.e. this optimisation would need to be implemented on Boa's side to fix both of these from overflowing.
@HalidOdat this got fixed by #2904 right?
Yes, The tests no longer cause stack overflows, because a RuntimeLimit
is thrown.
So we can close this issue :)