com php-src: Fixed incorrect JIT compilation: ext/opcache/jit/z end_jit_x86.dasc ext/opcache/tests/jit/send_val _001.phpt
| From: | Dmitry Stogov | Date: | Mon, 14 Oct 2019 13:45:58 +0000 |
| Subject: | com php-src: Fixed incorrect JIT compilation: ext/opcache/jit/z end_jit_x86.dasc ext/opcache/tests/jit/send_val _001.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108908@lists.php.net to get a copy of this message | ||
Commit: 3f50922aeef3b96cfa528e96e907a2094507e81b
Author: Dmitry Stogov <dmitry@zend.com> Mon, 14 Oct 2019 16:45:58 +0300
Parents: 4273865bba5cb876af580010ec87eddd1485a396
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3f50922aeef3b96cfa528e96e907a2094507e81b
Log:
Fixed incorrect JIT compilation
Changed paths:
M ext/opcache/jit/zend_jit_x86.dasc
A ext/opcache/tests/jit/send_val_001.phpt
Diff:
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index ba3d4b36feb..f8ebc9321fe 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -3505,7 +3505,8 @@ static int zend_jit_math(dasm_State **Dst, const zend_op *opline, int *opnum,
ze
if (opline->result_type == IS_TMP_VAR &&
(opline+1)->opcode == ZEND_SEND_VAL &&
(opline+1)->op1_type == IS_TMP_VAR &&
- (opline+1)->op1.var == opline->result.var) {
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline -
op_array->opcodes]) {
/* Eliminate the following SEND_VAL */
(*opnum)++;
if (!reuse_ip) {
@@ -3839,7 +3840,8 @@ static int zend_jit_long_math(dasm_State **Dst, const zend_op *opline, int
*opnu
if (opline->result_type == IS_TMP_VAR &&
(opline+1)->opcode == ZEND_SEND_VAL &&
(opline+1)->op1_type == IS_TMP_VAR &&
- (opline+1)->op1.var == opline->result.var) {
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline -
op_array->opcodes]) {
/* Eliminate the following SEND_VAL */
(*opnum)++;
if (!reuse_ip) {
@@ -3980,7 +3982,8 @@ static int zend_jit_concat(dasm_State **Dst, const zend_op *opline, int
*opnum,
if (opline->result_type == IS_TMP_VAR &&
(opline+1)->opcode == ZEND_SEND_VAL &&
(opline+1)->op1_type == IS_TMP_VAR &&
- (opline+1)->op1.var == opline->result.var) {
+ (opline+1)->op1.var == opline->result.var &&
+ ssa->cfg.map[(opline+1) - op_array->opcodes] == ssa->cfg.map[opline -
op_array->opcodes]) {
/* Eliminate the following SEND_VAL */
(*opnum)++;
if (!reuse_ip) {
diff --git a/ext/opcache/tests/jit/send_val_001.phpt b/ext/opcache/tests/jit/send_val_001.phpt
new file mode 100644
index 00000000000..1293df7dec7
--- /dev/null
+++ b/ext/opcache/tests/jit/send_val_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT SEND_VAL: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($type) {
+ $key = md5(
+ is_array($type) ? \implode('_', $type) : $type .
+ "ops"
+ );
+ return $key;
+}
+var_dump(foo("int"));
+var_dump(foo(["int"]));
+--EXPECT--
+string(32) "253a948ecc9192cb47e492f692aa63a8"
+string(32) "fa7153f7ed1cb6c0fcf2ffb2fac21748"