aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_bytecodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/optimizer_bytecodes.c')
-rw-r--r--Python/optimizer_bytecodes.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index 567caad2255..e99421a3aff 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -1084,10 +1084,18 @@ dummy_func(void) {
sym_set_const(callable, (PyObject *)&PyUnicode_Type);
}
- op(_CALL_LEN, (callable[1], self_or_null[1], args[oparg] -- res)) {
+ op(_CALL_LEN, (unused, unused, unused -- res)) {
res = sym_new_type(ctx, &PyLong_Type);
}
+ op(_GUARD_CALLABLE_LEN, (callable, unused, unused -- callable, unused, unused)) {
+ PyObject *len = _PyInterpreterState_GET()->callable_cache.len;
+ if (sym_get_const(ctx, callable) == len) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
+ }
+ sym_set_const(callable, len);
+ }
+
// END BYTECODES //
}