-
-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JumpIfFalse
skips over PopEnvironment
instruction
#2424
Comments
On closer inspection even this code reproduces this type of bug: while (true) {
break;
} Compiled and trace output
We can see that it never calls the So the problem seems to be the way we handle |
So I was playing around with this and I think it may have something to do with how the Below is the trace for
There seems to be a |
boa/boa_engine/src/bytecompiler/mod.rs Line 2181 in fdac8ec
The problem is here where we handle The initial way I would solve this is by adding a If you have a better approach I'd be happy to hear :) |
I was sort of thinking that it was an issue with handling I hesitated earlier today when taking a look at this because I wasn't sure whether we want block to be adding a |
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> Hi all! 😄 This Pull Request addresses #2424. There are also a few changes made to the `ByteCompiler`, the majority of which are involving `JumpControlInfo`. It changes the following: - Adds `Break` Opcode - Shifts `compile_stmt` into the `statement` module. - Moves `JumpControlInfo` to it's own module.
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel necessary. ---> Hi all! 😄 This Pull Request addresses #2424. There are also a few changes made to the `ByteCompiler`, the majority of which are involving `JumpControlInfo`. It changes the following: - Adds `Break` Opcode - Shifts `compile_stmt` into the `statement` module. - Moves `JumpControlInfo` to it's own module.
Describe the bug
We do not handle pushing and popping of environments correctly in the bytecompiler.
To Reproduce
The following instructions are generated:
Actual behavior
The
0038
:JumpIfFalse
instruction is jumping to instruction58
, skipping the0057
:PopEnvironment
, and the plain0073
:Jump
also skips it by jumping to the end of the function.Expected behavior
The
PopEnvironment
instruction should be executed.Build environment (please complete the following information):
Additional context
Here is the flow graphs generated by #2422 :
We can see that there is a
PopEnvironment
that is never executed (since there is nothing that flows into it).The text was updated successfully, but these errors were encountered: