-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Right now TypingMode
has a size of 16 bytes, which, given that we use it a lot of queries and in the global trait solver caches, results in a small, but noticeable perf cost. We should be able to convert it use a tagged pointer instead, copying the impl of GenericArg
struct TypingMode<'tcx> {
ptr: NonNull<()>,
marker: PhantomData<&'tcx ty::List<DefId>>,
}
enum TypingModeKind<'tcx> {
Coherence,
Analysis {
defining_opaque_types: I::DefiningOpaqueTypes,
},
PostAnalysis,
}
impl<'tcx> TypingModeKind<'tcx> {
fn pack(self) -> TypingMode<'tcx> {
match self {
Coherence => TypingMode { ptr: 0x1 },
PostAnalysis => TypingMode { ptr: 0x2 },
Analysis { defining_opaque_types } => TypingMode { ptr: defining_opaque_types },
}
}
}
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.