Use a separate interner type for UniqueTypeId
Using symbol::Interner makes it very easy to mixup UniqueTypeId symbols with the global interner. In fact the Debug implementation of UniqueTypeId did exactly this. Using a separate interner type also avoids prefilling the interner with unused symbols and allow for optimizing the symbol interner for parallel access without negatively affecting the single threaded module codegen.
This commit is contained in:
parent
c7dbe7a830
commit
8c7840e8cb
5 changed files with 61 additions and 11 deletions
|
@ -1701,8 +1701,11 @@ impl<CTX> ToStableHashKey<CTX> for Symbol {
|
|||
// The `FxHashMap`+`Vec` pair could be replaced by `FxIndexSet`, but #75278
|
||||
// found that to regress performance up to 2% in some cases. This might be
|
||||
// revisited after further improvements to `indexmap`.
|
||||
//
|
||||
// This type is private to prevent accidentally constructing more than one `Interner` on the same
|
||||
// thread, which makes it easy to mixup `Symbol`s between `Interner`s.
|
||||
#[derive(Default)]
|
||||
pub struct Interner {
|
||||
pub(crate) struct Interner {
|
||||
arena: DroplessArena,
|
||||
names: FxHashMap<&'static str, Symbol>,
|
||||
strings: Vec<&'static str>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue