-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rename InternedString to LocalInternedString and introduce a new thread-safe InternedString #49894
Conversation
e1ffa3d
to
5e2f9e4
Compare
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
5e2f9e4
to
afe29cb
Compare
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
78792f6
to
1154d18
Compare
Why this distinction is necessary? When one should use I planned to get rid of |
Pick
You can still get rid of the introduced |
I've just noticed that string interner is no longer thread local and every access through |
@petrochenkov We can replace everything with |
Actually, now I understand even less. If the interner is global under a lock, then string contents live effectively forever once interned and can be accessed from all threads, then why |
I'm also somewhat confused in general about the design of The negative there is that the size of This might be best to discuss elsewhere, but it's also confusing to me why we make |
☔ The latest upstream changes (presumably #49718) made this pull request unmergeable. Please resolve the merge conflicts. |
We do not want to leak strings. The idea of
|
ed7382b
to
f71ad99
Compare
Yet isn't that basically a requirement for today's implementation? "This accesses the thread-local interner in order to get to the string." is the comment on It seems to me that long-term |
e39e15a
to
63e5b05
Compare
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
No. The requirement is that the interner outlives any threads using
It never frees strings until it is dropped, then all the strings are freed. I changed this comment to make it clearer.
I'm not sure what your point is there, but the comment is incorrect since we the interner is no longer thread-local. I removed that. |
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Ah, I think I understand now. I believe the root of my confusion came from the fact that without parallel queries being enabled, neither In order for this to be fine with parallel queries, I believe the Interner must live globally (not per-thread); is that an accurate representation of the code today? Otherwise as far as I can tell a |
3c87be0
to
10b1de6
Compare
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #50228) made this pull request unmergeable. Please resolve the merge conflicts. |
e591439
to
ce387b8
Compare
@bors r=michaelwoerister |
📌 Commit ce387b8 has been approved by |
…ad-safe InternedString
ce387b8
to
4d52751
Compare
@bors r=michaelwoerister |
📌 Commit 4d52751 has been approved by |
…woerister Rename InternedString to LocalInternedString and introduce a new thread-safe InternedString This is an allocation-free alternative to rust-lang#46972.
Rollup of 7 pull requests Successful merges: - #49707 (Add "the Rustc book") - #50222 (Bump bootstrap compiler to 2018-04-24) - #50227 (Fix ICE with erroneous `impl Trait` in a trait impl) - #50229 (Add setting to go to item if there is only one result) - #50231 (Add more doc aliases) - #50246 (Make dump_{alloc,allocs,local}() no-ops when tracing is disabled.) - #49894 (Rename InternedString to LocalInternedString and introduce a new thread-safe InternedString) Failed merges:
/// Represents a string stored in the string interner | ||
#[derive(Clone, Copy, Eq)] | ||
pub struct InternedString { | ||
symbol: Symbol, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this PR too late, but wish this was named SymbolContents
instead of InternedString
, since AFAICT all it does is it changes the behavior of comparison / hashing / etc. to act on the string value inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect Symbol
to contain SymbolContents
and not the other way around =P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SymbolAsStr
? I mean, I want the type to evoke "this is a Symbol
made to look like the string contents thereof".
This is an allocation-free alternative to #46972.
cc @rust-lang/compiler
r? @michaelwoerister