mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
GH-101291: Refactor the PyLongObject
struct into object header and PyLongValue struct. (GH-101292)
This commit is contained in:
parent
f5a3d91b6c
commit
c1b1f51cd1
13 changed files with 226 additions and 217 deletions
|
@ -357,8 +357,8 @@ dummy_func(
|
|||
|
||||
// Deopt unless 0 <= sub < PyList_Size(list)
|
||||
DEOPT_IF(!_PyLong_IsPositiveSingleDigit(sub), BINARY_SUBSCR);
|
||||
assert(((PyLongObject *)_PyLong_GetZero())->ob_digit[0] == 0);
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
|
||||
assert(((PyLongObject *)_PyLong_GetZero())->long_value.ob_digit[0] == 0);
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
|
||||
DEOPT_IF(index >= PyList_GET_SIZE(list), BINARY_SUBSCR);
|
||||
STAT_INC(BINARY_SUBSCR, hit);
|
||||
res = PyList_GET_ITEM(list, index);
|
||||
|
@ -375,8 +375,8 @@ dummy_func(
|
|||
|
||||
// Deopt unless 0 <= sub < PyTuple_Size(list)
|
||||
DEOPT_IF(!_PyLong_IsPositiveSingleDigit(sub), BINARY_SUBSCR);
|
||||
assert(((PyLongObject *)_PyLong_GetZero())->ob_digit[0] == 0);
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
|
||||
assert(((PyLongObject *)_PyLong_GetZero())->long_value.ob_digit[0] == 0);
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
|
||||
DEOPT_IF(index >= PyTuple_GET_SIZE(tuple), BINARY_SUBSCR);
|
||||
STAT_INC(BINARY_SUBSCR, hit);
|
||||
res = PyTuple_GET_ITEM(tuple, index);
|
||||
|
@ -469,7 +469,7 @@ dummy_func(
|
|||
|
||||
// Ensure nonnegative, zero-or-one-digit ints.
|
||||
DEOPT_IF(!_PyLong_IsPositiveSingleDigit(sub), STORE_SUBSCR);
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
|
||||
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
|
||||
// Ensure index < len(list)
|
||||
DEOPT_IF(index >= PyList_GET_SIZE(list), STORE_SUBSCR);
|
||||
STAT_INC(STORE_SUBSCR, hit);
|
||||
|
@ -1834,8 +1834,8 @@ dummy_func(
|
|||
DEOPT_IF((size_t)(Py_SIZE(right) + 1) > 2, COMPARE_AND_BRANCH);
|
||||
STAT_INC(COMPARE_AND_BRANCH, hit);
|
||||
assert(Py_ABS(Py_SIZE(left)) <= 1 && Py_ABS(Py_SIZE(right)) <= 1);
|
||||
Py_ssize_t ileft = Py_SIZE(left) * ((PyLongObject *)left)->ob_digit[0];
|
||||
Py_ssize_t iright = Py_SIZE(right) * ((PyLongObject *)right)->ob_digit[0];
|
||||
Py_ssize_t ileft = Py_SIZE(left) * ((PyLongObject *)left)->long_value.ob_digit[0];
|
||||
Py_ssize_t iright = Py_SIZE(right) * ((PyLongObject *)right)->long_value.ob_digit[0];
|
||||
// 2 if <, 4 if >, 8 if ==; this matches the low 4 bits of the oparg
|
||||
int sign_ish = COMPARISON_BIT(ileft, iright);
|
||||
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue