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. |
move our data structures into a central location
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→&immborrow 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_categorizationperhaps?