Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix #8558: use Strict bindings when simplifying Lstaticraise #8559
See discussion on #8558.
referenced this pull request
Mar 29, 2019
Thank you very much! My taste for simple fixes is entirely satisfied :-) I promise we'll soon discuss more general Lambda simplifications that would recover whatever efficiency we may be losing here by doing the simple thing.
Would you please add a Changes entry? (in the 4.08 section).
Ok, apologies, I did not realize that the usual optimization in the Alias case (1 occurrence) was also disabled when in "bytecode -g" mode, so the difference between Alias and Strict when the bound expression in a Lvar is only the case where the identifier is unused. I'm not 100% sure this doesn't impact the resulting bytecode (and for, instance, jsoo, for which -g is required to get sourcemaps), but I'm much less worried than I was on Friday with this version.
I believe the bug was only morally present for a long time, since the invariant that arguments of Lstaticraise must be pure did not hold previously (because of pattern matching with exception clauses -- but in this case, the Lstaticraise crosses a try...with and is not simplified). AFAICT, the bug was uncovered by the optimization of local functions in 4.08, and was not present in older versions. I've added the reference to this PR and the original issue to that entry (in 4.08).
Apr 1, 2019
Concerning "simplif" optimizations in general: I share your suspicion that the bug was already there, but never encountered, before the optimization of functions was introduced. And, yes,
FTR, 2 things to be careful with: