mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
gh-100239: specialize long tail of binary operations (#128722)
This commit is contained in:
parent
e81fe940c9
commit
3893a92d95
21 changed files with 796 additions and 492 deletions
|
@ -100,6 +100,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
_Py_BackoffCounter counter;
|
||||
uint16_t external_cache[4];
|
||||
} _PyBinaryOpCache;
|
||||
|
||||
#define INLINE_CACHE_ENTRIES_BINARY_OP CACHE_ENTRIES(_PyBinaryOpCache)
|
||||
|
@ -438,7 +439,7 @@ write_u64(uint16_t *p, uint64_t val)
|
|||
}
|
||||
|
||||
static inline void
|
||||
write_obj(uint16_t *p, PyObject *val)
|
||||
write_ptr(uint16_t *p, void *val)
|
||||
{
|
||||
memcpy(p, &val, sizeof(val));
|
||||
}
|
||||
|
@ -576,6 +577,16 @@ adaptive_counter_backoff(_Py_BackoffCounter counter) {
|
|||
return restart_backoff_counter(counter);
|
||||
}
|
||||
|
||||
/* Specialization Extensions */
|
||||
|
||||
/* callbacks for an external specialization */
|
||||
typedef int (*binaryopguardfunc)(PyObject *lhs, PyObject *rhs);
|
||||
typedef PyObject *(*binaryopactionfunc)(PyObject *lhs, PyObject *rhs);
|
||||
|
||||
typedef struct {
|
||||
binaryopguardfunc guard;
|
||||
binaryopactionfunc action;
|
||||
} _PyBinaryOpSpecializationDescr;
|
||||
|
||||
/* Comparison bit masks. */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue