aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-08-21 15:52:04 +0100
committerGitHub <noreply@github.com>2024-08-21 15:52:04 +0100
commita4fd7aa4a6420cef1c22ec64eab54d8aea41cc57 (patch)
tree026af8576d2d3e05b56c475574606f13f69cf040 /Python/executor_cases.c.h
parent4b7c4880a0b264373e65235701bb78cbf19266b5 (diff)
downloadcpython-a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57.tar.gz
cpython-a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57.zip
GH-115776: Allow any fixed sized object to have inline values (GH-123192)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 1db8e506732..55b06a0e235 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -2277,9 +2277,10 @@
_PyStackRef null = PyStackRef_NULL;
(void)null;
owner = stack_pointer[-1];
- uint16_t index = (uint16_t)CURRENT_OPERAND();
+ uint16_t offset = (uint16_t)CURRENT_OPERAND();
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;
if (attr_o == NULL) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
@@ -2299,9 +2300,10 @@
_PyStackRef null = PyStackRef_NULL;
(void)null;
owner = stack_pointer[-1];
- uint16_t index = (uint16_t)CURRENT_OPERAND();
+ uint16_t offset = (uint16_t)CURRENT_OPERAND();
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;
if (attr_o == NULL) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
@@ -2583,14 +2585,16 @@
_PyStackRef value;
owner = stack_pointer[-1];
value = stack_pointer[-2];
- uint16_t index = (uint16_t)CURRENT_OPERAND();
+ uint16_t offset = (uint16_t)CURRENT_OPERAND();
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 {