Skip to content

Validation and inlining don't work together #331

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

Closed
oli-obk opened this issue Sep 6, 2017 · 5 comments
Closed

Validation and inlining don't work together #331

oli-obk opened this issue Sep 6, 2017 · 5 comments

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Sep 6, 2017

I'm not sure what the exact issues are, but we should get them to work

@RalfJung
Copy link
Member

RalfJung commented Sep 6, 2017

There are some conceptual issues -- validation relies on all locks being released when the function returns, which does not happen after inlining. After inlining, the locks acquired by the "outer" and "inner" function are not distinguishable, so it is not clear currently how that should even look like.

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 6, 2017

We probably need to either mark the validation statements as inlined and do some logic here, or properly inline validation statements in the inline pass in rustc.

@RalfJung
Copy link
Member

RalfJung commented Sep 6, 2017

The thing is, the statements/model as it is ow can't handle inlining. This needs a conceptual change.

For example, rather than just identifying locks by stack frame number, there could be an additional index differentiating the "outer" and "inner" part of the inlined function. That should make inlining invertible; the resulting program is equivalent to the one before inlining. I am worried however that then validation statements will end up being in the way frequently; we'd have to figure out the rules for reordering them with other things.

Or maybe, the border between the two functions should somehow "disappear". The release and acquire statements around the call should be gone, and same for the acquire statements in the callee. However, I think this will not handle lifetimes inside the callee that outlive the callee properly.

Another option would be to erase validation before doing inlining; however that would probably prevent many useful optimizations that build on validation and are only discoverable after inlining.

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 6, 2017

The release and acquire statements around the call should be gone, and same for the acquire statements in the callee.

That sounds like an approach in the right direction to me

However, I think this will not handle lifetimes inside the callee that outlive the callee properly.

We can rewrite any statements during inlining if we modify the inlining pass.

@RalfJung
Copy link
Member

The validation stuff is going to completely change anyway. Closing this.

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

No branches or pull requests

2 participants