MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / lookup

Method lookup

compiler/src/modules/vm/cache.rs:244–249  ·  view source on GitHub ↗
(&self, fi: usize, args: &[Val], heap: &super::types::HeapPool)

Source from the content-addressed store, hash-verified

242 pub fn new() -> Self { Self { slots: Vec::new() } }
243
244 pub fn lookup(&self, fi: usize, args: &[Val], heap: &super::types::HeapPool) -> Option<Val> {
245 let h = hash_args(args);
246 self.slots.get(fi)?.iter()
247 .find(|e| e.hits >= TPL_THRESH && args_match(e, args, h, heap))
248 .map(|e| e.result)
249 }
250
251 pub fn record(&mut self, fi: usize, args: &[Val], result: Val, heap: &super::types::HeapPool) {
252 if !args_memoizable(args, heap) || !result_memoizable(result, heap) { return; }

Callers 1

exec_callMethod · 0.80

Calls 4

hash_argsFunction · 0.85
args_matchFunction · 0.85
iterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected