-
Notifications
You must be signed in to change notification settings - Fork 14
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
Optimize Core #267
Optimize Core #267
Conversation
Thanks @fritzladwig for your work again! It might look like I re-implemented everything, but that was much easier after you having implemented it already once. |
@CodiumAI-Agent /review |
PR Analysis
PR Feedback
How to use
|
This PR builds on the work by @fritzladwig and supersedes #206.
It performs (in this order)
return(run(e)) = e
, and so on)It does not implement a static argument transformation. We need to reimplement that later at some point. Ideally on a CPS representation. We should also look into the standard shrinking techniques (https://www.cs.princeton.edu/~appel/papers/shrink.pdf) at that point.
It turned out that the simplifications were "too good" and loops became fully direct style (test: raytracer.effekt). In order to work around this issue in the JS backend, I introduced a new microphase that patches up recursive (non-guarded) function calls by thunking them under a trivial
val _ = return (); recursive()
. In the JS implementation this will cause a frame to be pushed on the monadic trampoline, which effectively makes recursive calls stack safe.