Skip to content
Prev Previous commit
Next Next commit
Handle _PY_FRAME_KW in tier 2 optimizer
  • Loading branch information
markshannon committed Aug 14, 2024
commit 6b9055c6e84817f4d15d6b3d5eeff3eddeb8ee04
2 changes: 1 addition & 1 deletion Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ translate_bytecode_to_trace(
ADD_TO_TRACE(_DYNAMIC_EXIT, 0, 0, 0);
goto done;
}
assert(_PyOpcode_Deopt[opcode] == CALL);
assert(_PyOpcode_Deopt[opcode] == CALL || _PyOpcode_Deopt[opcode] == CALL_KW);
int func_version_offset =
offsetof(_PyCallCache, func_version)/sizeof(_Py_CODEUNIT)
// Add one to account for the actual opcode/oparg pair:
Expand Down
9 changes: 9 additions & 0 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,15 @@ dummy_func(void) {
ctx->done = true;
}

op(_PY_FRAME_KW, (callable, self_or_null, args[oparg], kwnames -- new_frame: _Py_UOpsAbstractFrame*)) {
(void)callable;
(void)self_or_null;
(void)args;
(void)kwnames;
new_frame = NULL;
ctx->done = true;
}

op(_RETURN_VALUE, (retval -- res)) {
SYNC_SP();
ctx->frame->stack_pointer = stack_pointer;
Expand Down
17 changes: 15 additions & 2 deletions Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,9 +2049,9 @@ _Py_Specialize_CallKw(_PyStackRef callable_st, _Py_CODEUNIT *instr, int nargs)
fail = -1;
}
}
else {
instr->op.code = CALL_KW_NON_PY;
fail = 0;
else {
instr->op.code = CALL_KW_NON_PY;
fail = 0;
}
if (fail) {
STAT_INC(CALL, failure);
Expand Down