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

Method record_dunder_hit

compiler/src/modules/vm/dispatch.rs:135–142  ·  view source on GitHub ↗
(&self, ip: usize, cache: &mut OpcodeCache, recv: Val, name: &str, arity: u8)

Source from the content-addressed store, hash-verified

133 /* Post-success recording for the instance-dunder IC; ignored when the receiver isn't an instance or the method isn't on its class. */
134 #[inline]
135 pub(crate) fn record_dunder_hit(&self, ip: usize, cache: &mut OpcodeCache, recv: Val, name: &str, arity: u8) {
136 if !recv.is_heap() { return; }
137 // try_get is a backstop; callers root operands across the dunder call.
138 let Some(HeapObj::Instance(cls, _)) = self.heap.try_get(recv) else { return; };
139 let cls = *cls;
140 let Some((method, _)) = self.lookup_class_member(cls, name) else { return; };
141 cache.record_inst(ip, cls.as_heap(), method, arity);
142 }
143
144 /* Main dispatch loop. Walks the fused instruction stream (LoadAttr+Call already collapsed to CallMethod+CallMethodArgs); checks the IC inline for hot arith/compare opcodes. */
145 pub(crate) fn exec(&mut self, chunk: &SSAChunk, slots: &mut [Val]) -> Result<Val, VmErr> {

Callers 5

handle_arithMethod · 0.80
exec_negMethod · 0.80
exec_posMethod · 0.80
handle_compareMethod · 0.80
get_itemMethod · 0.80

Calls 5

is_heapMethod · 0.80
try_getMethod · 0.80
lookup_class_memberMethod · 0.80
record_instMethod · 0.80
as_heapMethod · 0.80

Tested by

no test coverage detected