-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Implements fully working hierarchical lexical scopes. #6784
base: master
Are you sure you want to change the base?
Conversation
920ca89
to
aaed7cc
Compare
CodSpeed Performance ReportMerging #6784 will degrade performances by 58.21%Comparing Summary
Benchmarks breakdown
|
c5f0f07
to
62fd6dd
Compare
@@ -36,14 +36,14 @@ impl ResolvedFunctionDecl { | |||
} | |||
} | |||
|
|||
pub(super) type SymbolMap = im::OrdMap<Ident, ResolvedDeclaration>; | |||
pub(super) type SymbolUniqueMap = im::OrdMap<IdentUnique, ResolvedDeclaration>; | |||
pub(super) type SymbolMap = HashMap<Ident, ResolvedDeclaration>; |
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.
Is HashMap here fine?
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 should be fine because we are sorting each iterator before using them.
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.
You should add a comment that justifies the usage here I think.
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.
I tried to use OrdMap but it introduces a significant performance drop:
Benchmark | master |
esdrubal/hierarchical_lexical_scopes |
Change | |
---|---|---|---|---|
❌ | compile |
5.3 s | 8.1 s | -34.4% |
792e419
to
8d57419
Compare
90c1d89
to
f2f0b31
Compare
unreachable!(); | ||
}; | ||
|
||
ctx.insert_trait_implementation( |
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.
Can you add a comment explaining why this is now necessary?
@@ -379,6 +416,14 @@ impl Module { | |||
}) | |||
.collect::<Vec<_>>() | |||
} | |||
|
|||
pub fn get_impl_spans_for_decl(&self, engines: &Engines, ty_decl: &TyDecl) -> Vec<Span> { |
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.
Wondering if we should move this to some other file.
…on_ctx.namespace lexical scopes.
This optimization is now removed from the TraitMAp because it breaks the insert_implementation_for_type of mutable references.
This reverts commit 8d57419.
b18daec
to
c47a31f
Compare
Description
This PR implements the missing elements for the hierarchical lexical scopes.
TypeCheckContext no longer uses cloned namespaces. Instead, we push and pop lexical scopes.
For this to work multiple places that used current_items now either use root_items or traverse the lexical scopes.
Checklist
Breaking*
orNew Feature
labels where relevant.