@@ -292,7 +292,7 @@ dummy_func(
292
292
BINARY_SUBSCR_TUPLE_INT ,
293
293
};
294
294
295
- inst (BINARY_SUBSCR , (unused /4 , container , sub -- res )) {
295
+ inst (BINARY_SUBSCR , (unused /1 , container , sub -- res )) {
296
296
#if ENABLE_SPECIALIZATION
297
297
_PyBinarySubscrCache * cache = (_PyBinarySubscrCache * )next_instr ;
298
298
if (ADAPTIVE_COUNTER_IS_ZERO (cache -> counter )) {
@@ -339,7 +339,7 @@ dummy_func(
339
339
ERROR_IF (err , error );
340
340
}
341
341
342
- inst (BINARY_SUBSCR_LIST_INT , (unused /4 , list , sub -- res )) {
342
+ inst (BINARY_SUBSCR_LIST_INT , (unused /1 , list , sub -- res )) {
343
343
assert (cframe .use_tracing == 0 );
344
344
DEOPT_IF (!PyLong_CheckExact (sub ), BINARY_SUBSCR );
345
345
DEOPT_IF (!PyList_CheckExact (list ), BINARY_SUBSCR );
@@ -356,7 +356,7 @@ dummy_func(
356
356
Py_DECREF (list );
357
357
}
358
358
359
- inst (BINARY_SUBSCR_TUPLE_INT , (unused /4 , tuple , sub -- res )) {
359
+ inst (BINARY_SUBSCR_TUPLE_INT , (unused /1 , tuple , sub -- res )) {
360
360
assert (cframe .use_tracing == 0 );
361
361
DEOPT_IF (!PyLong_CheckExact (sub ), BINARY_SUBSCR );
362
362
DEOPT_IF (!PyTuple_CheckExact (tuple ), BINARY_SUBSCR );
@@ -373,7 +373,7 @@ dummy_func(
373
373
Py_DECREF (tuple );
374
374
}
375
375
376
- inst (BINARY_SUBSCR_DICT , (unused /4 , dict , sub -- res )) {
376
+ inst (BINARY_SUBSCR_DICT , (unused /1 , dict , sub -- res )) {
377
377
assert (cframe .use_tracing == 0 );
378
378
DEOPT_IF (!PyDict_CheckExact (dict ), BINARY_SUBSCR );
379
379
STAT_INC (BINARY_SUBSCR , hit );
@@ -389,14 +389,16 @@ dummy_func(
389
389
DECREF_INPUTS ();
390
390
}
391
391
392
- inst (BINARY_SUBSCR_GETITEM , (unused /1 , type_version / 2 , func_version / 1 , container , sub -- unused )) {
392
+ inst (BINARY_SUBSCR_GETITEM , (unused /1 , container , sub -- unused )) {
393
393
PyTypeObject * tp = Py_TYPE (container );
394
- DEOPT_IF (tp -> tp_version_tag != type_version , BINARY_SUBSCR );
395
- assert (tp -> tp_flags & Py_TPFLAGS_HEAPTYPE );
396
- PyObject * cached = ((PyHeapTypeObject * )tp )-> _spec_cache .getitem ;
394
+ DEOPT_IF (!PyType_HasFeature (tp , Py_TPFLAGS_HEAPTYPE ), BINARY_SUBSCR );
395
+ PyHeapTypeObject * ht = (PyHeapTypeObject * )tp ;
396
+ PyObject * cached = ht -> _spec_cache .getitem ;
397
+ DEOPT_IF (cached == NULL , BINARY_SUBSCR );
397
398
assert (PyFunction_Check (cached ));
398
399
PyFunctionObject * getitem = (PyFunctionObject * )cached ;
399
- DEOPT_IF (getitem -> func_version != func_version , BINARY_SUBSCR );
400
+ uint32_t cached_version = ht -> _spec_cache .getitem_version ;
401
+ DEOPT_IF (getitem -> func_version != cached_version , BINARY_SUBSCR );
400
402
PyCodeObject * code = (PyCodeObject * )getitem -> func_code ;
401
403
assert (code -> co_argcount == 2 );
402
404
DEOPT_IF (!_PyThreadState_HasStackSpace (tstate , code -> co_framesize ), BINARY_SUBSCR );
0 commit comments