Skip to content

gh-117139: Convert the evaluation stack to stack refs #118450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 152 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
a6275f1
merge from upstream
Fidget-Spinner Apr 30, 2024
7e7627f
remove test tags
Fidget-Spinner Apr 30, 2024
00dde8e
add test for immortal
Fidget-Spinner Apr 30, 2024
eadc4fc
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Apr 30, 2024
64e2800
minor cleanups
Fidget-Spinner Apr 30, 2024
bf6b7e4
Create 2024-05-01-05-09-16.gh-issue-117139.t41w_D.rst
Fidget-Spinner Apr 30, 2024
865ff8d
remove bad assert
Fidget-Spinner Apr 30, 2024
b1777c4
rename tagged -> stackref
Fidget-Spinner May 1, 2024
50cfefa
trivial fixes first
Fidget-Spinner May 2, 2024
39e9057
fix anti-patterns (use deferred everywhere)
Fidget-Spinner May 2, 2024
1bb3c51
Delete 2024-03-26-20-31-34.gh-issue-117139.eELvoZ.rst
Fidget-Spinner May 2, 2024
18ef669
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 2, 2024
3fedc6f
replace and use macro
Fidget-Spinner May 2, 2024
1942d78
fix refcounting issues
Fidget-Spinner May 4, 2024
5a1c46f
Fix decref inputs problem
Fidget-Spinner May 4, 2024
dcc55b0
fix cases generator
Fidget-Spinner May 4, 2024
ec70b3b
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 4, 2024
542cfbb
fix problems from upstream
Fidget-Spinner May 4, 2024
3af1ef1
cleanup
Fidget-Spinner May 4, 2024
6bc29a1
formatting
Fidget-Spinner May 4, 2024
9052526
change used tags to 0b01
Fidget-Spinner May 5, 2024
c38de34
alignment
Fidget-Spinner May 5, 2024
106058c
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 6, 2024
f545b2f
fix merge problems
Fidget-Spinner May 6, 2024
0d1b38f
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 8, 2024
a597536
use PyStackRef_IsNull
Fidget-Spinner May 8, 2024
9d43727
tagged ->stackref
Fidget-Spinner May 8, 2024
bc96ae6
use Mark's naming scheme
Fidget-Spinner May 8, 2024
1d71dd1
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 8, 2024
e12337a
Update pycore_object_deferred.h
Fidget-Spinner May 8, 2024
91a8c81
tag all pointers, address some comments
Fidget-Spinner May 9, 2024
64bdfe2
fix free threaded, address more reviews
Fidget-Spinner May 9, 2024
88e0ea8
remove GC changes
Fidget-Spinner May 9, 2024
64b237c
address all of Mark's review
Fidget-Spinner May 10, 2024
97f6e14
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 10, 2024
834cdf0
fix refcounting issue
Fidget-Spinner May 10, 2024
99611cb
fix gdb failures
Fidget-Spinner May 10, 2024
512cd2e
fix specialization
Fidget-Spinner May 10, 2024
df176bf
fix tier 2
Fidget-Spinner May 10, 2024
576909d
fix optimizer builds
Fidget-Spinner May 10, 2024
adb54d8
don't check immortal when tagging
Fidget-Spinner May 10, 2024
d86652f
remove immortal check for tagging
Fidget-Spinner May 10, 2024
bca14a8
remove unsafe ptr conversions
Fidget-Spinner May 10, 2024
4eaece7
Revert "remove immortal check for tagging"
Fidget-Spinner May 10, 2024
4930f6f
Revert "don't check immortal when tagging"
Fidget-Spinner May 10, 2024
8670ee4
tag immortal objects
Fidget-Spinner May 10, 2024
144a6fa
Remove PyObject_To_StackRef_Steal
Fidget-Spinner May 10, 2024
c2bbe17
minor clenaups
Fidget-Spinner May 11, 2024
a6bfc97
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 27, 2024
e21a76a
Use Sam's and Mark's naming scheme
Fidget-Spinner May 28, 2024
e12942d
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner May 28, 2024
64c070d
regen
Fidget-Spinner May 28, 2024
4a103fb
fix test_generated_cases
Fidget-Spinner May 28, 2024
0bd7435
address partially reviews
Fidget-Spinner Jun 4, 2024
51908e9
convert the rest to stackrefs
Fidget-Spinner Jun 4, 2024
e99f019
fix tests
Fidget-Spinner Jun 4, 2024
fde830d
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 4, 2024
c73f8ac
ifdef out on default builds
Fidget-Spinner Jun 4, 2024
6a6bae2
add back XCLOSE and XDUP for perf reasons
Fidget-Spinner Jun 4, 2024
3d23f56
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 5, 2024
99fa382
Low the C recursion limit in WASI, it's failing
Fidget-Spinner Jun 5, 2024
5a5e329
Revert "Low the C recursion limit in WASI, it's failing"
Fidget-Spinner Jun 5, 2024
4a5ae8c
use macros instead of static inline for most things
Fidget-Spinner Jun 5, 2024
4e9740d
Revert "use macros instead of static inline for most things"
Fidget-Spinner Jun 5, 2024
c49cf1c
double WASI stack size of pydebug
Fidget-Spinner Jun 5, 2024
1b45992
Revert "Revert "use macros instead of static inline for most things""
Fidget-Spinner Jun 5, 2024
e5130a9
Revert "double WASI stack size of pydebug"
Fidget-Spinner Jun 5, 2024
505d640
inline functions directly for non-gil to pass on WASI debug
Fidget-Spinner Jun 5, 2024
5053536
Update configure
Fidget-Spinner Jun 5, 2024
0242212
convert more stuff to macros to try fix wasi
Fidget-Spinner Jun 5, 2024
12f8c0e
Increase wasm limit to 32kb
Fidget-Spinner Jun 5, 2024
db89f64
Revert "Increase wasm limit to 32kb"
Fidget-Spinner Jun 5, 2024
79714c2
skip test on WASI
Fidget-Spinner Jun 5, 2024
9a33b7f
fix uses of dup
Fidget-Spinner Jun 6, 2024
18894ca
refactor calls according to Mark
Fidget-Spinner Jun 6, 2024
67e0d25
fix bug
Fidget-Spinner Jun 6, 2024
4423794
fix macro
Fidget-Spinner Jun 6, 2024
66eb526
regen frozemain?
Fidget-Spinner Jun 6, 2024
2eda2f9
add PyStackRef_IsFalse/True
Fidget-Spinner Jun 6, 2024
8f97ae2
skip bad test
Fidget-Spinner Jun 6, 2024
58c3c55
fix tier 2 and JIT builds
Fidget-Spinner Jun 6, 2024
ca92d4a
fix macro
Fidget-Spinner Jun 7, 2024
3356eda
fix error handling
Fidget-Spinner Jun 7, 2024
8274425
revert unicode
Fidget-Spinner Jun 7, 2024
4405a5c
DCE hack
Fidget-Spinner Jun 7, 2024
2d69426
revert dictionary
Fidget-Spinner Jun 7, 2024
4f4107a
revert slice
Fidget-Spinner Jun 7, 2024
65be3fd
revert lists
Fidget-Spinner Jun 7, 2024
78dbf36
revert tuple
Fidget-Spinner Jun 7, 2024
a21eddd
Address review
Fidget-Spinner Jun 10, 2024
d744c8a
address changes (woops)
Fidget-Spinner Jun 10, 2024
6c76fe3
Address half of Mark's review
Fidget-Spinner Jun 11, 2024
8dc4fc6
Address rest of review
Fidget-Spinner Jun 11, 2024
8044c7e
Address rest of review
Fidget-Spinner Jun 11, 2024
90ebfc4
rename for clarity
Fidget-Spinner Jun 11, 2024
e4ccb65
rename PyStackRef_AsPyObjectDeferredToNew -> PyStackRef_AsPyObjectDef…
Fidget-Spinner Jun 12, 2024
2ff4f36
Drop defer, just steal
Fidget-Spinner Jun 12, 2024
992731d
Address half of Mark's review
Fidget-Spinner Jun 13, 2024
12f19ce
revert test frozenmain changes
Fidget-Spinner Jun 13, 2024
268eb0e
remove istrue
Fidget-Spinner Jun 13, 2024
d3b9e51
remove isfalse
Fidget-Spinner Jun 13, 2024
680e828
remove isnone
Fidget-Spinner Jun 13, 2024
27eda47
rename gen_frame_o
Fidget-Spinner Jun 13, 2024
be25a04
Fixup
Fidget-Spinner Jun 13, 2024
ae8c050
rename
Fidget-Spinner Jun 13, 2024
6e84d69
rename true and false to static const
Fidget-Spinner Jun 13, 2024
c523386
try fix on msvc
Fidget-Spinner Jun 13, 2024
d565b0d
try fix
Fidget-Spinner Jun 13, 2024
983764c
fix codegen
Fidget-Spinner Jun 14, 2024
7f3c02d
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 14, 2024
656f35c
Use macro
Fidget-Spinner Jun 14, 2024
92ada68
rename to PyStackRef_none
Fidget-Spinner Jun 14, 2024
24bd03f
Fix tier 2 generation
Fidget-Spinner Jun 14, 2024
fd1140c
cleanup code generator
Fidget-Spinner Jun 14, 2024
fc66d1c
Change is_abstract to extract_bits
Fidget-Spinner Jun 14, 2024
9dda41f
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 17, 2024
233f9e2
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 17, 2024
ef5a057
address review: use macro for conversion
Fidget-Spinner Jun 17, 2024
d2c14f7
fix space issue
Fidget-Spinner Jun 17, 2024
09a3848
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 18, 2024
40e72e1
(test) remove skips
Fidget-Spinner Jun 18, 2024
b33d161
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 18, 2024
b160409
fix upstream changes
Fidget-Spinner Jun 18, 2024
8ffd7ff
Convert functions back to static inline
Fidget-Spinner Jun 19, 2024
cbc1b6f
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 19, 2024
6adbcbf
Update test_frozenmain.h
Fidget-Spinner Jun 19, 2024
fdd24d6
Tighten diff
Fidget-Spinner Jun 20, 2024
9acd39d
Apply all suggestions and reviews by Mark
Fidget-Spinner Jun 21, 2024
e600102
Apply comment from line 1112
Fidget-Spinner Jun 21, 2024
add5f75
borrow, not steal
Fidget-Spinner Jun 21, 2024
f811462
Add documentation and guide
Fidget-Spinner Jun 22, 2024
c4dd69b
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 22, 2024
60e2bb4
Address review by Mark
Fidget-Spinner Jun 22, 2024
c7eac22
fix for free-threaded builds
Fidget-Spinner Jun 22, 2024
8bf685a
fix typo
Fidget-Spinner Jun 22, 2024
7cf0369
Rename Py_STACKREF_NULL to PyStackRef_NULL
Fidget-Spinner Jun 23, 2024
37c31d1
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 24, 2024
2d38baa
Reduce scratch size on apple
Fidget-Spinner Jun 25, 2024
8d82237
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 25, 2024
a959249
Address review, increase scratch
Fidget-Spinner Jun 25, 2024
cab1d5b
Apply most suggestions
Fidget-Spinner Jun 26, 2024
ee6630f
Fix write underflow
Fidget-Spinner Jun 26, 2024
9b67932
reduce stack requirements
Fidget-Spinner Jun 26, 2024
475e2dc
Update ceval_macros.h
Fidget-Spinner Jun 26, 2024
126b60d
fix off by one
Fidget-Spinner Jun 26, 2024
197e1ba
regen
Fidget-Spinner Jun 26, 2024
4074bc3
undo immortal changes (they caused asserts to fail)
Fidget-Spinner Jun 26, 2024
50c92d0
Merge remote-tracking branch 'upstream/main' into stackref_all
Fidget-Spinner Jun 26, 2024
ce77fe4
Fix bug in malloc case
Fidget-Spinner Jun 26, 2024
193e216
Use immortal
Fidget-Spinner Jun 26, 2024
30f7a09
Remove borrowed load in counter_optimize
Fidget-Spinner Jun 26, 2024
ff41e0c
silence warning
Fidget-Spinner Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address half of Mark's review
  • Loading branch information
Fidget-Spinner committed Jun 13, 2024
commit 992731d5428d617df7b88b9c455b2ee07b02e67c
2 changes: 1 addition & 1 deletion Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static inline _PyStackRef *_PyFrame_Stackbase(_PyInterpreterFrame *f) {

static inline _PyStackRef _PyFrame_StackPeek(_PyInterpreterFrame *f) {
assert(f->stacktop > _PyFrame_GetCode(f)->co_nlocalsplus);
assert(PyStackRef_AsPyObjectBorrow(f->localsplus[f->stacktop-1]) != NULL);
assert(!PyStackRef_IsNull(f->localsplus[f->stacktop-1]));
return f->localsplus[f->stacktop-1];
}

Expand Down
21 changes: 13 additions & 8 deletions Include/internal/pycore_stackref.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ PyStackRef_AsPyObjectSteal(_PyStackRef tagged)
# define PyStackRef_AsPyObjectSteal(tagged) PyStackRef_AsPyObjectBorrow(tagged)
#endif

#ifdef Py_GIL_DISABLED
// Converts a PyStackRef back to a PyObject *, converting the
// stackref to a new reference.
static inline PyObject *
PyStackRef_AsPyObjectNew(_PyStackRef tagged)
{
return Py_NewRef(PyStackRef_AsPyObjectBorrow(tagged));
}
#else
# define PyStackRef_AsPyObjectNew(tagged) Py_NewRef(PyStackRef_AsPyObjectBorrow(tagged))
#endif

static inline PyTypeObject *
PyStackRef_TYPE(_PyStackRef stackref)
{
Expand Down Expand Up @@ -165,14 +177,6 @@ PyStackRef_FromPyObjectNew(PyObject *obj)
# define PyStackRef_FromPyObjectNew(obj) ((_PyStackRef){ .bits = (uintptr_t)(Py_NewRef(obj)) })
#endif

#define PyStackRef_XSET(dst, src) \
do { \
_PyStackRef *_tmp_dst_ptr = &(dst); \
_PyStackRef _tmp_old_dst = (*_tmp_dst_ptr); \
*_tmp_dst_ptr = (src); \
PyStackRef_XCLOSE(_tmp_old_dst); \
} while (0)

#define PyStackRef_CLEAR(op) \
do { \
_PyStackRef *_tmp_op_ptr = &(op); \
Expand Down Expand Up @@ -220,6 +224,7 @@ PyStackRef_DUP(_PyStackRef tagged)
return tagged;
}
#else
// Needs to be macro to not overflow on WASI debug.
# define PyStackRef_DUP(stackref) PyStackRef_FromPyObjectSteal(Py_NewRef(PyStackRef_AsPyObjectBorrow(stackref)))
#endif

Expand Down
3 changes: 2 additions & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ framelocalsproxy_setitem(PyObject *self, PyObject *key, PyObject *value)
PyStackRef_XCLOSE(oldvalue);
}
} else if (value != PyStackRef_AsPyObjectBorrow(oldvalue)) {
PyStackRef_XSET(fast[i], PyStackRef_FromPyObjectNew(value));
PyStackRef_XCLOSE(fast[i]);
fast[i] = PyStackRef_FromPyObjectNew(value);
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ _PyGen_yf(PyGenObject *gen)
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
assert(is_resume(frame->instr_ptr));
assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
return PyStackRef_AsPyObjectBorrow(PyStackRef_DUP(_PyFrame_StackPeek(frame)));
return PyStackRef_AsPyObjectNew(_PyFrame_StackPeek(frame));
}
return NULL;
}
Expand Down
14 changes: 7 additions & 7 deletions Programs/test_frozenmain.h

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

39 changes: 19 additions & 20 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ dummy_func(

inst(STORE_GLOBAL, (v --)) {
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectSteal(v));
int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v));
DECREF_INPUTS();
ERROR_IF(err, error);
}
Expand All @@ -1490,13 +1490,13 @@ dummy_func(
}

inst(LOAD_LOCALS, ( -- locals)) {
_PyStackRef locals_s = PyStackRef_FromPyObjectSteal(LOCALS());
if (PyStackRef_IsNull(locals_s)) {
PyObject *l = LOCALS();
if (l == NULL) {
_PyErr_SetString(tstate, PyExc_SystemError,
"no locals found");
ERROR_IF(true, error);
}
locals = PyStackRef_DUP(locals_s);
locals = PyStackRef_FromPyObjectNew(l);;
}

inst(LOAD_FROM_DICT_OR_GLOBALS, (mod_or_class_dict -- v)) {
Expand Down Expand Up @@ -2479,7 +2479,7 @@ dummy_func(
int sign_ish = COMPARISON_BIT(dleft, dright);
_Py_DECREF_SPECIALIZED(left_o, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(right_o, _PyFloat_ExactDealloc);
res = PyStackRef_FromPyObjectSteal((sign_ish & oparg) ? Py_True : Py_False);
res = (sign_ish & oparg) ? PyStackRef_True() : PyStackRef_False();
// It's always a bool, so we don't care about oparg & 16.
}

Expand All @@ -2499,7 +2499,7 @@ dummy_func(
int sign_ish = COMPARISON_BIT(ileft, iright);
_Py_DECREF_SPECIALIZED(left_o, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(right_o, (destructor)PyObject_Free);
res = PyStackRef_FromPyObjectSteal((sign_ish & oparg) ? Py_True : Py_False);
res = (sign_ish & oparg) ? PyStackRef_True() : PyStackRef_False();
// It's always a bool, so we don't care about oparg & 16.
}

Expand All @@ -2516,7 +2516,7 @@ dummy_func(
assert(eq == 0 || eq == 1);
assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS);
assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS);
res = PyStackRef_FromPyObjectSteal(((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False);
res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? PyStackRef_True() : PyStackRef_False();
// It's always a bool, so we don't care about oparg & 16.
}

Expand All @@ -2526,7 +2526,7 @@ dummy_func(

int res = Py_Is(left_o, right_o) ^ oparg;
DECREF_INPUTS();
b = PyStackRef_FromPyObjectSteal(res ? Py_True : Py_False);
b = res ? PyStackRef_True() : PyStackRef_False();
}

family(CONTAINS_OP, INLINE_CACHE_ENTRIES_CONTAINS_OP) = {
Expand All @@ -2541,7 +2541,7 @@ dummy_func(
int res = PySequence_Contains(right_o, left_o);
DECREF_INPUTS();
ERROR_IF(res < 0, error);
b = PyStackRef_FromPyObjectSteal((res ^ oparg) ? Py_True : Py_False);
b = (res ^ oparg) ? PyStackRef_True() : PyStackRef_False();
}

specializing op(_SPECIALIZE_CONTAINS_OP, (counter/1, left, right -- left, right)) {
Expand All @@ -2568,7 +2568,7 @@ dummy_func(
int res = _PySet_Contains((PySetObject *)right_o, left_o);
DECREF_INPUTS();
ERROR_IF(res < 0, error);
b = PyStackRef_FromPyObjectSteal((res ^ oparg) ? Py_True : Py_False);
b = (res ^ oparg) ? PyStackRef_True() : PyStackRef_False();
}

inst(CONTAINS_OP_DICT, (unused/1, left, right -- b)) {
Expand All @@ -2580,7 +2580,7 @@ dummy_func(
int res = PyDict_Contains(right_o, left_o);
DECREF_INPUTS();
ERROR_IF(res < 0, error);
b = PyStackRef_FromPyObjectSteal((res ^ oparg) ? Py_True : Py_False);
b = (res ^ oparg) ? PyStackRef_True() : PyStackRef_False();
}

inst(CHECK_EG_MATCH, (exc_value_st, match_type_st -- rest, match)) {
Expand Down Expand Up @@ -2621,7 +2621,7 @@ dummy_func(

int res = PyErr_GivenExceptionMatches(left_o, right_o);
DECREF_INPUTS();
b = PyStackRef_FromPyObjectSteal(res ? Py_True : Py_False);
b = res ? PyStackRef_True() : PyStackRef_False();
}

tier1 inst(IMPORT_NAME, (level, fromlist -- res)) {
Expand Down Expand Up @@ -3503,17 +3503,17 @@ dummy_func(
assert(Py_TYPE(callable_o) == &PyFunction_Type);
int code_flags = ((PyCodeObject*)PyFunction_GET_CODE(callable_o))->co_flags;
PyObject *locals = code_flags & CO_OPTIMIZED ? NULL : Py_NewRef(PyFunction_GET_GLOBALS(callable_o));
_PyInterpreterFrame *new_frame_o = _PyEvalFramePushAndInit(
_PyInterpreterFrame *_new_frame = _PyEvalFramePushAndInit(
tstate, (PyFunctionObject *)PyStackRef_AsPyObjectSteal(callable), locals,
args, total_args, NULL
);
// The frame has stolen all the arguments from the stack,
// so there is no need to clean them up.
SYNC_SP();
if (new_frame_o == NULL) {
if (_new_frame == NULL) {
ERROR_NO_POP();
}
new_frame = (_PyStackRef) { .bits = (uintptr_t)new_frame_o };
new_frame = (_PyStackRef) { .bits = (uintptr_t)_new_frame };
}

op(_CHECK_FUNCTION_VERSION, (func_version/2, callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
Expand Down Expand Up @@ -3647,13 +3647,13 @@ dummy_func(
int has_self = !PyStackRef_IsNull(self_or_null);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable_o;
_PyInterpreterFrame *new_frame_o = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
_PyStackRef *first_non_self_local = new_frame_o->localsplus + has_self;
new_frame_o->localsplus[0] = self_or_null;
_PyInterpreterFrame *_new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
_PyStackRef *first_non_self_local = _new_frame->localsplus + has_self;
_new_frame->localsplus[0] = self_or_null;
for (int i = 0; i < oparg; i++) {
first_non_self_local[i] = args[i];
}
new_frame = (_PyStackRef) { .bits = (uintptr_t)new_frame_o };
new_frame = (_PyStackRef) { .bits = (uintptr_t)_new_frame };
}

op(_PUSH_FRAME, (new_frame -- )) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why remove the type annotation?

Expand Down Expand Up @@ -3938,7 +3938,6 @@ dummy_func(
DECREF_INPUTS();
ERROR_IF(true, error);
}
ERROR_IF(args_o == NULL, error);
PyObject *res_o = cfunc(PyCFunction_GET_SELF(callable_o), args_o, total_args, NULL);
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);

Expand Down
2 changes: 1 addition & 1 deletion Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,4 @@ do { \
#else
#define STACKREFS_TO_PYOBJECTS_CLEANUP(NAME) \
(void)(NAME);
#endif
#endif
24 changes: 12 additions & 12 deletions Python/executor_cases.c.h

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

Loading