Skip to content

Skip full collection support if all types are acyclic #1071

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

Merged
merged 9 commits into from
Jan 25, 2020
Merged

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Jan 24, 2020

This is an idea recently brought up by @MaxGraey: If we know that all types within the program are inherently acyclic, we do not need to compile the parts of the GC dealing with collecting cyclic garbage.

Reduces the size of generated runtime bits by a few percent in such a scenario.

@dcodeIO dcodeIO changed the title Skip full collecting support if all types are acyclic Skip full collection support if all types are acyclic Jan 24, 2020
@dcodeIO
Copy link
Member Author

dcodeIO commented Jan 24, 2020

Appears there's actually more to this, in that there is also a lot of visitor logic we don't need, but still becomes compiled as part of the catch-all visitor.

@dcodeIO
Copy link
Member Author

dcodeIO commented Jan 24, 2020

That looks a lot better already. There's still appendRoot that we don't need, and also makes me wonder whether this can be done in a better way than using builtins, like by compiling all of the GC after the main program and using a constant.

@dcodeIO
Copy link
Member Author

dcodeIO commented Jan 24, 2020

Last commit introduces the concept of lazy library functions, which become compiled after everything else so the compiler can perform additional checks, like if everything is acyclic, before compiling them. That simplifies the implementation in this case and gets rid of a huge amount of test fixture code, but the amount of code removed is just so ridiculous that I am expecting unforeseen implications.

@dcodeIO
Copy link
Member Author

dcodeIO commented Jan 24, 2020

Last commit targeted a few extra bytes in decrement but interestingly allowed to skip including RTTI in some cases.

@dcodeIO dcodeIO merged commit 79f849a into master Jan 25, 2020
@MaxGraey
Copy link
Member

Great work!

@dcodeIO dcodeIO deleted the skip-collect branch March 15, 2020 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants