Skip to content

Commit 7114cf2

Browse files
gh-116381: Specialize CONTAINS_OP (GH-116385)
* Specialize CONTAINS_OP * πŸ“œπŸ€– Added by blurb_it. * Add PyAPI_FUNC for JIT --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 73807eb commit 7114cf2

21 files changed

+645
-194
lines changed

Diff for: β€ŽInclude/internal/pycore_code.h

+7
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ typedef struct {
121121

122122
#define INLINE_CACHE_ENTRIES_TO_BOOL CACHE_ENTRIES(_PyToBoolCache)
123123

124+
typedef struct {
125+
uint16_t counter;
126+
} _PyContainsOpCache;
127+
128+
#define INLINE_CACHE_ENTRIES_CONTAINS_OP CACHE_ENTRIES(_PyContainsOpCache)
129+
124130
// Borrowed references to common callables:
125131
struct callable_cache {
126132
PyObject *isinstance;
@@ -277,6 +283,7 @@ extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr,
277283
extern void _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr, int oparg);
278284
extern void _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr);
279285
extern void _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr);
286+
extern void _Py_Specialize_ContainsOp(PyObject *value, _Py_CODEUNIT *instr);
280287

281288
/* Finalizer function for static codeobjects used in deepfreeze.py */
282289
extern void _PyStaticCode_Fini(PyCodeObject *co);

Diff for: β€ŽInclude/internal/pycore_list.h

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ typedef struct {
5656

5757
PyAPI_FUNC(PyObject *)_PyList_FromArraySteal(PyObject *const *src, Py_ssize_t n);
5858

59+
PyAPI_FUNC(int) _PyList_Contains(PyObject *aa, PyObject *el);
60+
5961
#ifdef __cplusplus
6062
}
6163
#endif

Diff for: β€ŽInclude/internal/pycore_opcode_metadata.h

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

Diff for: β€ŽInclude/internal/pycore_setobject.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
2121
// Export for the gdb plugin's (python-gdb.py) benefit
2222
PyAPI_DATA(PyObject *) _PySet_Dummy;
2323

24+
PyAPI_FUNC(int) _PySet_Contains(PySetObject *so, PyObject *key);
25+
2426
#ifdef __cplusplus
2527
}
2628
#endif

Diff for: β€ŽInclude/internal/pycore_tuple.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ typedef struct {
2929
PyTupleObject *it_seq; /* Set to NULL when iterator is exhausted */
3030
} _PyTupleIterObject;
3131

32+
PyAPI_FUNC(int) _PyTuple_Contains(PyTupleObject *a, PyObject *el);
33+
3234
#ifdef __cplusplus
3335
}
3436
#endif

0 commit comments

Comments
Β (0)