-
Notifications
You must be signed in to change notification settings - Fork 188
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
Lambda-lifting: ensure that functions are move to a more appropriate place #1360
Conversation
Can you explain a bit why the change fixes the issue ? |
Maybe we should update the graph in |
Without this change, a block can be added at the beginning of the code (in particular for a standalone program):
This branch is turned into a function call to a function containing basically the whole code, which is not inlined since it is so large. With a baseline of 1, functions are lifted outside of this large function. One could have set a baseline of 2 instead. But with this change, functions are always lifted to the same position. |
The benchmarks are so small that no lambda lifting is performed. Maybe I should add something in the documentation about the code size increase for large programs? |
I didn't realize we'were performing cps for every Branch. Couldn't we skip the transformation when there is not call and there is only one edge to the continuation ?
make -C benchmarks copy-extra-bc should give you bigger programs. |
I'm working on it... Because of inlining, this is not really a problem.
I have updated the manual with these programs. |
This ensures that lambda lifting moves function to a more appropriate level.
You haven't updated size-effects.png |
Indeed! Thanks! This is done, now. |
Functions are moved too high by lambda lifting, adding a huge number of parameters. This has a significant impact on code size.
This change ensures that lambda lifting moves function to a more appropriate level, which does not depend on compiling options.
With this change, the code generated for the Ocisgen Start demo is 55% larger (instead of 80% larger). And when compressed with
bzip2
this code is only 4% larger (instead of 26% larger).This is a temporary fix. A more robust solution will be to avoid a CPS transformation of the code at toplevel, which is not necessary since we know that it is not within an effect handler.