@@ -2235,6 +2235,25 @@ static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_in
2235
2235
return zend_convert_type (script , prop_info -> type , pce );
2236
2236
}
2237
2237
2238
+ static bool result_may_be_separated (zend_ssa * ssa , zend_ssa_op * ssa_op )
2239
+ {
2240
+ int tmp_var = ssa_op -> result_def ;
2241
+
2242
+ if (ssa -> vars [tmp_var ].use_chain >= 0
2243
+ && !ssa -> vars [tmp_var ].phi_use_chain ) {
2244
+ zend_ssa_op * use_op = & ssa -> ops [ssa -> vars [tmp_var ].use_chain ];
2245
+
2246
+ /* TODO: analize instructions between ssa_op and use_op */
2247
+ if (use_op == ssa_op + 1 ) {
2248
+ if ((use_op -> op1_use == tmp_var && use_op -> op1_use_chain < 0 )
2249
+ || (use_op -> op2_use == tmp_var && use_op -> op2_use_chain < 0 )) {
2250
+ return 0 ;
2251
+ }
2252
+ }
2253
+ }
2254
+ return 1 ;
2255
+ }
2256
+
2238
2257
static zend_always_inline int _zend_update_type_info (
2239
2258
const zend_op_array * op_array ,
2240
2259
zend_ssa * ssa ,
@@ -3340,11 +3359,11 @@ static zend_always_inline int _zend_update_type_info(
3340
3359
if (prop_info ) {
3341
3360
/* FETCH_OBJ_R/IS for plain property increments reference counter,
3342
3361
so it can't be 1 */
3343
- if (ce && !ce -> create_object ) {
3362
+ if (ce && !ce -> create_object && ! result_may_be_separated ( ssa , ssa_op ) ) {
3344
3363
tmp &= ~MAY_BE_RC1 ;
3345
3364
}
3346
3365
} else {
3347
- if (ce && !ce -> create_object && !ce -> __get ) {
3366
+ if (ce && !ce -> create_object && !ce -> __get && ! result_may_be_separated ( ssa , ssa_op ) ) {
3348
3367
tmp &= ~MAY_BE_RC1 ;
3349
3368
}
3350
3369
}
@@ -3370,7 +3389,9 @@ static zend_always_inline int _zend_update_type_info(
3370
3389
if (opline -> result_type == IS_VAR ) {
3371
3390
tmp |= MAY_BE_REF | MAY_BE_INDIRECT ;
3372
3391
} else {
3373
- tmp &= ~MAY_BE_RC1 ;
3392
+ if (!result_may_be_separated (ssa , ssa_op )) {
3393
+ tmp &= ~MAY_BE_RC1 ;
3394
+ }
3374
3395
if (opline -> opcode == ZEND_FETCH_STATIC_PROP_IS ) {
3375
3396
tmp |= MAY_BE_UNDEF ;
3376
3397
}
0 commit comments