@@ -240,6 +240,44 @@ static zend_string *zend_jit_func_name(const zend_op_array *op_array)
240
240
}
241
241
}
242
242
243
+ #if ZEND_DEBUG
244
+ static void handle_dasm_error (int ret ) {
245
+ switch (ret & 0xff000000u ) {
246
+ case DASM_S_NOMEM :
247
+ fprintf (stderr , "DASM_S_NOMEM\n" );
248
+ break ;
249
+ case DASM_S_PHASE :
250
+ fprintf (stderr , "DASM_S_PHASE\n" );
251
+ break ;
252
+ case DASM_S_MATCH_SEC :
253
+ fprintf (stderr , "DASM_S_MATCH_SEC\n" );
254
+ break ;
255
+ case DASM_S_RANGE_I :
256
+ fprintf (stderr , "DASM_S_RANGE_I\n" );
257
+ break ;
258
+ case DASM_S_RANGE_SEC :
259
+ fprintf (stderr , "DASM_S_RANGE_SEC\n" );
260
+ break ;
261
+ case DASM_S_RANGE_LG :
262
+ fprintf (stderr , "DASM_S_RANGE_LG\n" );
263
+ break ;
264
+ case DASM_S_RANGE_PC :
265
+ fprintf (stderr , "DASM_S_RANGE_PC %d\n" , ret & 0xffffffu );
266
+ break ;
267
+ case DASM_S_RANGE_VREG :
268
+ fprintf (stderr , "DASM_S_RANGE_VREG\n" );
269
+ break ;
270
+ case DASM_S_UNDEF_L :
271
+ fprintf (stderr , "DASM_S_UNDEF_L\n" );
272
+ break ;
273
+ case DASM_S_UNDEF_PC :
274
+ fprintf (stderr , "DASM_S_UNDEF_PC\n" );
275
+ break ;
276
+ }
277
+ ZEND_UNREACHABLE ();
278
+ }
279
+ #endif
280
+
243
281
static void * dasm_link_and_encode (dasm_State * * dasm_state ,
244
282
const zend_op_array * op_array ,
245
283
zend_ssa * ssa ,
@@ -294,8 +332,11 @@ static void *dasm_link_and_encode(dasm_State **dasm_state,
294
332
}
295
333
}
296
334
297
- if (dasm_link (dasm_state , & size ) != DASM_S_OK ) {
298
- // TODO: dasm_link() failed ???
335
+ ret = dasm_link (dasm_state , & size );
336
+ if (ret != DASM_S_OK ) {
337
+ #if ZEND_DEBUG
338
+ handle_dasm_error (ret );
339
+ #endif
299
340
return NULL ;
300
341
}
301
342
@@ -306,11 +347,9 @@ static void *dasm_link_and_encode(dasm_State **dasm_state,
306
347
}
307
348
308
349
ret = dasm_encode (dasm_state , * dasm_ptr );
309
-
310
350
if (ret != DASM_S_OK ) {
311
- // TODO: dasm_encode() failed ???
312
351
#if ZEND_DEBUG
313
- ZEND_UNREACHABLE ( );
352
+ handle_dasm_error ( ret );
314
353
#endif
315
354
return NULL ;
316
355
}
0 commit comments