gh-135379: Move PyLong_CheckCompact to private header and rename it (GH-135707)

This commit is contained in:
Ken Jin 2025-06-19 21:09:09 +08:00 committed by GitHub
parent ff639af8ee
commit 0243260284
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 26 deletions

View file

@ -569,12 +569,12 @@ dummy_func(
op(_GUARD_NOS_INT, (left, unused -- left, unused)) {
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
EXIT_IF(!PyLong_CheckCompact(left_o));
EXIT_IF(!_PyLong_CheckExactAndCompact(left_o));
}
op(_GUARD_TOS_INT, (value -- value)) {
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
EXIT_IF(!PyLong_CheckCompact(value_o));
EXIT_IF(!_PyLong_CheckExactAndCompact(value_o));
}
op(_GUARD_NOS_OVERFLOWED, (left, unused -- left, unused)) {

View file

@ -852,7 +852,7 @@
_PyStackRef left;
left = stack_pointer[-2];
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
if (!PyLong_CheckCompact(left_o)) {
if (!_PyLong_CheckExactAndCompact(left_o)) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
@ -863,7 +863,7 @@
_PyStackRef value;
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}

View file

@ -158,7 +158,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -168,7 +168,7 @@
{
left = stack_pointer[-2];
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
if (!PyLong_CheckCompact(left_o)) {
if (!_PyLong_CheckExactAndCompact(left_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -483,7 +483,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -493,7 +493,7 @@
{
left = stack_pointer[-2];
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
if (!PyLong_CheckCompact(left_o)) {
if (!_PyLong_CheckExactAndCompact(left_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -694,7 +694,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -856,7 +856,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -934,7 +934,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -1064,7 +1064,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -1074,7 +1074,7 @@
{
left = stack_pointer[-2];
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
if (!PyLong_CheckCompact(left_o)) {
if (!_PyLong_CheckExactAndCompact(left_o)) {
UPDATE_MISS_STATS(BINARY_OP);
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
JUMP_TO_PREDICTED(BINARY_OP);
@ -4893,7 +4893,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(COMPARE_OP);
assert(_PyOpcode_Deopt[opcode] == (COMPARE_OP));
JUMP_TO_PREDICTED(COMPARE_OP);
@ -4903,7 +4903,7 @@
{
left = stack_pointer[-2];
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
if (!PyLong_CheckCompact(left_o)) {
if (!_PyLong_CheckExactAndCompact(left_o)) {
UPDATE_MISS_STATS(COMPARE_OP);
assert(_PyOpcode_Deopt[opcode] == (COMPARE_OP));
JUMP_TO_PREDICTED(COMPARE_OP);
@ -11473,7 +11473,7 @@
{
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyLong_CheckCompact(value_o)) {
if (!_PyLong_CheckExactAndCompact(value_o)) {
UPDATE_MISS_STATS(STORE_SUBSCR);
assert(_PyOpcode_Deopt[opcode] == (STORE_SUBSCR));
JUMP_TO_PREDICTED(STORE_SUBSCR);

View file

@ -386,7 +386,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptRef ref, PyObject *const_val)
make_const(sym, const_val);
return;
case JIT_SYM_COMPACT_INT:
if (PyLong_CheckCompact(const_val)) {
if (_PyLong_CheckExactAndCompact(const_val)) {
make_const(sym, const_val);
}
else {
@ -679,7 +679,7 @@ _Py_uop_sym_is_compact_int(JitOptRef ref)
{
JitOptSymbol *sym = PyJitRef_Unwrap(ref);
if (sym->tag == JIT_SYM_KNOWN_VALUE_TAG) {
return (bool)PyLong_CheckCompact(sym->value.value);
return (bool)_PyLong_CheckExactAndCompact(sym->value.value);
}
return sym->tag == JIT_SYM_COMPACT_INT;
}
@ -716,7 +716,7 @@ _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef ref)
}
return;
case JIT_SYM_KNOWN_VALUE_TAG:
if (!PyLong_CheckCompact(sym->value.value)) {
if (!_PyLong_CheckExactAndCompact(sym->value.value)) {
Py_CLEAR(sym->value.value);
sym_set_bottom(ctx, sym);
}