Skip to content

Commit 266247c

Browse files
gh-148171: Convert CALL_BUILTIN_FAST to leave inputs on the stack for refcount elimination in JIT (GH-148172)
1 parent aea0b91 commit 266247c

File tree

14 files changed

+1197
-1101
lines changed

14 files changed

+1197
-1101
lines changed

Include/internal/pycore_ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ _Py_VectorCallInstrumentation_StackRefSteal(
433433
PyThreadState* tstate);
434434

435435
PyAPI_FUNC(PyObject *)
436-
_Py_BuiltinCallFast_StackRefSteal(
436+
_Py_BuiltinCallFast_StackRef(
437437
_PyStackRef callable,
438438
_PyStackRef *arguments,
439439
int total_args);

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_stackref.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,18 @@ _Py_TryXGetStackRef(PyObject **src, _PyStackRef *out)
845845
} \
846846
} while (0)
847847

848+
static inline void
849+
_PyStackRef_CloseStack(_PyStackRef *arguments, int total_args)
850+
{
851+
// arguments is a pointer into the GC visible stack,
852+
// so we must NULL out values as we clear them.
853+
for (int i = total_args-1; i >= 0; i--) {
854+
_PyStackRef tmp = arguments[i];
855+
arguments[i] = PyStackRef_NULL;
856+
PyStackRef_CLOSE(tmp);
857+
}
858+
}
859+
848860
#ifdef __cplusplus
849861
}
850862
#endif

0 commit comments

Comments
 (0)