[php-src] jit-arm64: Support for CONCAT
| From: | Dmitry Stogov | Date: | Wed, 21 Apr 2021 13:23:39 +0000 |
| Subject: | [php-src] jit-arm64: Support for CONCAT | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115727@lists.php.net to get a copy of this message | ||
Author: Dmitry Stogov (dstogov)
Date: 2021-04-21T16:23:23+03:00
Commit: https://github.com/php/php-src/commit/4f2c984482d16e9c7067bd6ac7f9147b431bcac7
Raw diff: https://github.com/php/php-src/commit/4f2c984482d16e9c7067bd6ac7f9147b431bcac7.diff
Support for CONCAT
Changed paths:
A ext/opcache/tests/jit/concat_001.phpt
M ext/opcache/jit/zend_jit_arm64.dasc
Diff:
diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc
index 0fce4a0fc905..33df0f49f351 100644
--- a/ext/opcache/jit/zend_jit_arm64.dasc
+++ b/ext/opcache/jit/zend_jit_arm64.dasc
@@ -4092,7 +4092,18 @@ static int zend_jit_concat_helper(dasm_State **Dst,
|.cold_code
|6:
}
- | NIY // TODO
+ if (Z_REG(res_addr) != ZREG_FCARG1x || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1x, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2x, op1_addr
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ | SET_EX_OPLINE opline, REG0
+ | EXT_CALL concat_function, REG0
+ /* concatination with empty string may increase refcount */
+ op1_info |= MAY_BE_RCN;
+ op2_info |= MAY_BE_RCN;
+ | FREE_OP op1_type, op1, op1_info, 0, opline, ZREG_TMP1, ZREG_TMP2
+ | FREE_OP op2_type, op2, op2_info, 0, opline, ZREG_TMP1, ZREG_TMP2
if (may_throw) {
zend_jit_check_exception(Dst);
}
diff --git a/ext/opcache/tests/jit/concat_001.phpt b/ext/opcache/tests/jit/concat_001.phpt
new file mode 100644
index 000000000000..85d4633765d3
--- /dev/null
+++ b/ext/opcache/tests/jit/concat_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT CONCAT: 001
+--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
+--EXTENSIONS--
+opcache
+--FILE--
+<?php
+function foo($a, $b) {
+ return $a . $b;
+}
+var_dump(foo("a", "b"));
+var_dump(foo("a", 5));
+?>
+--EXPECT--
+string(2) "ab"
+string(2) "a5"