@@ -68,7 +68,6 @@ macro_rules! setup_tracked_fn {
68
68
$Configuration: ident,
69
69
$InternedData: ident,
70
70
$FN_CACHE: ident,
71
- $INTERN_CACHE: ident,
72
71
$inner: ident,
73
72
]
74
73
) => {
@@ -100,9 +99,6 @@ macro_rules! setup_tracked_fn {
100
99
std:: marker:: PhantomData <& $db_lt $zalsa:: interned:: Value <$Configuration>>,
101
100
) ;
102
101
103
- static $INTERN_CACHE: $zalsa:: IngredientCache <$zalsa:: interned:: IngredientImpl <$Configuration>> =
104
- $zalsa:: IngredientCache :: new( ) ;
105
-
106
102
impl $zalsa:: SalsaStructInDb for $InternedData<' _> {
107
103
type MemoIngredientMap = $zalsa:: MemoIngredientSingletonIndex ;
108
104
@@ -144,9 +140,10 @@ macro_rules! setup_tracked_fn {
144
140
145
141
impl $Configuration {
146
142
fn fn_ingredient( db: & dyn $Db) -> & $zalsa:: function:: IngredientImpl <$Configuration> {
147
- $FN_CACHE. get_or_create( db. as_dyn_database( ) , || {
143
+ let zalsa = db. zalsa( ) ;
144
+ $FN_CACHE. get_or_create( zalsa, || {
148
145
<dyn $Db as $Db>:: zalsa_register_downcaster( db) ;
149
- db . zalsa( ) . add_or_lookup_jar_by_type:: <$Configuration>( )
146
+ zalsa. add_or_lookup_jar_by_type:: <$Configuration>( )
150
147
} )
151
148
}
152
149
@@ -162,10 +159,12 @@ macro_rules! setup_tracked_fn {
162
159
fn intern_ingredient(
163
160
db: & dyn $Db,
164
161
) -> & $zalsa:: interned:: IngredientImpl <$Configuration> {
165
- $INTERN_CACHE. get_or_create( db. as_dyn_database( ) , || {
162
+ let zalsa = db. zalsa( ) ;
163
+ let index = $FN_CACHE. get_or_create_index( zalsa, || {
166
164
<dyn $Db as $Db>:: zalsa_register_downcaster( db) ;
167
- db. zalsa( ) . add_or_lookup_jar_by_type:: <$Configuration>( ) . successor( 0 )
168
- } )
165
+ db. zalsa( ) . add_or_lookup_jar_by_type:: <$Configuration>( )
166
+ } ) . successor( 0 ) ;
167
+ zalsa. lookup_ingredient( index) . assert_type( )
169
168
}
170
169
}
171
170
}
@@ -217,12 +216,13 @@ macro_rules! setup_tracked_fn {
217
216
$( $cycle_recovery_fn) * ( db, value, count, $( $input_id) ,* )
218
217
}
219
218
220
- fn id_to_input<$db_lt>( db: & $db_lt Self :: DbView , key: salsa:: Id ) -> Self :: Input <$db_lt> {
219
+ #[ inline]
220
+ fn id_to_input<$db_lt>( db: & $db_lt Self :: DbView , zalsa: & $db_lt $zalsa:: Zalsa , key: salsa:: Id ) -> Self :: Input <$db_lt> {
221
221
$zalsa:: macro_if! {
222
222
if $needs_interner {
223
- $Configuration:: intern_ingredient( db) . data ( db . as_dyn_database ( ) , key) . clone( )
223
+ $Configuration:: intern_ingredient( db) . data_zalsa ( zalsa , key) . clone( )
224
224
} else {
225
- $zalsa:: FromIdWithDb :: from_id ( key, db )
225
+ $zalsa:: FromIdWithDb :: from_id_zalsa ( key, zalsa )
226
226
}
227
227
}
228
228
}
0 commit comments