MCPcopy Index your code
hub / github.com/RustPython/RustPython / specialize_load_super_attr

Method specialize_load_super_attr

crates/vm/src/frame.rs:8696–8733  ·  view source on GitHub ↗
(
        &mut self,
        vm: &VirtualMachine,
        oparg: LoadSuperAttr,
        instr_idx: usize,
        cache_base: usize,
    )

Source from the content-addressed store, hash-verified

8694 }
8695
8696 fn specialize_load_super_attr(
8697 &mut self,
8698 vm: &VirtualMachine,
8699 oparg: LoadSuperAttr,
8700 instr_idx: usize,
8701 cache_base: usize,
8702 ) {
8703 if !matches!(
8704 self.code.instructions.read_op(instr_idx),
8705 Instruction::LoadSuperAttr { .. }
8706 ) {
8707 return;
8708 }
8709 // Stack: [global_super, class, self]
8710 let global_super = self.nth_value(2);
8711 let class = self.nth_value(1);
8712
8713 if !global_super.is(&vm.ctx.types.super_type.as_object())
8714 || class.downcast_ref::<PyType>().is_none()
8715 {
8716 unsafe {
8717 self.code.instructions.write_adaptive_counter(
8718 cache_base,
8719 bytecode::adaptive_counter_backoff(
8720 self.code.instructions.read_adaptive_counter(cache_base),
8721 ),
8722 );
8723 }
8724 return;
8725 }
8726
8727 let new_op = if oparg.is_load_method() {
8728 Instruction::LoadSuperAttrMethod
8729 } else {
8730 Instruction::LoadSuperAttrAttr
8731 };
8732 self.specialize_at(instr_idx, cache_base, new_op);
8733 }
8734
8735 fn specialize_compare_op(
8736 &mut self,

Callers 1

execute_instructionMethod · 0.80

Calls 9

adaptive_counter_backoffFunction · 0.85
nth_valueMethod · 0.80
isMethod · 0.80
read_adaptive_counterMethod · 0.80
is_load_methodMethod · 0.80
specialize_atMethod · 0.80
as_objectMethod · 0.45
is_noneMethod · 0.45

Tested by

no test coverage detected