-
-
Notifications
You must be signed in to change notification settings - Fork 670
Consider NaN falseish #933
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
Conversation
LGTM |
Last commit also eliminates |
Last commit makes |
I think this problem need solve via enhancing inlining limits. Yes we could improve |
It's slightly more efficient than |
Found one missing part. When we have casting from float to boolean like: function cast(x: f64): bool {
return bool(x);
} it becomes: return x != 0; without |
Hmm, yeah, that's odd. Not sure what you mean with |
Oh, mean it just should generate same code |
Oh no, I spot a temporary local there. But yeah, guess this can't be avoided :) |
fixes #770
fixes #787
This is mostly identical to #787 but also removes some internal patterns prone to errors when dealing with temporary locals as it was hard to grasp if code would "just work" otherwise.
In particular, flows had a
getAndFreeTempLocal
helper that immediately free'd a local intended for one-time use, which can lead to subtle errors where sub-expressions might reuse the same local. Hence I decided that even if code looks more cumbersome without it, that it's worth to require holding on to a temp as long as anothermake*
function might reuse the same, so it's pretty much guaranteed that even if we update codegen in between agetTempLocal
and afreeTempLocal
in the future the resulting code will keep working.I've also looked over all the occurrences of
makeIsFalseish
andmakeIsTrueish
which all seem to be fine, adding the local to the flow being responsible. The notable ones here are those of anythingif
-like where the condition temp locals go to the outer instead of one of the inner flows.cc @MaxGraey