Check if this function is eligible for exact-args call specialization. Returns true if: CO_OPTIMIZED, no VARARGS, no VARKEYWORDS, no kwonly args, and effective_nargs matches co_argcount.
(&self, effective_nargs: u32)
| 651 | /// Returns true if: CO_OPTIMIZED, no VARARGS, no VARKEYWORDS, no kwonly args, |
| 652 | /// and effective_nargs matches co_argcount. |
| 653 | pub(crate) fn can_specialize_call(&self, effective_nargs: u32) -> bool { |
| 654 | let code: &Py<PyCode> = &self.code; |
| 655 | let flags = code.flags; |
| 656 | flags.contains(bytecode::CodeFlags::OPTIMIZED) |
| 657 | && !flags.intersects(bytecode::CodeFlags::VARARGS | bytecode::CodeFlags::VARKEYWORDS) |
| 658 | && code.kwonlyarg_count == 0 |
| 659 | && code.arg_count == effective_nargs |
| 660 | } |
| 661 | |
| 662 | /// Runtime guard for CALL_*_EXACT_ARGS specialization: check only argcount. |
| 663 | /// Other invariants are guaranteed by function versioning and specialization-time checks. |
no test coverage detected