-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
cgen: add codegen for auto free methods for interface type #22555
cgen: add codegen for auto free methods for interface type #22555
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work.
@@ -0,0 +1,7 @@ | |||
void main__IFoo_free(main__IFoo* it) { | |||
if (it->_typ == _main__IFoo_main__Foo_index) { main__Foo_free(it->_main__Foo); return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also generate it->_main__Foo = NULL;
right after the free call, before the return.
That will make use after frees easier to detect, and simplify the work of the mark stage of the GC, if used in combination with -autofree.
Fix #22074