Skip to content

Commit 8a293d9

Browse files
committed
Modernize CALL_NO_KW_TYPE_1
1 parent 770036a commit 8a293d9

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

Python/bytecodes.c

+5-10
Original file line numberDiff line numberDiff line change
@@ -2534,22 +2534,17 @@ dummy_func(
25342534
DISPATCH_INLINED(new_frame);
25352535
}
25362536

2537-
// stack effect: (__0, __array[oparg] -- )
2538-
inst(CALL_NO_KW_TYPE_1) {
2537+
inst(CALL_NO_KW_TYPE_1, (unused/1, unused/2, unused/1, null, callable, args[oparg] -- res)) {
25392538
assert(kwnames == NULL);
25402539
assert(cframe.use_tracing == 0);
25412540
assert(oparg == 1);
2542-
DEOPT_IF(is_method(stack_pointer, 1), CALL);
2543-
PyObject *obj = TOP();
2544-
PyObject *callable = SECOND();
2541+
DEOPT_IF(null != NULL, CALL);
2542+
PyObject *obj = args[0];
25452543
DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL);
25462544
STAT_INC(CALL, hit);
2547-
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
2548-
PyObject *res = Py_NewRef(Py_TYPE(obj));
2549-
Py_DECREF(callable);
2545+
res = Py_NewRef(Py_TYPE(obj));
25502546
Py_DECREF(obj);
2551-
STACK_SHRINK(2);
2552-
SET_TOP(res);
2547+
Py_DECREF(callable);
25532548
}
25542549

25552550
// stack effect: (__0, __array[oparg] -- )

Python/generated_cases.c.h

+12-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/opcode_metadata.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
295295
case CALL_PY_WITH_DEFAULTS:
296296
return oparg + 2;
297297
case CALL_NO_KW_TYPE_1:
298-
return -1;
298+
return oparg + 2;
299299
case CALL_NO_KW_STR_1:
300300
return -1;
301301
case CALL_NO_KW_TUPLE_1:
@@ -641,7 +641,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
641641
case CALL_PY_WITH_DEFAULTS:
642642
return 1;
643643
case CALL_NO_KW_TYPE_1:
644-
return -1;
644+
return 1;
645645
case CALL_NO_KW_STR_1:
646646
return -1;
647647
case CALL_NO_KW_TUPLE_1:
@@ -846,7 +846,7 @@ struct opcode_metadata {
846846
[CALL_BOUND_METHOD_EXACT_ARGS] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
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 },
849-
[CALL_NO_KW_TYPE_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
849+
[CALL_NO_KW_TYPE_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
850850
[CALL_NO_KW_STR_1] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
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 },

0 commit comments

Comments
 (0)