-
Notifications
You must be signed in to change notification settings - Fork 575
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
Migrated the compiler to per-crate plugin queries #6843
Conversation
f500b20
to
2ff4cac
Compare
2ff4cac
to
362037e
Compare
d7c12d5
to
fc37389
Compare
6c8700c
to
eb2d318
Compare
fc37389
to
d0e9571
Compare
eb2d318
to
f32545e
Compare
d0e9571
to
46919f1
Compare
f32545e
to
32cb0f9
Compare
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.
Reviewable status: 0 of 65 files reviewed, 1 unresolved discussion (waiting on @mkaput, @orizi, and @piotmag769)
a discussion (no related file):
I have two problems here which I am work on now:
- Fallback from "override" to "default" input (e.g.
DefsGroup::default_macro_plugins
andDefsGroup::override_crate_macro_plugins
) is tricky to implement due to the way the input getters are implemented in Salsa: they panic. Sadly, I cannot catch the panic without constraining theDefsGroup
(and, consequently, all its subtraits) toUnwindSafe
. - Tests related to circuits break because the compiler's input has
Tuple<...>
types instead of(...)
structural types.
However, the rest of the stack is ready to be reviewed.
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.
Reviewed 58 of 64 files at r3, all commit messages.
Reviewable status: 58 of 65 files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue, @orizi, and @piotmag769)
a discussion (no related file):
Previously, integraledelebesgue (Jan Smółka) wrote…
I have two problems here which I am work on now:
- Fallback from "override" to "default" input (e.g.
DefsGroup::default_macro_plugins
andDefsGroup::override_crate_macro_plugins
) is tricky to implement due to the way the input getters are implemented in Salsa: they panic. Sadly, I cannot catch the panic without constraining theDefsGroup
(and, consequently, all its subtraits) toUnwindSafe
.- Tests related to circuits break because the compiler's input has
Tuple<...>
types instead of(...)
structural types.However, the rest of the stack is ready to be reviewed.
Ad 1. I believe that's the reason file_overrides
in FilesGroup
are implemented as two queries: one, the parameterless input, keeps an HashMap of FileId -> override
and the other query meant for broad use does the lookup and returns Option
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.
Reviewed 1 of 65 files at r1, 6 of 64 files at r3.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)
crates/cairo-lang-semantic/src/types.rs
line 187 at r3 (raw file):
/// containing it. pub fn is_phantom(&self, db: &dyn SemanticGroup) -> bool { let Some(module_file_id) = self.module_file_id(db) else {
I think this generalization of module_file_id
for any TypeId
is misleading a bit, and not really that useful outside this context. See my other comment down this file for an explanation of how I believe this should work.
crates/cairo-lang-semantic/src/types.rs
line 205 at r3 (raw file):
.iter() .any(|attr| id.has_attr(db, attr).unwrap_or_default()), },
I think this is the place where you should actually look for the crate and its declared phantom type attrs. Here, you know a concrete item that we're interested in, so we can always reliably ask for its crate.
Code quote:
TypeLongId::Concrete(id) => match id {
ConcreteTypeId::Struct(id) => phantom_type_attributes
.iter()
.any(|attr| id.has_attr(db, attr).unwrap_or_default()),
ConcreteTypeId::Enum(id) => phantom_type_attributes
.iter()
.any(|attr| id.has_attr(db, attr).unwrap_or_default()),
ConcreteTypeId::Extern(id) => phantom_type_attributes
.iter()
.any(|attr| id.has_attr(db, attr).unwrap_or_default()),
},
crates/cairo-lang-semantic/src/types.rs
line 208 at r3 (raw file):
TypeLongId::Tuple(inner) => inner.iter().any(|ty| ty.is_phantom(db)), TypeLongId::FixedSizeArray { type_id, .. } => type_id.is_phantom(db), TypeLongId::Snapshot(_)
This is an example where generalized module_file_id
might not be a good idea: we don't need it for snapshots, yet your code attempted to look for something.
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)
32cb0f9
to
c9ee986
Compare
1ef8c32
to
9ab2d39
Compare
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.
Reviewed 6 of 6 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
6802516
to
a8f1876
Compare
9ab2d39
to
4eb5e04
Compare
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.
Reviewed 53 of 53 files at r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
4eb5e04
to
95857cb
Compare
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.
Reviewed 6 of 6 files at r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
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.
Reviewed 2 of 6 files at r8, 47 of 53 files at r9, 6 of 6 files at r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
2fe85ac
to
bce330f
Compare
41ce450
to
6b59e2c
Compare
bce330f
to
7687ef1
Compare
7687ef1
to
709b248
Compare
6b59e2c
to
5158495
Compare
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.
Reviewed 2 of 6 files at r8, 47 of 53 files at r9, 6 of 6 files at r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)
5158495
to
fc2caad
Compare
commit-id:f0989263
fc2caad
to
f931957
Compare
This reverts commit a106b04.
This reverts commit a106b04.
No description provided.