@@ -10479,12 +10479,23 @@ static zend_bool zend_jit_may_avoid_refcounting(const zend_op *opline)
10479
10479
return 0;
10480
10480
}
10481
10481
10482
- static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend_ssa *ssa, const zend_ssa_op *ssa_op, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op2_info, uint32_t res_info, zend_jit_addr res_addr, int may_throw)
10482
+ static int zend_jit_fetch_dim_read(dasm_State **Dst,
10483
+ const zend_op *opline,
10484
+ zend_ssa *ssa,
10485
+ const zend_ssa_op *ssa_op,
10486
+ uint32_t op1_info,
10487
+ zend_jit_addr op1_addr,
10488
+ zend_bool op1_avoid_refcounting,
10489
+ uint32_t op2_info,
10490
+ uint32_t res_info,
10491
+ zend_jit_addr res_addr,
10492
+ int may_throw)
10483
10493
{
10484
10494
zend_jit_addr orig_op1_addr, op2_addr;
10485
10495
const void *exit_addr = NULL;
10486
10496
const void *not_found_exit_addr = NULL;
10487
10497
const void *res_exit_addr = NULL;
10498
+ zend_bool result_avoid_refcounting = 0;
10488
10499
10489
10500
orig_op1_addr = OP1_ADDR();
10490
10501
op2_addr = OP2_ADDR();
@@ -10498,7 +10509,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10498
10509
}
10499
10510
}
10500
10511
10501
- if (op1_info & AVOID_REFCOUNTING ) {
10512
+ if (op1_avoid_refcounting ) {
10502
10513
SET_STACK_REG(JIT_G(current_frame)->stack,
10503
10514
EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
10504
10515
}
@@ -10512,7 +10523,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10512
10523
int32_t exit_point;
10513
10524
10514
10525
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR))
10515
- && !(op1_info & AVOID_REFCOUNTING) ) {
10526
+ && !op1_avoid_refcounting ) {
10516
10527
flags |= ZEND_JIT_EXIT_FREE_OP1;
10517
10528
}
10518
10529
if ((opline->op2_type & (IS_VAR|IS_TMP_VAR))
@@ -10524,8 +10535,8 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10524
10535
&& (ssa_op+1)->op1_use == ssa_op->result_def
10525
10536
&& !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))
10526
10537
&& zend_jit_may_avoid_refcounting(opline+1)) {
10527
- res_info |= AVOID_REFCOUNTING ;
10528
- ssa->var_info[ssa_op->result_def].type |= AVOID_REFCOUNTING ;
10538
+ result_avoid_refcounting = 1 ;
10539
+ ssa->var_info[ssa_op->result_def].avoid_refcounting = 1 ;
10529
10540
}
10530
10541
10531
10542
if (!(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))) {
@@ -10722,7 +10733,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10722
10733
| SET_ZVAL_TYPE_INFO res_addr, type
10723
10734
} else {
10724
10735
| SET_ZVAL_TYPE_INFO res_addr, edx
10725
- if (!(res_info & AVOID_REFCOUNTING) ) {
10736
+ if (!result_avoid_refcounting ) {
10726
10737
| TRY_ADDREF res_info, dh, r1
10727
10738
}
10728
10739
}
@@ -10751,7 +10762,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10751
10762
#endif
10752
10763
10753
10764
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
10754
- if (!(op1_info & AVOID_REFCOUNTING) ) {
10765
+ if (!op1_avoid_refcounting ) {
10755
10766
| FREE_OP opline->op1_type, opline->op1, op1_info, 0, opline
10756
10767
}
10757
10768
@@ -10764,7 +10775,17 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, zend
10764
10775
return 1;
10765
10776
}
10766
10777
10767
- static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op2_info, int may_throw, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr)
10778
+ static int zend_jit_isset_isempty_dim(dasm_State **Dst,
10779
+ const zend_op *opline,
10780
+ uint32_t op1_info,
10781
+ zend_jit_addr op1_addr,
10782
+ zend_bool op1_avoid_refcounting,
10783
+ uint32_t op2_info,
10784
+ int may_throw,
10785
+ zend_uchar smart_branch_opcode,
10786
+ uint32_t target_label,
10787
+ uint32_t target_label2,
10788
+ const void *exit_addr)
10768
10789
{
10769
10790
zend_jit_addr op2_addr, res_addr;
10770
10791
@@ -10791,7 +10812,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, u
10791
10812
if (exit_addr
10792
10813
&& !(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY))
10793
10814
&& !may_throw
10794
- && (!(opline->op1_type & (IS_TMP_VAR|IS_VAR)) || (op1_info & AVOID_REFCOUNTING) )
10815
+ && (!(opline->op1_type & (IS_TMP_VAR|IS_VAR)) || op1_avoid_refcounting )
10795
10816
&& (!(opline->op2_type & (IS_TMP_VAR|IS_VAR)) || !(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)))) {
10796
10817
if (smart_branch_opcode == ZEND_JMPNZ) {
10797
10818
found_exit_addr = exit_addr;
@@ -10859,7 +10880,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, u
10859
10880
10860
10881
|8:
10861
10882
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
10862
- if (!(op1_info & AVOID_REFCOUNTING) ) {
10883
+ if (!op1_avoid_refcounting ) {
10863
10884
| FREE_OP opline->op1_type, opline->op1, op1_info, 0, opline
10864
10885
}
10865
10886
if (may_throw) {
@@ -10895,7 +10916,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, u
10895
10916
10896
10917
|9: // not found
10897
10918
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
10898
- if (!(op1_info & AVOID_REFCOUNTING) ) {
10919
+ if (!op1_avoid_refcounting ) {
10899
10920
| FREE_OP opline->op1_type, opline->op1, op1_info, 0, opline
10900
10921
}
10901
10922
if (may_throw) {
@@ -11320,7 +11341,20 @@ static int zend_jit_class_guard(dasm_State **Dst, const zend_op *opline, zend_cl
11320
11341
return 1;
11321
11342
}
11322
11343
11323
- static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, const zend_ssa_op *ssa_op, uint32_t op1_info, zend_jit_addr op1_addr, zend_bool op1_indirect, zend_class_entry *ce, zend_bool ce_is_instanceof, zend_bool use_this, zend_class_entry *trace_ce, int may_throw)
11344
+ static int zend_jit_fetch_obj(dasm_State **Dst,
11345
+ const zend_op *opline,
11346
+ const zend_op_array *op_array,
11347
+ zend_ssa *ssa,
11348
+ const zend_ssa_op *ssa_op,
11349
+ uint32_t op1_info,
11350
+ zend_jit_addr op1_addr,
11351
+ zend_bool op1_indirect,
11352
+ zend_class_entry *ce,
11353
+ zend_bool ce_is_instanceof,
11354
+ zend_bool use_this,
11355
+ zend_bool op1_avoid_refcounting,
11356
+ zend_class_entry *trace_ce,
11357
+ int may_throw)
11324
11358
{
11325
11359
zval *member;
11326
11360
zend_property_info *prop_info;
@@ -11494,7 +11528,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11494
11528
}
11495
11529
}
11496
11530
}
11497
- if (op1_info & AVOID_REFCOUNTING ) {
11531
+ if (op1_avoid_refcounting ) {
11498
11532
SET_STACK_REG(JIT_G(current_frame)->stack,
11499
11533
EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
11500
11534
}
@@ -11506,6 +11540,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11506
11540
| SET_ZVAL_TYPE_INFO res_addr, IS_INDIRECT
11507
11541
} else {
11508
11542
uint32_t res_info = RES_INFO();
11543
+ zend_bool result_avoid_refcounting = 0;
11509
11544
11510
11545
if ((res_info & MAY_BE_GUARD) && JIT_G(current_frame) && prop_info) {
11511
11546
uint32_t flags = 0;
@@ -11518,7 +11553,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11518
11553
11519
11554
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR))
11520
11555
&& !use_this
11521
- && !(op1_info & AVOID_REFCOUNTING) ) {
11556
+ && !op1_avoid_refcounting ) {
11522
11557
flags = ZEND_JIT_EXIT_FREE_OP1;
11523
11558
}
11524
11559
@@ -11528,8 +11563,8 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11528
11563
&& (res_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))
11529
11564
&& (ssa_op+1)->op1_use == ssa_op->result_def
11530
11565
&& zend_jit_may_avoid_refcounting(opline+1)) {
11531
- res_info |= AVOID_REFCOUNTING ;
11532
- ssa->var_info[ssa_op->result_def].type |= AVOID_REFCOUNTING ;
11566
+ result_avoid_refcounting = 1 ;
11567
+ ssa->var_info[ssa_op->result_def].avoid_refcounting = 1 ;
11533
11568
}
11534
11569
11535
11570
old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
@@ -11564,7 +11599,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11564
11599
| SET_ZVAL_TYPE_INFO res_addr, type
11565
11600
} else {
11566
11601
| SET_ZVAL_TYPE_INFO res_addr, edx
11567
- if (!(res_info & AVOID_REFCOUNTING) ) {
11602
+ if (!result_avoid_refcounting ) {
11568
11603
| TRY_ADDREF res_info, dh, r1
11569
11604
}
11570
11605
}
@@ -11652,7 +11687,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11652
11687
| SAVE_VALID_OPLINE opline, r0
11653
11688
| EXT_CALL zend_jit_extract_helper, r0
11654
11689
|1:
11655
- } else if (!(op1_info & AVOID_REFCOUNTING) ) {
11690
+ } else if (!op1_avoid_refcounting ) {
11656
11691
| FREE_OP opline->op1_type, opline->op1, op1_info, 1, opline
11657
11692
}
11658
11693
}
0 commit comments