@@ -210,7 +210,7 @@ dummy_func(
210
210
}
211
211
212
212
inst (LOAD_CONST , (-- value )) {
213
- value = GETITEM (frame -> f_code -> co_consts , oparg );
213
+ value = GETITEM (FRAME_CO_CONSTS , oparg );
214
214
Py_INCREF (value );
215
215
}
216
216
@@ -711,7 +711,7 @@ dummy_func(
711
711
}
712
712
713
713
inst (RETURN_CONST , (-- )) {
714
- PyObject * retval = GETITEM (frame -> f_code -> co_consts , oparg );
714
+ PyObject * retval = GETITEM (FRAME_CO_CONSTS , oparg );
715
715
Py_INCREF (retval );
716
716
assert (EMPTY ());
717
717
_PyFrame_SetStackPointer (frame , stack_pointer );
@@ -727,7 +727,7 @@ dummy_func(
727
727
}
728
728
729
729
inst (INSTRUMENTED_RETURN_CONST , (-- )) {
730
- PyObject * retval = GETITEM (frame -> f_code -> co_consts , oparg );
730
+ PyObject * retval = GETITEM (FRAME_CO_CONSTS , oparg );
731
731
int err = _Py_call_instrumentation_arg (
732
732
tstate , PY_MONITORING_EVENT_PY_RETURN ,
733
733
frame , next_instr - 1 , retval );
@@ -924,6 +924,7 @@ dummy_func(
924
924
925
925
inst (INSTRUMENTED_YIELD_VALUE , (retval -- unused )) {
926
926
assert (frame != & entry_frame );
927
+ assert (oparg >= 0 ); /* make the generator identify this as HAS_ARG */
927
928
PyGenObject * gen = _PyFrame_GetGenerator (frame );
928
929
gen -> gi_frame_state = FRAME_SUSPENDED ;
929
930
_PyFrame_SetStackPointer (frame , stack_pointer - 1 );
@@ -945,6 +946,7 @@ dummy_func(
945
946
// NOTE: It's important that YIELD_VALUE never raises an exception!
946
947
// The compiler treats any exception raised here as a failed close()
947
948
// or throw() call.
949
+ assert (oparg >= 0 ); /* make the generator identify this as HAS_ARG */
948
950
assert (frame != & entry_frame );
949
951
PyGenObject * gen = _PyFrame_GetGenerator (frame );
950
952
gen -> gi_frame_state = FRAME_SUSPENDED ;
@@ -1040,7 +1042,7 @@ dummy_func(
1040
1042
1041
1043
1042
1044
inst (STORE_NAME , (v -- )) {
1043
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1045
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1044
1046
PyObject * ns = LOCALS ();
1045
1047
int err ;
1046
1048
if (ns == NULL ) {
@@ -1058,7 +1060,7 @@ dummy_func(
1058
1060
}
1059
1061
1060
1062
inst (DELETE_NAME , (-- )) {
1061
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1063
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1062
1064
PyObject * ns = LOCALS ();
1063
1065
int err ;
1064
1066
if (ns == NULL ) {
@@ -1150,7 +1152,7 @@ dummy_func(
1150
1152
inst (STORE_ATTR , (counter /1 , unused /3 , v , owner -- )) {
1151
1153
#if ENABLE_SPECIALIZATION
1152
1154
if (ADAPTIVE_COUNTER_IS_ZERO (counter )) {
1153
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1155
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1154
1156
next_instr -- ;
1155
1157
_Py_Specialize_StoreAttr (owner , next_instr , name );
1156
1158
DISPATCH_SAME_OPARG ();
@@ -1161,28 +1163,28 @@ dummy_func(
1161
1163
#else
1162
1164
(void )counter ; // Unused.
1163
1165
#endif /* ENABLE_SPECIALIZATION */
1164
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1166
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1165
1167
int err = PyObject_SetAttr (owner , name , v );
1166
1168
DECREF_INPUTS ();
1167
1169
ERROR_IF (err , error );
1168
1170
}
1169
1171
1170
1172
inst (DELETE_ATTR , (owner -- )) {
1171
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1173
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1172
1174
int err = PyObject_SetAttr (owner , name , (PyObject * )NULL );
1173
1175
DECREF_INPUTS ();
1174
1176
ERROR_IF (err , error );
1175
1177
}
1176
1178
1177
1179
inst (STORE_GLOBAL , (v -- )) {
1178
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1180
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1179
1181
int err = PyDict_SetItem (GLOBALS (), name , v );
1180
1182
DECREF_INPUTS ();
1181
1183
ERROR_IF (err , error );
1182
1184
}
1183
1185
1184
1186
inst (DELETE_GLOBAL , (-- )) {
1185
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1187
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1186
1188
int err ;
1187
1189
err = PyDict_DelItem (GLOBALS (), name );
1188
1190
// Can't use ERROR_IF here.
@@ -1208,7 +1210,7 @@ dummy_func(
1208
1210
macro (LOAD_LOCALS ) = _LOAD_LOCALS ;
1209
1211
1210
1212
op (_LOAD_FROM_DICT_OR_GLOBALS , (mod_or_class_dict -- v )) {
1211
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1213
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1212
1214
if (PyDict_CheckExact (mod_or_class_dict )) {
1213
1215
v = PyDict_GetItemWithError (mod_or_class_dict , name );
1214
1216
if (v != NULL ) {
@@ -1280,15 +1282,15 @@ dummy_func(
1280
1282
#if ENABLE_SPECIALIZATION
1281
1283
_PyLoadGlobalCache * cache = (_PyLoadGlobalCache * )next_instr ;
1282
1284
if (ADAPTIVE_COUNTER_IS_ZERO (cache -> counter )) {
1283
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >>1 );
1285
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >>1 );
1284
1286
next_instr -- ;
1285
1287
_Py_Specialize_LoadGlobal (GLOBALS (), BUILTINS (), next_instr , name );
1286
1288
DISPATCH_SAME_OPARG ();
1287
1289
}
1288
1290
STAT_INC (LOAD_GLOBAL , deferred );
1289
1291
DECREMENT_ADAPTIVE_COUNTER (cache -> counter );
1290
1292
#endif /* ENABLE_SPECIALIZATION */
1291
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >>1 );
1293
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >>1 );
1292
1294
if (PyDict_CheckExact (GLOBALS ())
1293
1295
&& PyDict_CheckExact (BUILTINS ()))
1294
1296
{
@@ -1630,7 +1632,7 @@ dummy_func(
1630
1632
};
1631
1633
1632
1634
inst (LOAD_SUPER_ATTR , (unused /1 , global_super , class , self -- res2 if (oparg & 1 ), res )) {
1633
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >> 2 );
1635
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 2 );
1634
1636
int load_method = oparg & 1 ;
1635
1637
#if ENABLE_SPECIALIZATION
1636
1638
_PySuperAttrCache * cache = (_PySuperAttrCache * )next_instr ;
@@ -1695,7 +1697,7 @@ dummy_func(
1695
1697
DEOPT_IF (global_super != (PyObject * )& PySuper_Type , LOAD_SUPER_ATTR );
1696
1698
DEOPT_IF (!PyType_Check (class ), LOAD_SUPER_ATTR );
1697
1699
STAT_INC (LOAD_SUPER_ATTR , hit );
1698
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >> 2 );
1700
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 2 );
1699
1701
res = _PySuper_Lookup ((PyTypeObject * )class , self , name , NULL );
1700
1702
DECREF_INPUTS ();
1701
1703
ERROR_IF (res == NULL , error );
@@ -1706,7 +1708,7 @@ dummy_func(
1706
1708
DEOPT_IF (global_super != (PyObject * )& PySuper_Type , LOAD_SUPER_ATTR );
1707
1709
DEOPT_IF (!PyType_Check (class ), LOAD_SUPER_ATTR );
1708
1710
STAT_INC (LOAD_SUPER_ATTR , hit );
1709
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >> 2 );
1711
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 2 );
1710
1712
PyTypeObject * cls = (PyTypeObject * )class ;
1711
1713
int method_found = 0 ;
1712
1714
res2 = _PySuper_Lookup (cls , self , name ,
@@ -1744,15 +1746,15 @@ dummy_func(
1744
1746
#if ENABLE_SPECIALIZATION
1745
1747
_PyAttrCache * cache = (_PyAttrCache * )next_instr ;
1746
1748
if (ADAPTIVE_COUNTER_IS_ZERO (cache -> counter )) {
1747
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >>1 );
1749
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >>1 );
1748
1750
next_instr -- ;
1749
1751
_Py_Specialize_LoadAttr (owner , next_instr , name );
1750
1752
DISPATCH_SAME_OPARG ();
1751
1753
}
1752
1754
STAT_INC (LOAD_ATTR , deferred );
1753
1755
DECREMENT_ADAPTIVE_COUNTER (cache -> counter );
1754
1756
#endif /* ENABLE_SPECIALIZATION */
1755
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >> 1 );
1757
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 1 );
1756
1758
if (oparg & 1 ) {
1757
1759
/* Designed to work in tandem with CALL, pushes two values. */
1758
1760
PyObject * meth = NULL ;
@@ -1834,7 +1836,7 @@ dummy_func(
1834
1836
PyDictObject * dict = (PyDictObject * )_PyDictOrValues_GetDict (dorv );
1835
1837
DEOPT_IF (dict == NULL , LOAD_ATTR );
1836
1838
assert (PyDict_CheckExact ((PyObject * )dict ));
1837
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >>1 );
1839
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >>1 );
1838
1840
uint16_t hint = index ;
1839
1841
DEOPT_IF (hint >= (size_t )dict -> ma_keys -> dk_nentries , LOAD_ATTR );
1840
1842
if (DK_IS_UNICODE (dict -> ma_keys )) {
@@ -1922,7 +1924,7 @@ dummy_func(
1922
1924
DEOPT_IF (!_PyThreadState_HasStackSpace (tstate , code -> co_framesize ), LOAD_ATTR );
1923
1925
STAT_INC (LOAD_ATTR , hit );
1924
1926
1925
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg >> 1 );
1927
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 1 );
1926
1928
Py_INCREF (f );
1927
1929
_PyInterpreterFrame * new_frame = _PyFrame_PushUnchecked (tstate , f , 2 );
1928
1930
// Manipulate stack directly because we exit with DISPATCH_INLINED().
@@ -1966,7 +1968,7 @@ dummy_func(
1966
1968
PyDictObject * dict = (PyDictObject * )_PyDictOrValues_GetDict (dorv );
1967
1969
DEOPT_IF (dict == NULL , STORE_ATTR );
1968
1970
assert (PyDict_CheckExact ((PyObject * )dict ));
1969
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
1971
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1970
1972
DEOPT_IF (hint >= (size_t )dict -> ma_keys -> dk_nentries , STORE_ATTR );
1971
1973
PyObject * old_value ;
1972
1974
uint64_t new_version ;
@@ -2126,14 +2128,14 @@ dummy_func(
2126
2128
}
2127
2129
2128
2130
inst (IMPORT_NAME , (level , fromlist -- res )) {
2129
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
2131
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
2130
2132
res = import_name (tstate , frame , name , fromlist , level );
2131
2133
DECREF_INPUTS ();
2132
2134
ERROR_IF (res == NULL , error );
2133
2135
}
2134
2136
2135
2137
inst (IMPORT_FROM , (from -- from , res )) {
2136
- PyObject * name = GETITEM (frame -> f_code -> co_names , oparg );
2138
+ PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
2137
2139
res = import_from (tstate , from , name );
2138
2140
ERROR_IF (res == NULL , error );
2139
2141
}
@@ -2637,8 +2639,8 @@ dummy_func(
2637
2639
2638
2640
inst (KW_NAMES , (-- )) {
2639
2641
assert (kwnames == NULL );
2640
- assert (oparg < PyTuple_GET_SIZE (frame -> f_code -> co_consts ));
2641
- kwnames = GETITEM (frame -> f_code -> co_consts , oparg );
2642
+ assert (oparg < PyTuple_GET_SIZE (FRAME_CO_CONSTS ));
2643
+ kwnames = GETITEM (FRAME_CO_CONSTS , oparg );
2642
2644
}
2643
2645
2644
2646
inst (INSTRUMENTED_CALL , ( -- )) {
0 commit comments