diff options
| author | bors <bors@rust-lang.org> | 2022-09-14 20:52:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-14 20:52:18 +0000 |
| commit | 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c (patch) | |
| tree | 7bf8cc781ba87724f62489ff4479b09044794813 /compiler/rustc_ty_utils/src | |
| parent | 6153d3cbe6abc74fb37e4ebe48cc825484fd6bbf (diff) | |
| parent | bfc4f2e189dd1929086b31a7502a2b39e4797770 (diff) | |
| download | rust-750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.tar.gz rust-750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.zip | |
Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot
make `mk_attr_id` part of `ParseSess` Updates #48685 The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment. This PR refers to the task list in #48685, uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`. `AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique. cc `@cjgillot`
Diffstat (limited to 'compiler/rustc_ty_utils/src')
0 files changed, 0 insertions, 0 deletions
