@@ -43,10 +43,8 @@ dummy_func(void) {
4343
4444 op (_LOAD_FAST_AND_CLEAR , (-- value )) {
4545 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 ));
5048 GETLOCAL (oparg ) = temp ;
5149 }
5250
@@ -89,14 +87,12 @@ dummy_func(void) {
8987 if (temp == NULL ) {
9088 goto error ;
9189 }
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!
9493 }
9594 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 ));
10096 }
10197 }
10298
@@ -109,14 +105,12 @@ dummy_func(void) {
109105 if (temp == NULL ) {
110106 goto error ;
111107 }
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!
114111 }
115112 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 ));
120114 }
121115 }
122116
@@ -129,14 +123,12 @@ dummy_func(void) {
129123 if (temp == NULL ) {
130124 goto error ;
131125 }
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!
134129 }
135130 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 ));
140132 }
141133 }
142134
@@ -147,39 +139,21 @@ dummy_func(void) {
147139 }
148140
149141 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 ));
154143 }
155144
156145 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 ));
161147 }
162148
163149 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 ));
172152 }
173153
174154 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 ));
183157 }
184158
185159
@@ -261,10 +235,8 @@ dummy_func(void) {
261235 localsplus_start = args ;
262236 n_locals_already_filled = argcount ;
263237 }
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 ));
268240 }
269241
270242 op (_POP_FRAME , (retval -- res )) {
@@ -287,10 +259,7 @@ dummy_func(void) {
287259 /* This has to be done manually */
288260 (void )seq ;
289261 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 ));
294263 }
295264 }
296265
@@ -299,18 +268,12 @@ dummy_func(void) {
299268 (void )seq ;
300269 int totalargs = (oparg & 0xFF ) + (oparg >> 8 ) + 1 ;
301270 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 ));
306272 }
307273 }
308274
309275 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 ));
314277 (void )iter ;
315278 }
316279
0 commit comments