@@ -43,10 +43,8 @@ dummy_func(void) {
43
43
44
44
op (_LOAD_FAST_AND_CLEAR , (-- value )) {
45
45
value = GETLOCAL (oparg );
46
- _Py_UOpsSymType * temp = sym_new_null (ctx );
47
- if (temp == NULL ) {
48
- goto out_of_space ;
49
- }
46
+ _Py_UOpsSymType * temp ;
47
+ OUT_OF_SPACE_IF_NULL (temp = sym_new_null (ctx ));
50
48
GETLOCAL (oparg ) = temp ;
51
49
}
52
50
@@ -89,14 +87,12 @@ dummy_func(void) {
89
87
if (temp == NULL ) {
90
88
goto error ;
91
89
}
92
- res = sym_new_const (ctx , temp );
93
- // TODO replace opcode with constant propagated one and add tests!
90
+ OUT_OF_SPACE_IF_NULL (res = sym_new_const (ctx , temp ));
91
+ // TODO gh-115506:
92
+ // replace opcode with constant propagated one and add tests!
94
93
}
95
94
else {
96
- res = sym_new_known_type (ctx , & PyLong_Type );
97
- if (res == NULL ) {
98
- goto out_of_space ;
99
- }
95
+ OUT_OF_SPACE_IF_NULL (res = sym_new_known_type (ctx , & PyLong_Type ));
100
96
}
101
97
}
102
98
@@ -109,14 +105,12 @@ dummy_func(void) {
109
105
if (temp == NULL ) {
110
106
goto error ;
111
107
}
112
- res = sym_new_const (ctx , temp );
113
- // TODO replace opcode with constant propagated one and add tests!
108
+ OUT_OF_SPACE_IF_NULL (res = sym_new_const (ctx , temp ));
109
+ // TODO gh-115506:
110
+ // replace opcode with constant propagated one and add tests!
114
111
}
115
112
else {
116
- res = sym_new_known_type (ctx , & PyLong_Type );
117
- if (res == NULL ) {
118
- goto out_of_space ;
119
- }
113
+ OUT_OF_SPACE_IF_NULL (res = sym_new_known_type (ctx , & PyLong_Type ));
120
114
}
121
115
}
122
116
@@ -129,14 +123,12 @@ dummy_func(void) {
129
123
if (temp == NULL ) {
130
124
goto error ;
131
125
}
132
- res = sym_new_const (ctx , temp );
133
- // TODO replace opcode with constant propagated one and add tests!
126
+ OUT_OF_SPACE_IF_NULL (res = sym_new_const (ctx , temp ));
127
+ // TODO gh-115506:
128
+ // replace opcode with constant propagated one and add tests!
134
129
}
135
130
else {
136
- res = sym_new_known_type (ctx , & PyLong_Type );
137
- if (res == NULL ) {
138
- goto out_of_space ;
139
- }
131
+ OUT_OF_SPACE_IF_NULL (res = sym_new_known_type (ctx , & PyLong_Type ));
140
132
}
141
133
}
142
134
@@ -147,39 +139,21 @@ dummy_func(void) {
147
139
}
148
140
149
141
op (_LOAD_CONST_INLINE , (ptr /4 -- value )) {
150
- value = sym_new_const (ctx , ptr );
151
- if (value == NULL ) {
152
- goto out_of_space ;
153
- }
142
+ OUT_OF_SPACE_IF_NULL (value = sym_new_const (ctx , ptr ));
154
143
}
155
144
156
145
op (_LOAD_CONST_INLINE_BORROW , (ptr /4 -- value )) {
157
- value = sym_new_const (ctx , ptr );
158
- if (value == NULL ) {
159
- goto out_of_space ;
160
- }
146
+ OUT_OF_SPACE_IF_NULL (value = sym_new_const (ctx , ptr ));
161
147
}
162
148
163
149
op (_LOAD_CONST_INLINE_WITH_NULL , (ptr /4 -- value , null )) {
164
- value = sym_new_const (ctx , ptr );
165
- if (value == NULL ) {
166
- goto out_of_space ;
167
- }
168
- null = sym_new_null (ctx );
169
- if (null == NULL ) {
170
- goto out_of_space ;
171
- }
150
+ OUT_OF_SPACE_IF_NULL (value = sym_new_const (ctx , ptr ));
151
+ OUT_OF_SPACE_IF_NULL (null = sym_new_null (ctx ));
172
152
}
173
153
174
154
op (_LOAD_CONST_INLINE_BORROW_WITH_NULL , (ptr /4 -- value , null )) {
175
- value = sym_new_const (ctx , ptr );
176
- if (value == NULL ) {
177
- goto out_of_space ;
178
- }
179
- null = sym_new_null (ctx );
180
- if (null == NULL ) {
181
- goto out_of_space ;
182
- }
155
+ OUT_OF_SPACE_IF_NULL (value = sym_new_const (ctx , ptr ));
156
+ OUT_OF_SPACE_IF_NULL (null = sym_new_null (ctx ));
183
157
}
184
158
185
159
@@ -261,10 +235,8 @@ dummy_func(void) {
261
235
localsplus_start = args ;
262
236
n_locals_already_filled = argcount ;
263
237
}
264
- new_frame = ctx_frame_new (ctx , co , localsplus_start , n_locals_already_filled , 0 );
265
- if (new_frame == NULL ){
266
- goto out_of_space ;
267
- }
238
+ OUT_OF_SPACE_IF_NULL (new_frame =
239
+ ctx_frame_new (ctx , co , localsplus_start , n_locals_already_filled , 0 ));
268
240
}
269
241
270
242
op (_POP_FRAME , (retval -- res )) {
@@ -287,10 +259,7 @@ dummy_func(void) {
287
259
/* This has to be done manually */
288
260
(void )seq ;
289
261
for (int i = 0 ; i < oparg ; i ++ ) {
290
- values [i ] = sym_new_unknown (ctx );
291
- if (values [i ] == NULL ) {
292
- goto out_of_space ;
293
- }
262
+ OUT_OF_SPACE_IF_NULL (values [i ] = sym_new_unknown (ctx ));
294
263
}
295
264
}
296
265
@@ -299,18 +268,12 @@ dummy_func(void) {
299
268
(void )seq ;
300
269
int totalargs = (oparg & 0xFF ) + (oparg >> 8 ) + 1 ;
301
270
for (int i = 0 ; i < totalargs ; i ++ ) {
302
- values [i ] = sym_new_unknown (ctx );
303
- if (values [i ] == NULL ) {
304
- goto out_of_space ;
305
- }
271
+ OUT_OF_SPACE_IF_NULL (values [i ] = sym_new_unknown (ctx ));
306
272
}
307
273
}
308
274
309
275
op (_ITER_NEXT_RANGE , (iter -- iter , next )) {
310
- next = sym_new_known_type (ctx , & PyLong_Type );
311
- if (next == NULL ) {
312
- goto out_of_space ;
313
- }
276
+ OUT_OF_SPACE_IF_NULL (next = sym_new_known_type (ctx , & PyLong_Type ));
314
277
(void )iter ;
315
278
}
316
279
0 commit comments