mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-106603: Make uop struct a triple (opcode, oparg, operand) (#106794)
This commit is contained in:
parent
7e96370a94
commit
8e9a1a0322
9 changed files with 191 additions and 110 deletions
14
Python/generated_cases.c.h
generated
14
Python/generated_cases.c.h
generated
|
@ -773,18 +773,15 @@
|
|||
PyObject *sub = stack_pointer[-1];
|
||||
PyObject *container = stack_pointer[-2];
|
||||
PyObject *v = stack_pointer[-3];
|
||||
uint16_t counter = read_u16(&next_instr[0].cache);
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
_PyStoreSubscrCache *cache = (_PyStoreSubscrCache *)next_instr;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
|
||||
next_instr--;
|
||||
_Py_Specialize_StoreSubscr(container, sub, next_instr);
|
||||
DISPATCH_SAME_OPARG();
|
||||
}
|
||||
STAT_INC(STORE_SUBSCR, deferred);
|
||||
_PyStoreSubscrCache *cache = (_PyStoreSubscrCache *)next_instr;
|
||||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
#else
|
||||
(void)counter; // Unused.
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
/* container[sub] = v */
|
||||
int err = PyObject_SetItem(container, sub, v);
|
||||
|
@ -1437,19 +1434,16 @@
|
|||
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
|
||||
PyObject *owner = stack_pointer[-1];
|
||||
PyObject *v = stack_pointer[-2];
|
||||
uint16_t counter = read_u16(&next_instr[0].cache);
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||
next_instr--;
|
||||
_Py_Specialize_StoreAttr(owner, next_instr, name);
|
||||
DISPATCH_SAME_OPARG();
|
||||
}
|
||||
STAT_INC(STORE_ATTR, deferred);
|
||||
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
|
||||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
#else
|
||||
(void)counter; // Unused.
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||
int err = PyObject_SetAttr(owner, name, v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue