Open nikomatsakis opened 4 days ago
Currently 'memo ingredient indices' are a vector; the values in the vector are the fn ingredient indices that would be storing the memo (this should be documented!).
This should be changed into a map of vectors, indexed by the "salsa struct ingredient index" (the ingredient index on which the memo is stored):
/// Map from the [`IngredientIndex`][] of a salsa struct to a list of
/// [ingredient-indices](`IngredientIndex`)for tracked functions that have this salsa struct as input.
memo_ingredient_indices: RwLock<Map<IngredientIndex, Vec<IngredientIndex>>>
then we modify next_memo_ingredient_index
to take the tracked struct ingredient index as an argument
This is called my the various code in salsa-macro-rules, so that will have to be modified to pass in the ingredient index for the salsa struct on which the function is invoked.
We also modify ingredient_index_for_memo
similarly
and change the one caller of that last method:
https://github.com/salsa-rs/salsa/blob/master/src/tracked_struct.rs#L504
to pass in the self.ingredient_index
.
Today every tracked function gets assigned a distinct
MemoIngredientIndex
. These are used to index into the memo table attached to a salsa struct. But every function can be attached to salsa structs of exactly one kind, so indices only have to be distinct per salsa struct, not globally. This would save a lot of space in larger projects.