Uh oh!
There was an error while loading. Please reload this page.
Work towards thread safety in rustc - #46779
Conversation
rust-highfive
commented
Dec 17, 2017
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
c67d30e to
6b295aaCompareThere was a problem hiding this comment.
Could you please make the interner thread-safe?
Zoxc
commented
Dec 17, 2017
@bjorn3 Thread-safety for the interners happens in a later commit. |
bjorn3
commented
Dec 17, 2017
@Zoxc that commit doesnt seem to be included in this pr. |
Zoxc
commented
Dec 17, 2017
It is in #45912. |
michaelwoerister
commented
Dec 18, 2017
Each PR must leave the compiler in safe/valid state. Implementing |
Zoxc
commented
Dec 18, 2017
@michaelwoerister The |
michaelwoerister
commented
Dec 18, 2017
My concern is just that this PR, as it is, would leave the compiler in a state where I can send |
There was a problem hiding this comment.
err_count probably needs to be done in a smarter way than here to assure thread-safety, so could you add a FIXME? In any case this is better than the way before this.
There was a problem hiding this comment.
In which case is this not thread safe?
There was a problem hiding this comment.
Don't we need a better locking discipline for the codemap? It feels like "too many locks, not enough discipline". Maybe just add a fixme to it?
There was a problem hiding this comment.
Given that I just convert all RefCells into locks, there's probably plenty of places where there are too many locks.
There was a problem hiding this comment.
Oh, InternedString storing a &'static str isn't sound at all. I'll have to change it to using a u32 like Symbol.
There was a problem hiding this comment.
Well that made it unable to implement Deref<Target=str>, so I went with the approach suggested in a FIXME and just leak interned strings.
6b295aa to
dbee5b9Comparedbee5b9 to
84ce4f1CompareZoxc
commented
Dec 21, 2017
@bors r=arielb1 |
bors
commented
Dec 21, 2017
📌 Commit 84ce4f1 has been approved by |
bors
commented
Dec 22, 2017
Work towards thread safety in rustc This PR is split out from #45912. It contains changes which do not require the `sync` module.
bors
commented
Dec 22, 2017
☀️ Test successful - status-appveyor, status-travis |
| slot.set(r + 1); | ||
| r | ||
| }); | ||
| let id = NEXT_ATTR_ID.fetch_add(1, Ordering::SeqCst); |
There was a problem hiding this comment.
@rust-lang/compiler Not sure how I feel about this kind of stuff - it will behave non-deterministically in any process running multiple rustc threads in parallel (atm rustc "owns" a thread).
IMO all thread-locals should change to scoped thread locals initialized to point to some memory owned by the thread that started the compilation, if we want multiple threads per rustc "instance".
There was a problem hiding this comment.
Good point. I'll make this either a scoped thread local or put it in ParseSess if that happens to be easy.
This PR is split out from #45912. It contains changes which do not require the
syncmodule.