-
Notifications
You must be signed in to change notification settings - Fork 4
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
null analysis #2
Comments
I've had a first go at this and I think it can be done using two mir dataflow passes and a bit of graph work at the end |
That's very nice! |
My impression is that precise null check/fix is hard on languages like C or Java, because of unrestricted aliasing. But maybe we don't need that precision: any transformations that lead to less |
Null analysis is almost done now. There is not yet a way of inferring the function return place nullability, because the analysis works backwards and return places are not accessed after assignment. I have a plan for how to infer return place results using inter function analysis though. I think there are also some cases causing panics that I need to look at. |
I think that the aliasing problem is almost not relevant because we infer results based on pointer usage, and it will be very rare for a new aliasing pointer to be created but not used. |
It would be good to avoid wrapping every pointer in
Option
unless the C side had explicit null checks or assignments. The checks are currently represented as.is_null()
, but none of our benchmarks seem to contain any null assignments. A naive way of doing it might be easy to implement, but to be rigorous we'd need to consider control flow to catch cases like this:here, p could be null at the start of the function, but we can show that it isn't null when it's returned, so it's best to conclude that this function can't return null. It seems likely to me that SSA would help with this. I'll have a go at implementing this, but any thoughts on it are welcome
The text was updated successfully, but these errors were encountered: