Skip to content

Commit 4cd24d6

Browse files
committed
Modernize CALL_NO_KW_STR_1
1 parent d5a0831 commit 4cd24d6

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

Python/bytecodes.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,25 +2547,18 @@ dummy_func(
25472547
Py_DECREF(callable);
25482548
}
25492549

2550-
// stack effect: (__0, __array[oparg] -- )
2551-
inst(CALL_NO_KW_STR_1) {
2550+
inst(CALL_NO_KW_STR_1, (unused/1, unused/2, unused/1, null, callable, args[oparg] -- res)) {
25522551
assert(kwnames == NULL);
25532552
assert(cframe.use_tracing == 0);
25542553
assert(oparg == 1);
2555-
DEOPT_IF(is_method(stack_pointer, 1), CALL);
2556-
PyObject *callable = PEEK(2);
2554+
DEOPT_IF(null != NULL, CALL);
25572555
DEOPT_IF(callable != (PyObject *)&PyUnicode_Type, CALL);
25582556
STAT_INC(CALL, hit);
2559-
PyObject *arg = TOP();
2560-
PyObject *res = PyObject_Str(arg);
2557+
PyObject *arg = args[0];
2558+
res = PyObject_Str(arg);
25612559
Py_DECREF(arg);
25622560
Py_DECREF(&PyUnicode_Type);
2563-
STACK_SHRINK(2);
2564-
SET_TOP(res);
2565-
if (res == NULL) {
2566-
goto error;
2567-
}
2568-
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
2561+
ERROR_IF(res == NULL, error);
25692562
CHECK_EVAL_BREAKER();
25702563
}
25712564

Python/generated_cases.c.h

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/opcode_metadata.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
297297
case CALL_NO_KW_TYPE_1:
298298
return oparg + 2;
299299
case CALL_NO_KW_STR_1:
300-
return -1;
300+
return oparg + 2;
301301
case CALL_NO_KW_TUPLE_1:
302302
return -1;
303303
case CALL_BUILTIN_CLASS:
@@ -643,7 +643,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
643643
case CALL_NO_KW_TYPE_1:
644644
return 1;
645645
case CALL_NO_KW_STR_1:
646-
return -1;
646+
return 1;
647647
case CALL_NO_KW_TUPLE_1:
648648
return -1;
649649
case CALL_BUILTIN_CLASS:
@@ -847,7 +847,7 @@ struct opcode_metadata {
847847
[CALL_PY_EXACT_ARGS] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
848848
[CALL_PY_WITH_DEFAULTS] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
849849
[CALL_NO_KW_TYPE_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
850-
[CALL_NO_KW_STR_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
850+
[CALL_NO_KW_STR_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
851851
[CALL_NO_KW_TUPLE_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
852852
[CALL_BUILTIN_CLASS] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
853853
[CALL_NO_KW_BUILTIN_O] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },

0 commit comments

Comments
 (0)