Skip to content

Commit df35534

Browse files
gh-142982: Specialize CALL_FUNCTION_EX (GH-143391)
1 parent ff7d1ce commit df35534

20 files changed

+2074
-1188
lines changed

Include/internal/pycore_code.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ typedef struct {
160160

161161
#define INLINE_CACHE_ENTRIES_CONTAINS_OP CACHE_ENTRIES(_PyContainsOpCache)
162162

163+
typedef struct {
164+
_Py_BackoffCounter counter;
165+
} _PyCallFunctionExCache;
166+
167+
#define INLINE_CACHE_ENTRIES_CALL_FUNCTION_EX CACHE_ENTRIES(_PyCallFunctionExCache)
168+
163169
/* "Locals plus" for a code object is the set of locals + cell vars +
164170
* free vars. This relates to variable names as well as offsets into
165171
* the "fast locals" storage array of execution frames. The compiler
@@ -326,6 +332,7 @@ PyAPI_FUNC(void) _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
326332
PyAPI_FUNC(void) _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
327333
PyAPI_FUNC(void) _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
328334
PyAPI_FUNC(void) _Py_GatherStats_GetIter(_PyStackRef iterable);
335+
PyAPI_FUNC(void) _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr);
329336

330337
// Utility functions for reading/writing 32/64-bit values in the inline caches.
331338
// Great care should be taken to ensure that these functions remain correct and

Include/internal/pycore_interpframe.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
395395
size_t argcount, PyObject *kwnames,
396396
_PyInterpreterFrame *previous);
397397

398+
PyAPI_FUNC(_PyInterpreterFrame *)
399+
_PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func,
400+
PyObject *locals, Py_ssize_t nargs, PyObject *callargs, PyObject *kwargs, _PyInterpreterFrame *previous);
401+
398402
#ifdef __cplusplus
399403
}
400404
#endif

Include/internal/pycore_magic_number.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ Known values:
289289
Python 3.15a2 3656 (Add TRACE_RECORD instruction, for platforms with switch based interpreter)
290290
Python 3.15a4 3657 (Add BINARY_OP_SUBSCR_USTR_INT)
291291
Python 3.15a4 3658 (Optimize bytecode for list/set called on genexp)
292+
Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization)
292293
293294
294295
Python 3.16 will start with 3700
@@ -302,7 +303,7 @@ PC/launcher.c must also be updated.
302303
303304
*/
304305

305-
#define PYC_MAGIC_NUMBER 3658
306+
#define PYC_MAGIC_NUMBER 3659
306307
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
307308
(little-endian) and then appending b'\r\n'. */
308309
#define PYC_MAGIC_NUMBER_TOKEN \

Include/internal/pycore_opcode_metadata.h

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

0 commit comments

Comments
 (0)