Skip to content

Commit b914122

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fix named arguments handling JIT: Fix named arguments handling
2 parents b082343 + d955415 commit b914122

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,6 +2643,7 @@ static bool zend_jit_next_is_send_result(const zend_op *opline)
26432643
if (opline->result_type == IS_TMP_VAR
26442644
&& (opline+1)->opcode == ZEND_SEND_VAL
26452645
&& (opline+1)->op1_type == IS_TMP_VAR
2646+
&& (opline+1)->op2_type != IS_CONST
26462647
&& (opline+1)->op1.var == opline->result.var) {
26472648
return 1;
26482649
}

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14845,10 +14845,10 @@ static bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa
1484514845
uint32_t op1_info, op2_info;
1484614846

1484714847
switch (opline->opcode) {
14848-
case ZEND_QM_ASSIGN:
14849-
case ZEND_SEND_VAR:
1485014848
case ZEND_SEND_VAL:
1485114849
case ZEND_SEND_VAL_EX:
14850+
return (opline->op2_type != IS_CONST);
14851+
case ZEND_QM_ASSIGN:
1485214852
case ZEND_IS_SMALLER:
1485314853
case ZEND_IS_SMALLER_OR_EQUAL:
1485414854
case ZEND_IS_EQUAL:
@@ -15040,6 +15040,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1504015040
/* break missing intentionally */
1504115041
case ZEND_SEND_VAL:
1504215042
case ZEND_SEND_VAL_EX:
15043+
if (opline->op2_type == IS_CONST) {
15044+
break;
15045+
}
1504315046
if (ssa_op->op1_use == current_var) {
1504415047
regset = ZEND_REGSET(ZREG_REG0);
1504515048
break;
@@ -15056,6 +15059,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1505615059
}
1505715060
break;
1505815061
case ZEND_SEND_VAR:
15062+
if (opline->op2_type == IS_CONST) {
15063+
break;
15064+
}
1505915065
if (ssa_op->op1_use == current_var ||
1506015066
ssa_op->op1_def == current_var) {
1506115067
regset = ZEND_REGSET_EMPTY;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15705,10 +15705,11 @@ static bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa
1570515705
uint32_t op1_info, op2_info;
1570615706

1570715707
switch (opline->opcode) {
15708-
case ZEND_QM_ASSIGN:
1570915708
case ZEND_SEND_VAR:
1571015709
case ZEND_SEND_VAL:
1571115710
case ZEND_SEND_VAL_EX:
15711+
return (opline->op2_type != IS_CONST);
15712+
case ZEND_QM_ASSIGN:
1571215713
case ZEND_IS_SMALLER:
1571315714
case ZEND_IS_SMALLER_OR_EQUAL:
1571415715
case ZEND_IS_EQUAL:
@@ -15915,6 +15916,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1591515916
/* break missing intentionally */
1591615917
case ZEND_SEND_VAL:
1591715918
case ZEND_SEND_VAL_EX:
15919+
if (opline->op2_type == IS_CONST) {
15920+
break;
15921+
}
1591815922
if (ssa_op->op1_use == current_var) {
1591915923
regset = ZEND_REGSET(ZREG_R0);
1592015924
break;
@@ -15931,6 +15935,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1593115935
}
1593215936
break;
1593315937
case ZEND_SEND_VAR:
15938+
if (opline->op2_type == IS_CONST) {
15939+
break;
15940+
}
1593415941
if (ssa_op->op1_use == current_var ||
1593515942
ssa_op->op1_def == current_var) {
1593615943
regset = ZEND_REGSET_EMPTY;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
JIT SEND_VAL: 002 named arg
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+
function o(){
11+
var_dump(x:$x?1:0);
12+
}
13+
o();
14+
?>
15+
--EXPECTF--
16+
Warning: Undefined variable $x in %ssend_val_002.php on line 3
17+
18+
Fatal error: Uncaught ArgumentCountError: var_dump() expects at least 1 argument, 0 given in %ssend_val_002.php:3
19+
Stack trace:
20+
#0 %ssend_val_002.php(3): var_dump(x: 0)
21+
#1 %ssend_val_002.php(5): o()
22+
#2 {main}
23+
thrown in %ssend_val_002.php on line 3

0 commit comments

Comments
 (0)