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

Method exec_arith_or_compare

compiler/src/modules/vm/dispatch.rs:752–776  ·  view source on GitHub ↗
(&mut self, opcode: OpCode, rip: usize, cache: &mut OpcodeCache, chunk: &SSAChunk, slots: &mut [Val])

Source from the content-addressed store, hash-verified

750
751 #[inline(never)]
752 fn exec_arith_or_compare(&mut self, opcode: OpCode, rip: usize, cache: &mut OpcodeCache, chunk: &SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> {
753 // Scalar IC fast-path (Div/Pow/Minus skip, Float-only / overflow-prone).
754 if !matches!(opcode, OpCode::Div | OpCode::Pow | OpCode::Minus | OpCode::Pos)
755 && let Some(fast) = cache.get_fast(rip)
756 {
757 match self.exec_fast(fast)? {
758 FastOutcome::Done => return Ok(()),
759 FastOutcome::Overflow => {}
760 FastOutcome::TypeMiss => cache.invalidate(rip),
761 }
762 }
763 // instance-dunder fast path.
764 if let Some(inst) = cache.get_inst(rip) {
765 match self.exec_inst(inst, chunk, slots)? {
766 FastOutcome::Done => return Ok(()),
767 FastOutcome::Overflow => {}
768 FastOutcome::TypeMiss => cache.invalidate_inst(rip),
769 }
770 }
771 if matches!(opcode, OpCode::Eq | OpCode::Lt | OpCode::NotEq | OpCode::Gt | OpCode::LtEq | OpCode::GtEq) {
772 self.handle_compare(opcode, rip, cache, chunk, slots)
773 } else {
774 self.handle_arith(opcode, rip, cache, chunk, slots)
775 }
776 }
777
778 /* Charge one unit against the op budget; for native loops (custom-iterator drain, generator collect) that bypass the dispatch back-edge counter. */
779 #[inline]

Callers 1

dispatchMethod · 0.80

Calls 8

get_fastMethod · 0.80
exec_fastMethod · 0.80
invalidateMethod · 0.80
get_instMethod · 0.80
exec_instMethod · 0.80
invalidate_instMethod · 0.80
handle_compareMethod · 0.80
handle_arithMethod · 0.80

Tested by

no test coverage detected