Memoize only immediates (int/float/bool/None) and immutable heap objects; fresh mutable containers or tuples/sets wrapping them must stay per-call to avoid aliasing and falsifying `is`. */
(result: Val, heap: &super::types::HeapPool)
| 230 | |
| 231 | /* Memoize only immediates (int/float/bool/None) and immutable heap objects; fresh mutable containers or tuples/sets wrapping them must stay per-call to avoid aliasing and falsifying `is`. */ |
| 232 | fn result_memoizable(result: Val, heap: &super::types::HeapPool) -> bool { |
| 233 | use super::types::HeapObj; |
| 234 | if !result.is_heap() { return true; } |
| 235 | matches!(heap.try_get(result), Some(HeapObj::Str(_) | HeapObj::Bytes(_) | HeapObj::LongInt(_))) |
| 236 | } |
| 237 | |
| 238 | // Indexed by dense `fi`; Vec gives O(1) lookup with no HashMap monomorphization. |
| 239 | pub struct Templates { slots: Vec<Vec<TplEntry>> } |