@@ -376,7 +376,7 @@ dummy_func(
376
376
377
377
pure inst (UNARY_NOT , (value -- res )) {
378
378
assert (PyStackRef_BoolCheck (value ));
379
- res = PyStackRef_Is (value , PyStackRef_False )
379
+ res = PyStackRef_IsExactly (value , PyStackRef_False )
380
380
? PyStackRef_True : PyStackRef_False ;
381
381
DEAD (value );
382
382
}
@@ -441,7 +441,7 @@ dummy_func(
441
441
442
442
inst (TO_BOOL_NONE , (unused /1 , unused /2 , value -- res )) {
443
443
// This one is a bit weird, because we expect *some* failures:
444
- EXIT_IF (!PyStackRef_Is (value , PyStackRef_None ));
444
+ EXIT_IF (!PyStackRef_IsNone (value ));
445
445
DEAD (value );
446
446
STAT_INC (TO_BOOL , hit );
447
447
res = PyStackRef_False ;
@@ -651,9 +651,7 @@ dummy_func(
651
651
// specializations, but there is no output.
652
652
// At the end we just skip over the STORE_FAST.
653
653
op (_BINARY_OP_INPLACE_ADD_UNICODE , (left , right -- )) {
654
- #ifndef NDEBUG
655
654
PyObject * left_o = PyStackRef_AsPyObjectBorrow (left );
656
- #endif
657
655
PyObject * right_o = PyStackRef_AsPyObjectBorrow (right );
658
656
659
657
int next_oparg ;
@@ -664,7 +662,7 @@ dummy_func(
664
662
next_oparg = CURRENT_OPERAND0 ();
665
663
#endif
666
664
_PyStackRef * target_local = & GETLOCAL (next_oparg );
667
- DEOPT_IF (! PyStackRef_Is (* target_local , left ) );
665
+ DEOPT_IF (PyStackRef_AsPyObjectBorrow (* target_local ) != left_o );
668
666
STAT_INC (BINARY_OP , hit );
669
667
/* Handle `left = left + right` or `left += right` for str.
670
668
*
@@ -1141,7 +1139,7 @@ dummy_func(
1141
1139
gen_frame -> previous = frame ;
1142
1140
DISPATCH_INLINED (gen_frame );
1143
1141
}
1144
- if (PyStackRef_Is ( v , PyStackRef_None ) && PyIter_Check (receiver_o )) {
1142
+ if (PyStackRef_IsNone ( v ) && PyIter_Check (receiver_o )) {
1145
1143
retval_o = Py_TYPE (receiver_o )-> tp_iternext (receiver_o );
1146
1144
}
1147
1145
else {
@@ -1249,7 +1247,7 @@ dummy_func(
1249
1247
inst (POP_EXCEPT , (exc_value -- )) {
1250
1248
_PyErr_StackItem * exc_info = tstate -> exc_info ;
1251
1249
Py_XSETREF (exc_info -> exc_value ,
1252
- PyStackRef_Is (exc_value , PyStackRef_None )
1250
+ PyStackRef_IsNone (exc_value )
1253
1251
? NULL : PyStackRef_AsPyObjectSteal (exc_value ));
1254
1252
}
1255
1253
@@ -2481,13 +2479,7 @@ dummy_func(
2481
2479
}
2482
2480
2483
2481
inst (IS_OP , (left , right -- b )) {
2484
- #ifdef Py_GIL_DISABLED
2485
- // On free-threaded builds, objects are conditionally immortalized.
2486
- // So their bits don't always compare equally.
2487
2482
int res = Py_Is (PyStackRef_AsPyObjectBorrow (left ), PyStackRef_AsPyObjectBorrow (right )) ^ oparg ;
2488
- #else
2489
- int res = PyStackRef_Is (left , right ) ^ oparg ;
2490
- #endif
2491
2483
DECREF_INPUTS ();
2492
2484
b = res ? PyStackRef_True : PyStackRef_False ;
2493
2485
}
@@ -2693,22 +2685,23 @@ dummy_func(
2693
2685
2694
2686
replaced op (_POP_JUMP_IF_FALSE , (cond -- )) {
2695
2687
assert (PyStackRef_BoolCheck (cond ));
2696
- int flag = PyStackRef_Is (cond , PyStackRef_False );
2688
+ // int flag = PyStackRef_IsExactly(cond, PyStackRef_False);
2689
+ int flag = PyStackRef_IsFalse (cond );
2697
2690
DEAD (cond );
2698
2691
RECORD_BRANCH_TAKEN (this_instr [1 ].cache , flag );
2699
2692
JUMPBY (oparg * flag );
2700
2693
}
2701
2694
2702
2695
replaced op (_POP_JUMP_IF_TRUE , (cond -- )) {
2703
2696
assert (PyStackRef_BoolCheck (cond ));
2704
- int flag = PyStackRef_Is (cond , PyStackRef_True );
2697
+ int flag = PyStackRef_IsExactly (cond , PyStackRef_True );
2705
2698
DEAD (cond );
2706
2699
RECORD_BRANCH_TAKEN (this_instr [1 ].cache , flag );
2707
2700
JUMPBY (oparg * flag );
2708
2701
}
2709
2702
2710
2703
op (_IS_NONE , (value -- b )) {
2711
- if (PyStackRef_Is (value , PyStackRef_None )) {
2704
+ if (PyStackRef_IsNone (value )) {
2712
2705
b = PyStackRef_True ;
2713
2706
DEAD (value );
2714
2707
}
@@ -3752,7 +3745,7 @@ dummy_func(
3752
3745
3753
3746
inst (EXIT_INIT_CHECK , (should_be_none -- )) {
3754
3747
assert (STACK_LEVEL () == 2 );
3755
- if (!PyStackRef_Is (should_be_none , PyStackRef_None )) {
3748
+ if (!PyStackRef_IsNone (should_be_none )) {
3756
3749
PyErr_Format (PyExc_TypeError ,
3757
3750
"__init__() should return None, not '%.200s'" ,
3758
3751
Py_TYPE (PyStackRef_AsPyObjectBorrow (should_be_none ))-> tp_name );
@@ -4712,7 +4705,7 @@ dummy_func(
4712
4705
inst (INSTRUMENTED_POP_JUMP_IF_TRUE , (unused /1 -- )) {
4713
4706
_PyStackRef cond = POP ();
4714
4707
assert (PyStackRef_BoolCheck (cond ));
4715
- int flag = PyStackRef_Is (cond , PyStackRef_True );
4708
+ int flag = PyStackRef_IsExactly (cond , PyStackRef_True );
4716
4709
int offset = flag * oparg ;
4717
4710
RECORD_BRANCH_TAKEN (this_instr [1 ].cache , flag );
4718
4711
INSTRUMENTED_JUMP (this_instr , next_instr + offset , PY_MONITORING_EVENT_BRANCH );
@@ -4721,15 +4714,15 @@ dummy_func(
4721
4714
inst (INSTRUMENTED_POP_JUMP_IF_FALSE , (unused /1 -- )) {
4722
4715
_PyStackRef cond = POP ();
4723
4716
assert (PyStackRef_BoolCheck (cond ));
4724
- int flag = PyStackRef_Is (cond , PyStackRef_False );
4717
+ int flag = PyStackRef_IsFalse (cond );
4725
4718
int offset = flag * oparg ;
4726
4719
RECORD_BRANCH_TAKEN (this_instr [1 ].cache , flag );
4727
4720
INSTRUMENTED_JUMP (this_instr , next_instr + offset , PY_MONITORING_EVENT_BRANCH );
4728
4721
}
4729
4722
4730
4723
inst (INSTRUMENTED_POP_JUMP_IF_NONE , (unused /1 -- )) {
4731
4724
_PyStackRef value_stackref = POP ();
4732
- int flag = PyStackRef_Is (value_stackref , PyStackRef_None );
4725
+ int flag = PyStackRef_IsNone (value_stackref );
4733
4726
int offset ;
4734
4727
if (flag ) {
4735
4728
offset = oparg ;
@@ -4745,7 +4738,7 @@ dummy_func(
4745
4738
inst (INSTRUMENTED_POP_JUMP_IF_NOT_NONE , (unused /1 -- )) {
4746
4739
_PyStackRef value_stackref = POP ();
4747
4740
int offset ;
4748
- int nflag = PyStackRef_Is (value_stackref , PyStackRef_None );
4741
+ int nflag = PyStackRef_IsNone (value_stackref );
4749
4742
if (nflag ) {
4750
4743
offset = 0 ;
4751
4744
}
@@ -4780,21 +4773,21 @@ dummy_func(
4780
4773
///////// Tier-2 only opcodes /////////
4781
4774
4782
4775
op (_GUARD_IS_TRUE_POP , (flag -- )) {
4783
- int is_true = PyStackRef_Is (flag , PyStackRef_True );
4776
+ int is_true = PyStackRef_IsTrue (flag );
4784
4777
DEAD (flag );
4785
4778
SYNC_SP ();
4786
4779
EXIT_IF (!is_true );
4787
4780
}
4788
4781
4789
4782
op (_GUARD_IS_FALSE_POP , (flag -- )) {
4790
- int is_false = PyStackRef_Is (flag , PyStackRef_False );
4783
+ int is_false = PyStackRef_IsFalse (flag );
4791
4784
DEAD (flag );
4792
4785
SYNC_SP ();
4793
4786
EXIT_IF (!is_false );
4794
4787
}
4795
4788
4796
4789
op (_GUARD_IS_NONE_POP , (val -- )) {
4797
- int is_none = PyStackRef_Is (val , PyStackRef_None );
4790
+ int is_none = PyStackRef_IsNone (val );
4798
4791
if (!is_none ) {
4799
4792
PyStackRef_CLOSE (val );
4800
4793
SYNC_SP ();
@@ -4804,7 +4797,7 @@ dummy_func(
4804
4797
}
4805
4798
4806
4799
op (_GUARD_IS_NOT_NONE_POP , (val -- )) {
4807
- int is_none = PyStackRef_Is (val , PyStackRef_None );
4800
+ int is_none = PyStackRef_IsNone (val );
4808
4801
PyStackRef_CLOSE (val );
4809
4802
SYNC_SP ();
4810
4803
EXIT_IF (is_none );
0 commit comments