Skip to content

Commit 1b36555

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fix named arguments handling JIT: Fix named arguments handling
2 parents e73cccd + b914122 commit 1b36555

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
@@ -2629,6 +2629,7 @@ static bool zend_jit_next_is_send_result(const zend_op *opline)
26292629
if (opline->result_type == IS_TMP_VAR
26302630
&& (opline+1)->opcode == ZEND_SEND_VAL
26312631
&& (opline+1)->op1_type == IS_TMP_VAR
2632+
&& (opline+1)->op2_type != IS_CONST
26322633
&& (opline+1)->op1.var == opline->result.var) {
26332634
return 1;
26342635
}

ext/opcache/jit/zend_jit_arm64.dasc

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

1491814918
switch (opline->opcode) {
14919-
case ZEND_QM_ASSIGN:
14920-
case ZEND_SEND_VAR:
1492114919
case ZEND_SEND_VAL:
1492214920
case ZEND_SEND_VAL_EX:
14921+
return (opline->op2_type != IS_CONST);
14922+
case ZEND_QM_ASSIGN:
1492314923
case ZEND_IS_SMALLER:
1492414924
case ZEND_IS_SMALLER_OR_EQUAL:
1492514925
case ZEND_IS_EQUAL:
@@ -15111,6 +15111,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1511115111
/* break missing intentionally */
1511215112
case ZEND_SEND_VAL:
1511315113
case ZEND_SEND_VAL_EX:
15114+
if (opline->op2_type == IS_CONST) {
15115+
break;
15116+
}
1511415117
if (ssa_op->op1_use == current_var) {
1511515118
regset = ZEND_REGSET(ZREG_REG0);
1511615119
break;
@@ -15127,6 +15130,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1512715130
}
1512815131
break;
1512915132
case ZEND_SEND_VAR:
15133+
if (opline->op2_type == IS_CONST) {
15134+
break;
15135+
}
1513015136
if (ssa_op->op1_use == current_var ||
1513115137
ssa_op->op1_def == current_var) {
1513215138
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
@@ -15775,10 +15775,11 @@ static bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa
1577515775
uint32_t op1_info, op2_info;
1577615776

1577715777
switch (opline->opcode) {
15778-
case ZEND_QM_ASSIGN:
1577915778
case ZEND_SEND_VAR:
1578015779
case ZEND_SEND_VAL:
1578115780
case ZEND_SEND_VAL_EX:
15781+
return (opline->op2_type != IS_CONST);
15782+
case ZEND_QM_ASSIGN:
1578215783
case ZEND_IS_SMALLER:
1578315784
case ZEND_IS_SMALLER_OR_EQUAL:
1578415785
case ZEND_IS_EQUAL:
@@ -15985,6 +15986,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1598515986
/* break missing intentionally */
1598615987
case ZEND_SEND_VAL:
1598715988
case ZEND_SEND_VAL_EX:
15989+
if (opline->op2_type == IS_CONST) {
15990+
break;
15991+
}
1598815992
if (ssa_op->op1_use == current_var) {
1598915993
regset = ZEND_REGSET(ZREG_R0);
1599015994
break;
@@ -16001,6 +16005,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1600116005
}
1600216006
break;
1600316007
case ZEND_SEND_VAR:
16008+
if (opline->op2_type == IS_CONST) {
16009+
break;
16010+
}
1600416011
if (ssa_op->op1_use == current_var ||
1600516012
ssa_op->op1_def == current_var) {
1600616013
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)