Resolver: Wrap arenas in WorkerLocal#159019
Conversation
This comment has been minimized.
This comment has been minimized.
| let prefix = Segment::names_to_string(&prefix); | ||
| self.r.dcx().span_err( | ||
| use_tree.span(), | ||
| format!("cannot resolve a prelude import `{prefix}`: {path_res:?}"), |
There was a problem hiding this comment.
There's a CI failure due to this change.
Also {path_res:?} is leaking internal debug output into a user-visible message.
| let key = | ||
| BindingKey::new_disambiguated(ident, ns, || (child_index + 1).try_into().unwrap()); | ||
| if resolutions | ||
| .entry(key) |
There was a problem hiding this comment.
Can use insert here, we are always adding a new entry, there's a span_bug check for this below.
| .entry(key) | ||
| .or_insert_with(|| self.arenas.alloc_name_resolution(orig_ident_span)) | ||
| .borrow_mut_unchecked() // only 1 thread builds extern tables | ||
| .non_glob_decl |
There was a problem hiding this comment.
non_glob_decl can be set immediately after the resolution is created with alloc_name_resolution.
And if we hand-roll alloc_name_resolution we can even avoid borrow_mut_unchecked here.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Resolver: Wrap arenas in `WorkerLocal`
|
The PR description needs an update, it's not only about arenas. |
|
Reminder, once the PR becomes ready for a review, use |
…l import resolution.
4e7b0b3 to
3f0bbad
Compare
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8921b29): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.9%, secondary 1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary -3.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.147s -> 488.199s (-0.19%) |
In preperation of parallel import resolution #158845 this pr wraps the resolver arenas in
WorkerLocalto ensure we don't need any synchronization to access an arena. This is common in the compiler.r? @petrochenkov