diff options
author | Mark Shannon <mark@hotpy.org> | 2024-08-21 14:52:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 14:52:04 (GMT) |
commit | a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57 (patch) | |
tree | 026af8576d2d3e05b56c475574606f13f69cf040 /Python/generated_cases.c.h | |
parent | 4b7c4880a0b264373e65235701bb78cbf19266b5 (diff) | |
download | cpython-a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57.zip cpython-a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57.tar.gz cpython-a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57.tar.bz2 |
GH-115776: Allow any fixed sized object to have inline values (GH-123192)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 42a58bb..13bbff2 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -4999,9 +4999,10 @@ } // _LOAD_ATTR_INSTANCE_VALUE { - uint16_t index = read_u16(&this_instr[4].cache); + uint16_t offset = read_u16(&this_instr[4].cache); PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner); - PyObject *attr_o = _PyObject_InlineValues(owner_o)->values[index]; + PyObject **value_ptr = (PyObject**)(((char *)owner_o) + offset); + PyObject *attr_o = *value_ptr; DEOPT_IF(attr_o == NULL, LOAD_ATTR); STAT_INC(LOAD_ATTR, hit); Py_INCREF(attr_o); @@ -6829,14 +6830,16 @@ // _STORE_ATTR_INSTANCE_VALUE value = stack_pointer[-2]; { - uint16_t index = read_u16(&this_instr[4].cache); + uint16_t offset = read_u16(&this_instr[4].cache); PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner); STAT_INC(STORE_ATTR, hit); assert(_PyObject_GetManagedDict(owner_o) == NULL); - PyDictValues *values = _PyObject_InlineValues(owner_o); - PyObject *old_value = values->values[index]; - values->values[index] = PyStackRef_AsPyObjectSteal(value); + PyObject **value_ptr = (PyObject**)(((char *)owner_o) + offset); + PyObject *old_value = *value_ptr; + *value_ptr = PyStackRef_AsPyObjectSteal(value); if (old_value == NULL) { + PyDictValues *values = _PyObject_InlineValues(owner_o); + int index = value_ptr - values->values; _PyDictValues_AddToInsertionOrder(values, index); } else { |