@@ -5389,6 +5389,44 @@ static int zend_jit_simple_assign(dasm_State **Dst,
5389
5389
return 1;
5390
5390
}
5391
5391
5392
+ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
5393
+ const zend_op *opline,
5394
+ const zend_op_array *op_array,
5395
+ zend_uchar val_type,
5396
+ zend_jit_addr val_addr,
5397
+ zend_bool check_exception)
5398
+ {
5399
+ | // if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
5400
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
5401
+ | jnz >2
5402
+ |.cold_code
5403
+ |2:
5404
+ | LOAD_ZVAL_ADDR FCARG2a, val_addr
5405
+ | SAVE_VALID_OPLINE opline, r0
5406
+ if (val_type == IS_CONST) {
5407
+ | EXT_CALL zend_jit_assign_const_to_typed_ref, r0
5408
+ } else if (val_type == IS_TMP_VAR) {
5409
+ | EXT_CALL zend_jit_assign_tmp_to_typed_ref, r0
5410
+ } else if (val_type == IS_VAR) {
5411
+ | EXT_CALL zend_jit_assign_var_to_typed_ref, r0
5412
+ } else if (val_type == IS_CV) {
5413
+ | EXT_CALL zend_jit_assign_cv_to_typed_ref, r0
5414
+ } else {
5415
+ ZEND_UNREACHABLE();
5416
+ }
5417
+ if (check_exception) {
5418
+ | // if (UNEXPECTED(EG(exception) != NULL)) {
5419
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
5420
+ | je >8 // END OF zend_jit_assign_to_variable()
5421
+ | jmp ->exception_handler
5422
+ } else {
5423
+ | jmp >8
5424
+ }
5425
+ |.code
5426
+
5427
+ return 1;
5428
+ }
5429
+
5392
5430
static int zend_jit_assign_to_variable(dasm_State **Dst,
5393
5431
const zend_op *opline,
5394
5432
const zend_op_array *op_array,
@@ -5415,26 +5453,10 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
5415
5453
| IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
5416
5454
| // if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
5417
5455
| GET_Z_PTR FCARG1a, FCARG1a
5418
- | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
5419
- | jnz >2
5420
- | add FCARG1a, offsetof(zend_reference, val)
5421
- |.cold_code
5422
- |2:
5423
- | LOAD_ZVAL_ADDR FCARG2a, val_addr
5424
- | SAVE_VALID_OPLINE opline, r0
5425
- if (val_type == IS_CONST) {
5426
- | EXT_CALL zend_jit_assign_const_to_typed_ref, r0
5427
- } else if (val_type == IS_TMP_VAR) {
5428
- | EXT_CALL zend_jit_assign_tmp_to_typed_ref, r0
5429
- } else if (val_type == IS_VAR) {
5430
- | EXT_CALL zend_jit_assign_var_to_typed_ref, r0
5431
- } else if (val_type == IS_CV) {
5432
- | EXT_CALL zend_jit_assign_cv_to_typed_ref, r0
5433
- } else {
5434
- ZEND_UNREACHABLE();
5456
+ if (!zend_jit_assign_to_typed_ref(Dst, opline, op_array, val_type, val_addr, check_exception)) {
5457
+ return 0;
5435
5458
}
5436
- | jmp >8
5437
- |.code
5459
+ | add FCARG1a, offsetof(zend_reference, val)
5438
5460
|1:
5439
5461
}
5440
5462
if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
@@ -7878,7 +7900,7 @@ static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, const zend_o
7878
7900
}
7879
7901
7880
7902
if (!zend_jit_assign_to_variable(Dst, opline, op_array, op1_addr, op1_info, op1_def_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr,
7881
- may_throw && !(op1_info & MAY_BE_REF) && (op1_info & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY)) )) {
7903
+ may_throw)) {
7882
7904
return 0;
7883
7905
}
7884
7906
if (!zend_jit_store_var_if_necessary_ex(Dst, opline->op1.var, op1_addr, op1_def_info, op1_use_addr, op1_info)) {
@@ -7890,10 +7912,6 @@ static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, const zend_o
7890
7912
}
7891
7913
}
7892
7914
7893
- if (may_throw && (op1_info & MAY_BE_REF)) {
7894
- zend_jit_check_exception(Dst);
7895
- }
7896
-
7897
7915
return 1;
7898
7916
}
7899
7917
0 commit comments