Fixed incorrect address usage
authorDmitry Stogov <dmitry@zend.com>
Wed, 3 Apr 2019 10:05:09 +0000 (13:05 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 3 Apr 2019 10:05:09 +0000 (13:05 +0300)
ext/opcache/jit/zend_jit_x86.dasc
ext/opcache/tests/jit/inc_019.phpt
ext/opcache/tests/jit/inc_020.phpt [new file with mode: 0644]

index 2787d9e1c3294a5783368706e824b9a01dd553cd..103fc3917f5d0c4f02399a6a4b62862101026cab 100644 (file)
@@ -3026,21 +3026,21 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, zend_op_arr
                if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
                        |.if X64
                                |       mov64 rax, 0x43e0000000000000
-                               |       SET_ZVAL_LVAL op1_addr, rax
+                               |       SET_ZVAL_LVAL op1_def_addr, rax
                        |.else
-                               |       SET_ZVAL_LVAL op1_addr, 0
-                               |       SET_ZVAL_W2 op1_addr, 0x41e00000
+                               |       SET_ZVAL_LVAL op1_def_addr, 0
+                               |       SET_ZVAL_W2 op1_def_addr, 0x41e00000
                        |.endif
                } else {
                        |.if X64
                                |       mov64 rax, 0xc3e0000000000000
-                               |       SET_ZVAL_LVAL op1_addr, rax
+                               |       SET_ZVAL_LVAL op1_def_addr, rax
                        |.else
-                               |       SET_ZVAL_LVAL op1_addr, 0x00200000
-                               |       SET_ZVAL_W2 op1_addr, 0xc1e00000
+                               |       SET_ZVAL_LVAL op1_def_addr, 0x00200000
+                               |       SET_ZVAL_W2 op1_def_addr, 0xc1e00000
                        |.endif
                }
-               |       SET_ZVAL_TYPE_INFO op1_addr, IS_DOUBLE
+               |       SET_ZVAL_TYPE_INFO op1_def_addr, IS_DOUBLE
                if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
                    opline->result_type != IS_UNUSED) {
                        |       ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R1
index 806e86af20a352f988c2d83391827fd20bada0bd..f5e80cf78167b31e316284a943e2b473d5b113ef 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-JIT INC: 018
+JIT INC: 019
 --INI--
 opcache.enable=1
 opcache.enable_cli=1
diff --git a/ext/opcache/tests/jit/inc_020.phpt b/ext/opcache/tests/jit/inc_020.phpt
new file mode 100644 (file)
index 0000000..2ebfe8c
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+JIT INC: 020
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('../skipif.inc'); ?>
+--FILE--
+<?php
+function foo($row) {
+       foreach ($row as $key => $value) {
+               if (is_int($key)) {
+                       $key++;
+               }
+               if (isset($row[$key])) {
+                       return false;
+               }
+       }
+       return true;
+}
+?>
+OK
+--EXPECT--
+OK
\ No newline at end of file