Skip to content

Commit aabbe4f

Browse files
Fix build
1 parent 1cb19c0 commit aabbe4f

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

Objects/typeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12281,7 +12281,7 @@ _PyCeval_Super_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name)
1228112281
if (su_obj_type == NULL) {
1228212282
return (_PyCevalIntAndPyObject){ 0, NULL};
1228312283
}
12284-
PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, method);
12284+
PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, &method);
1228512285
Py_DECREF(su_obj_type);
1228612286
return (_PyCevalIntAndPyObject) { method, res };
1228712287
}

Python/ceval.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10241024
uint8_t opcode; /* Current opcode */
10251025
int oparg; /* Current opcode argument, if any */
10261026
assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL);
1027+
#else
1028+
PyObject *PYOBJECT_SCRATCH[MAX_STACKREF_SCRATCH + 1];
10271029
#endif
10281030
_PyEntryFrame entry;
10291031

@@ -1094,9 +1096,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10941096
stack_pointer = _PyFrame_GetStackPointer(frame);
10951097
#if Py_TAIL_CALL_INTERP
10961098
# if Py_STATS
1097-
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0, lastopcode);
1099+
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0, lastopcode MSVC_TAILCALL_SCRATCH_ARG);
10981100
# else
1099-
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0);
1101+
return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, 0 MSVC_TAILCALL_SCRATCH_ARG);
11001102
# endif
11011103
#else
11021104
goto error;
@@ -1110,9 +1112,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11101112
#endif
11111113
#if Py_TAIL_CALL_INTERP
11121114
# if Py_STATS
1113-
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0, lastopcode);
1115+
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0, lastopcode MSVC_TAILCALL_SCRATCH_ARG);
11141116
# else
1115-
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0);
1117+
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0 MSVC_TAILCALL_SCRATCH_ARG);
11161118
# endif
11171119
#else
11181120
goto start_frame;

Python/ceval_macros.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@
7171
#endif
7272

7373
#ifdef Py_STATS
74-
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, int lastopcode
75-
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, lastopcode
74+
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, PyObject **PYOBJECT_SCRATCH, int lastopcode
75+
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, PYOBJECT_SCRATCH, lastopcode
7676
#else
77-
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg
78-
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg
77+
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, PyObject **PYOBJECT_SCRATCH
78+
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, PYOBJECT_SCRATCH
7979
#endif
8080

81+
8182
#if Py_TAIL_CALL_INTERP
8283
# ifdef _MSC_VER
8384
# define Py_MUSTTAIL [[msvc::musttail]]
@@ -102,27 +103,30 @@
102103
# ifdef Py_STATS
103104
# define JUMP_TO_PREDICTED(name) \
104105
do { \
105-
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg, lastopcode); \
106+
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg, lastopcode, PYOBJECT_SCRATCH); \
106107
} while (0)
107108
# else
108109
# define JUMP_TO_PREDICTED(name) \
109110
do { \
110-
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg); \
111+
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg, PYOBJECT_SCRATCH); \
111112
} while (0)
112113
# endif
113114
# define LABEL(name) TARGET(name)
115+
# define MSVC_TAILCALL_SCRATCH_ARG ,PYOBJECT_SCRATCH
114116
#elif USE_COMPUTED_GOTOS
115117
# define TARGET(op) TARGET_##op:
116118
# define DISPATCH_GOTO() goto *opcode_targets[opcode]
117119
# define JUMP_TO_LABEL(name) goto name;
118120
# define JUMP_TO_PREDICTED(name) goto PREDICTED_##name;
119121
# define LABEL(name) name:
122+
# define MSVC_TAILCALL_SCRATCH_ARG
120123
#else
121124
# define TARGET(op) case op: TARGET_##op:
122125
# define DISPATCH_GOTO() goto dispatch_opcode
123126
# define JUMP_TO_LABEL(name) goto name;
124127
# define JUMP_TO_PREDICTED(name) goto PREDICTED_##name;
125128
# define LABEL(name) name:
129+
# define MSVC_TAILCALL_SCRATCH_ARG
126130
#endif
127131

128132
/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
@@ -421,10 +425,16 @@ do { \
421425
/* How much scratch space to give stackref to PyObject* conversion. */
422426
#define MAX_STACKREF_SCRATCH 10
423427

428+
#if Py_TAIL_CALL_INTERP
424429
#define STACKREFS_TO_PYOBJECTS(ARGS, ARG_COUNT, NAME) \
425430
/* +1 because vectorcall might use -1 to write self */ \
426-
PyObject *NAME##_temp[MAX_STACKREF_SCRATCH+1]; \
431+
PyObject **NAME##_temp = PYOBJECT_SCRATCH; \
432+
PyObject **NAME = _PyObjectArray_FromStackRefArray(ARGS, ARG_COUNT, NAME##_temp + 1);
433+
#else
434+
#define STACKREFS_TO_PYOBJECTS(ARGS, ARG_COUNT, NAME) \
435+
PyObject *NAME##_temp[MAX_STACKREF_SCRATCH + 1]; \
427436
PyObject **NAME = _PyObjectArray_FromStackRefArray(ARGS, ARG_COUNT, NAME##_temp + 1);
437+
#endif
428438

429439
#define STACKREFS_TO_PYOBJECTS_CLEANUP(NAME) \
430440
/* +1 because we +1 previously */ \

0 commit comments

Comments
 (0)