mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-44889: Specialize LOAD_METHOD with PEP 659 adaptive interpreter (GH-27722)
Adds four new instructions: * LOAD_METHOD_ADAPTIVE * LOAD_METHOD_CACHED * LOAD_METHOD_MODULE * LOAD_METHOD_CLASS
This commit is contained in:
parent
fcd651d16f
commit
96346cb6d0
7 changed files with 351 additions and 46 deletions
|
|
@ -30,6 +30,11 @@ typedef struct {
|
|||
uint32_t builtin_keys_version;
|
||||
} _PyLoadGlobalCache;
|
||||
|
||||
typedef struct {
|
||||
/* Borrowed ref in LOAD_METHOD */
|
||||
PyObject *obj;
|
||||
} _PyObjectCache;
|
||||
|
||||
/* Add specialized versions of entries to this union.
|
||||
*
|
||||
* Do not break the invariant: sizeof(SpecializedCacheEntry) == 8
|
||||
|
|
@ -45,6 +50,7 @@ typedef union {
|
|||
_PyAdaptiveEntry adaptive;
|
||||
_PyAttrCache attr;
|
||||
_PyLoadGlobalCache load_global;
|
||||
_PyObjectCache obj;
|
||||
} SpecializedCacheEntry;
|
||||
|
||||
#define INSTRUCTIONS_PER_ENTRY (sizeof(SpecializedCacheEntry)/sizeof(_Py_CODEUNIT))
|
||||
|
|
@ -299,6 +305,7 @@ cache_backoff(_PyAdaptiveEntry *entry) {
|
|||
int _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache);
|
||||
int _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache);
|
||||
int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache);
|
||||
int _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache);
|
||||
int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr);
|
||||
|
||||
#define PRINT_SPECIALIZATION_STATS 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue