-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Transition to salsa coarse-grained tracked structs #15763
Changes from all commits
65d1daa
0d69307
640dc52
645eef6
1dfe37d
ba377f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,20 +5,20 @@ use crate::db::Db; | |
use crate::semantic_index::expression::Expression; | ||
use crate::semantic_index::symbol::{FileScopeId, ScopeId}; | ||
|
||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] | ||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, salsa::Update)] | ||
pub(crate) struct Constraint<'db> { | ||
pub(crate) node: ConstraintNode<'db>, | ||
pub(crate) is_positive: bool, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] | ||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, salsa::Update)] | ||
pub(crate) enum ConstraintNode<'db> { | ||
Expression(Expression<'db>), | ||
Pattern(PatternConstraint<'db>), | ||
} | ||
|
||
/// Pattern kinds for which we support type narrowing and/or static visibility analysis. | ||
#[derive(Debug, Clone, Hash, PartialEq)] | ||
#[derive(Debug, Clone, Hash, PartialEq, salsa::Update)] | ||
pub(crate) enum PatternConstraintKind<'db> { | ||
Singleton(Singleton, Option<Expression<'db>>), | ||
Value(Expression<'db>, Option<Expression<'db>>), | ||
|
@@ -28,21 +28,15 @@ pub(crate) enum PatternConstraintKind<'db> { | |
|
||
#[salsa::tracked] | ||
pub(crate) struct PatternConstraint<'db> { | ||
#[id] | ||
pub(crate) file: File, | ||
|
||
#[id] | ||
pub(crate) file_scope: FileScopeId, | ||
|
||
#[no_eq] | ||
#[return_ref] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
pub(crate) subject: Expression<'db>, | ||
|
||
#[no_eq] | ||
#[return_ref] | ||
pub(crate) kind: PatternConstraintKind<'db>, | ||
|
||
#[no_eq] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Countme's |
||
count: countme::Count<PatternConstraint<'static>>, | ||
} | ||
|
||
|
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.
What is the relationship of this change to the rest of the PR?
Could we do this today in main, independently of the tracked-struct changes? And if we did, how much of the perf win of this PR would come with it?
(Not really suggesting we need to split it out, just trying to understand this change and its perf impact better.)
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.
We could probably revert this change now that
AstNodeRef
fields aretracked
again. Let me try tomorrow.I don't think changing the implementation on main would lead to a performance improvement because all
AstNodeRef
fields are marked withno_eq
and are never marked asid
(they're never hashed). That means this implementation should be mostly unused today.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.
It looks like you decided not to revert this change? Anything worth documenting about why?