Skip to content

Commit a26d83a

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fixed test JIT: Fix incorrect EX(opline) override
2 parents 43950c3 + e0d9a29 commit a26d83a

File tree

3 files changed

+50
-20
lines changed

3 files changed

+50
-20
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5337,7 +5337,6 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
53375337
| // hval = Z_LVAL_P(dim);
53385338
| GET_ZVAL_LVAL ZREG_FCARG2, op2_addr, TMP1
53395339
}
5340-
| SET_EX_OPLINE opline, REG0
53415340
if (packed_loaded) {
53425341
| EXT_CALL zend_jit_hash_index_lookup_rw_no_packed, REG0
53435342
} else {
@@ -5460,7 +5459,6 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
54605459
}
54615460
break;
54625461
case BP_VAR_RW:
5463-
| SET_EX_OPLINE opline, REG0
54645462
if (opline->op2_type != IS_CONST) {
54655463
| EXT_CALL zend_jit_symtable_lookup_rw, REG0
54665464
} else {
@@ -5507,7 +5505,9 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
55075505
|.cold_code
55085506
|3:
55095507
}
5510-
| SET_EX_OPLINE opline, REG0
5508+
if (type != BP_VAR_RW) {
5509+
| SET_EX_OPLINE opline, REG0
5510+
}
55115511
| LOAD_ZVAL_ADDR FCARG2x, op2_addr
55125512
switch (type) {
55135513
case BP_VAR_R:
@@ -6228,6 +6228,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
62286228
op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
62296229
op3_addr = OP1_DATA_ADDR();
62306230

6231+
| SET_EX_OPLINE opline, REG0
62316232
if (op1_info & MAY_BE_REF) {
62326233
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
62336234
| IF_NOT_Z_TYPE FCARG1x, IS_REFERENCE, >1, TMP1w
@@ -6239,7 +6240,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
62396240
| b >3
62406241
|.cold_code
62416242
|2:
6242-
| SET_EX_OPLINE opline, REG0
62436243
| EXT_CALL zend_jit_prepare_assign_dim_ref, REG0
62446244
| mov FCARG1x, RETVALx
62456245
| cbnz RETVALx, >1
@@ -6272,7 +6272,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
62726272
if (op1_info & MAY_BE_NULL) {
62736273
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1, ZREG_TMP1
62746274
}
6275-
| SET_EX_OPLINE opline, REG0
62766275
| LOAD_32BIT_VAL FCARG1x, opline->op1.var
62776276
| EXT_CALL zend_jit_undefined_op_helper, REG0
62786277
|1:
@@ -6354,7 +6353,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
63546353
|2:
63556354
| LOAD_ZVAL_ADDR FCARG2x, op3_addr
63566355
| LOAD_ADDR CARG3, binary_op
6357-
| SET_EX_OPLINE opline, REG0
63586356
if (((opline+1)->op1_type & (IS_TMP_VAR|IS_VAR))
63596357
&& (op1_data_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
63606358
| EXT_CALL zend_jit_assign_op_to_typed_ref_tmp, REG0
@@ -6412,7 +6410,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
64126410
|7:
64136411
}
64146412

6415-
| SET_EX_OPLINE opline, REG0
64166413
if (Z_REG(op1_addr) != ZREG_FCARG1 || Z_OFFSET(op1_addr) != 0) {
64176414
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
64186415
}
@@ -11405,6 +11402,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1140511402

1140611403
op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
1140711404

11405+
if (opline->opcode == ZEND_FETCH_DIM_RW) {
11406+
| SET_EX_OPLINE opline, REG0
11407+
}
1140811408
if (op1_info & MAY_BE_REF) {
1140911409
may_throw = 1;
1141011410
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
@@ -11418,7 +11418,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1141811418
|.cold_code
1141911419
|2:
1142011420
| SET_EX_OPLINE opline, REG0
11421-
| EXT_CALL zend_jit_prepare_assign_dim_ref, REG0
11421+
if (if (opline->opcode != ZEND_FETCH_DIM_RW) {
11422+
| EXT_CALL zend_jit_prepare_assign_dim_ref, REG0
11423+
}
1142211424
| mov FCARG1x, RETVALx
1142311425
| cbnz FCARG1x, >1
1142411426
| b ->exception_handler_undef
@@ -11452,7 +11454,6 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1145211454
if (op1_info & MAY_BE_NULL) {
1145311455
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1, ZREG_TMP1
1145411456
}
11455-
| SET_EX_OPLINE opline, REG0
1145611457
| LOAD_32BIT_VAL FCARG1w, opline->op1.var
1145711458
| EXT_CALL zend_jit_undefined_op_helper, REG0
1145811459
|1:
@@ -11539,7 +11540,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1153911540
|7:
1154011541
}
1154111542

11542-
| SET_EX_OPLINE opline, REG0
11543+
if (opline->opcode != ZEND_FETCH_DIM_RW) {
11544+
| SET_EX_OPLINE opline, REG0
11545+
}
1154311546
if (Z_REG(op1_addr) != ZREG_FCARG1 || Z_OFFSET(op1_addr) != 0) {
1154411547
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
1154511548
}

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5864,7 +5864,6 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
58645864
| // hval = Z_LVAL_P(dim);
58655865
| GET_ZVAL_LVAL ZREG_FCARG2, op2_addr
58665866
}
5867-
| SET_EX_OPLINE opline, r0
58685867
if (packed_loaded) {
58695868
| EXT_CALL zend_jit_hash_index_lookup_rw_no_packed, r0
58705869
} else {
@@ -5984,7 +5983,6 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
59845983
}
59855984
break;
59865985
case BP_VAR_RW:
5987-
| SET_EX_OPLINE opline, r0
59885986
if (opline->op2_type != IS_CONST) {
59895987
| EXT_CALL zend_jit_symtable_lookup_rw, r0
59905988
} else {
@@ -6029,7 +6027,9 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
60296027
|.cold_code
60306028
|3:
60316029
}
6032-
| SET_EX_OPLINE opline, r0
6030+
if (type != BP_VAR_RW) {
6031+
| SET_EX_OPLINE opline, r0
6032+
}
60336033
| LOAD_ZVAL_ADDR FCARG2a, op2_addr
60346034
switch (type) {
60356035
case BP_VAR_R:
@@ -6786,6 +6786,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
67866786
op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
67876787
op3_addr = OP1_DATA_ADDR();
67886788

6789+
| SET_EX_OPLINE opline, r0
67896790
if (op1_info & MAY_BE_REF) {
67906791
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
67916792
| IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1
@@ -6795,7 +6796,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
67956796
| jmp >3
67966797
|.cold_code
67976798
|2:
6798-
| SET_EX_OPLINE opline, r0
67996799
| EXT_CALL zend_jit_prepare_assign_dim_ref, r0
68006800
| test r0, r0
68016801
| mov FCARG1a, r0
@@ -6829,7 +6829,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
68296829
if (op1_info & MAY_BE_NULL) {
68306830
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
68316831
}
6832-
| SET_EX_OPLINE opline, r0
68336832
| mov FCARG1a, opline->op1.var
68346833
| EXT_CALL zend_jit_undefined_op_helper, r0
68356834
|1:
@@ -6915,7 +6914,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
69156914
| sub r4, 12
69166915
| PUSH_ADDR binary_op, r0
69176916
|.endif
6918-
| SET_EX_OPLINE opline, r0
69196917
if (((opline+1)->op1_type & (IS_TMP_VAR|IS_VAR))
69206918
&& (op1_data_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
69216919
| EXT_CALL zend_jit_assign_op_to_typed_ref_tmp, r0
@@ -6976,7 +6974,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
69766974
|7:
69776975
}
69786976

6979-
| SET_EX_OPLINE opline, r0
69806977
if (Z_REG(op1_addr) != ZREG_FCARG1 || Z_OFFSET(op1_addr) != 0) {
69816978
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
69826979
}
@@ -12128,6 +12125,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1212812125

1212912126
op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
1213012127

12128+
if (opline->opcode == ZEND_FETCH_DIM_RW) {
12129+
| SET_EX_OPLINE opline, r0
12130+
}
1213112131
if (op1_info & MAY_BE_REF) {
1213212132
may_throw = 1;
1213312133
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
@@ -12138,7 +12138,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1213812138
| jmp >3
1213912139
|.cold_code
1214012140
|2:
12141-
| SET_EX_OPLINE opline, r0
12141+
if (opline->opcode != ZEND_FETCH_DIM_RW) {
12142+
| SET_EX_OPLINE opline, r0
12143+
}
1214212144
| EXT_CALL zend_jit_prepare_assign_dim_ref, r0
1214312145
| test r0, r0
1214412146
| mov FCARG1a, r0
@@ -12174,7 +12176,6 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1217412176
if (op1_info & MAY_BE_NULL) {
1217512177
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
1217612178
}
12177-
| SET_EX_OPLINE opline, r0
1217812179
| mov FCARG1a, opline->op1.var
1217912180
| EXT_CALL zend_jit_undefined_op_helper, r0
1218012181
|1:
@@ -12261,7 +12262,9 @@ static int zend_jit_fetch_dim(dasm_State **Dst,
1226112262
|7:
1226212263
}
1226312264

12264-
| SET_EX_OPLINE opline, r0
12265+
if (opline->opcode != ZEND_FETCH_DIM_RW) {
12266+
| SET_EX_OPLINE opline, r0
12267+
}
1226512268
if (Z_REG(op1_addr) != ZREG_FCARG1 || Z_OFFSET(op1_addr) != 0) {
1226612269
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
1226712270
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
JIT FETCH_DIM_RW: 004
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
set_error_handler(function(y$y) {
11+
});
12+
$k=[];
13+
$y[$k]++;
14+
?>
15+
--EXPECTF--
16+
Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($y) must be of type y, int given, called in %sfetch_dim_rw_004.php:2
17+
Stack trace:
18+
#0 %sfetch_dim_rw_004.php(5): {closure}(2, 'Undefined varia...', '%s', 5)
19+
#1 {main}
20+
21+
Next TypeError: Illegal offset type in %sfetch_dim_rw_004.php:5
22+
Stack trace:
23+
#0 {main}
24+
thrown in %sfetch_dim_rw_004.php on line 5

0 commit comments

Comments
 (0)