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
librustc: WIP for write barriers #4454
Conversation
This seems like the right approach to me. As for the write barriers, that's a good question. I had always imagined that trans would compute where they are needed but I guess there's some computation involved, so perhaps it's best to put that into the I imagine that to actually implement the write barriers you might want to use a similar table to the rooting table, since you will have to insert the write barriers potentially on auto-derefs of intermediate expressions. So if someone wrote:
then the write barrier at (1) would have to check |
Here's some more code. There is currently a problem whereby basic blocks are appended to after termination, preventing self-hosting—I need to work that out before this is done. However, the test case works. |
This implements enough to get |
r+ This looks pretty good. As I wrote in the comments, I think the current modifications to I notice there seems to be no tests for write barriers. I think you should add some tests that freeze an |
r- but pretty close: this is unsound unless you loan out Question: Are there run-fail tests corresponding to the various write-guard failures that can take place? I feel like in general there are a host of new tests that should be added but I guess I have to step back and review what's there. Oh, and one nit: I personally would prefer if the tests that are testing the borrow checker have a name like |
One other thing---can you add the paragraph I wrote explaining why re_free is sound as the scope of a loan as a comment on the relevant bit of code where you had the "XXX"? |
…`&mut` loanable to `&`.
r+, but can you add a compile-fail test like the following and also mention its name in the comment about loans with scope
|
This landed, yes? Close if so. |
Not yet. |
This is a preliminary review only—do not pull!
r? @nikomatsakis. I'd like to know whether you feel this is on the right track. This includes the dynamic component to the
@mut
→&imm
borrow only and not the write barriers. I'd like to get your opinion as to the best way to implement the write barriers—another pass that usesmem_categorization
perhaps?