-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix generating bindings for dead code #8065
Fix generating bindings for dead code #8065
Conversation
This commit fixes a bindgen problem where dead types, which had no generated bindings, could be referred to from other dead types, which did have generated bindings. The fix is to not generate code for dead types at all by fixing how type information is analyzed.
a(live-type), | ||
b(dead-type), | ||
} | ||
} |
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.
Not clear to me how this tests liveness since both interfaces are part of the imports?
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.
Ah good point, I should clarify, liveness is calculated in terms of what's used by imported/exported functions. No function actually uses dead-type
or v
but live-type
is used by a function, and so we don't generate bindings for dead-type
and this PR fixes a bug where we previously tried to generate bindings for v
despite nothing using it.
for (t, _) in resolve.types.iter() { | ||
self.type_id_info(resolve, t); | ||
} |
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.
Does doing this step first mean that the calls to self.type_info
in type_info_func
should never traverse the whole type (due to the early exit if the entry exists already)?
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.
Not for this, but the below bits would still need it for setting the owned/borrowed bits.
It's probably best to switching this to LiveSet
one day as a future refactoring
This commit fixes a bindgen problem where dead types, which had no generated bindings, could be referred to from other dead types, which did have generated bindings. The fix is to not generate code for dead types at all by fixing how type information is analyzed.
Closes #8057