-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
🛠 use interned refs to goals/clauses instead of boxes #49054
Comments
Some notes: The interners are defined in two places. First off, there is the rust/src/librustc/ty/context.rs Lines 96 to 110 in 4bf76d6
This contexts global data -- notably, these use rust/src/librustc/ty/context.rs Lines 127 to 141 in 4bf76d6
For these, all memory is stored in one The actual allocation is done in functions on the tcx. One example is
The rust/src/librustc/ty/context.rs Lines 1841 to 1842 in 4bf76d6
It compares and hashes its contents deeply, and it implements rust/src/librustc/ty/context.rs Line 1859 in 4bf76d6
I think a good example case to use for Line 943 in 4bf76d6
Then add a map to rust/src/librustc/ty/context.rs Line 137 in 4bf76d6
Implement rust/src/librustc/ty/context.rs Lines 1898 to 1902 in 4bf76d6
and add an entry to this rust/src/librustc/ty/context.rs Lines 1998 to 2006 in 4bf76d6
That macro is a bit weird but it implements the "intern-in-global-tcx-else-local-tcx" pattern described above. You would probably want something like:
rust/src/librustc/ty/context.rs Lines 1994 to 1996 in 4bf76d6
One complication is that rust/src/librustc/traits/mod.rs Line 284 in 4bf76d6
That has a dtor, so we would want to translate it to use a "slice interner", which will intern a slice of items like rust/src/librustc/ty/context.rs Lines 2017 to 2022 in 4bf76d6
|
Two questions:
|
traits: Implement interning for Goal and Clause r? @nikomatsakis Close #49054 Contains some refactoring for the interning mechanism, mainly aimed at reducing pain when changing types of interning map. This should be mostly good, although I'm not sure with the naming of `Goal::from_poly_domain_goal`.
In #48985, @scalexm added types for goals/clauses to use in the experimental lowering. That code used a
Box
to enable recursion. The typical thing for us to do is to use interning, as described briefly in this comment. There are FIXMEs in the code.The text was updated successfully, but these errors were encountered: