diff options
Diffstat (limited to 'Python/bytecodes.c')
| -rw-r--r-- | Python/bytecodes.c | 32 | 
1 files changed, 32 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 1b8820f..b38d37a 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1582,6 +1582,14 @@ dummy_func(              PREDICT(JUMP_BACKWARD);          } +        inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/9, unused, unused, unused -- unused if (oparg & 1), unused)) { +            _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; +            // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we +            // don't want to specialize instrumented instructions +            INCREMENT_ADAPTIVE_COUNTER(cache->counter); +            GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); +        } +          family(load_super_attr, INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR) = {              LOAD_SUPER_ATTR,              LOAD_SUPER_ATTR_ATTR, @@ -1602,10 +1610,34 @@ dummy_func(              DECREMENT_ADAPTIVE_COUNTER(cache->counter);              #endif  /* ENABLE_SPECIALIZATION */ +            if (opcode == INSTRUMENTED_LOAD_SUPER_ATTR) { +                PyObject *arg = oparg & 2 ? class : &_PyInstrumentation_MISSING; +                int err = _Py_call_instrumentation_2args( +                        tstate, PY_MONITORING_EVENT_CALL, +                        frame, next_instr-1, global_super, arg); +                ERROR_IF(err, error); +            } +              // we make no attempt to optimize here; specializations should              // handle any case whose performance we care about              PyObject *stack[] = {class, self};              PyObject *super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); +            if (opcode == INSTRUMENTED_LOAD_SUPER_ATTR) { +                PyObject *arg = oparg & 2 ? class : &_PyInstrumentation_MISSING; +                if (super == NULL) { +                    _Py_call_instrumentation_exc2( +                        tstate, PY_MONITORING_EVENT_C_RAISE, +                        frame, next_instr-1, global_super, arg); +                } +                else { +                    int err = _Py_call_instrumentation_2args( +                        tstate, PY_MONITORING_EVENT_C_RETURN, +                        frame, next_instr-1, global_super, arg); +                    if (err < 0) { +                        Py_CLEAR(super); +                    } +                } +            }              DECREF_INPUTS();              ERROR_IF(super == NULL, error);              res = PyObject_GetAttr(super, name);  | 
