summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-06-17 14:45:25 +0300
committerDmitry Stogov <dmitry@zend.com>2020-06-17 14:45:25 +0300
commit18347758d7f51ad6a7bdaadef74c60e3e348b625 (patch)
tree0e14b703442f1e4c48c646c7ab43aca55fc5f33d /ext
parent3830855a651e98ad5aa01fad03730289a12f0284 (diff)
downloadphp-git-18347758d7f51ad6a7bdaadef74c60e3e348b625.tar.gz
Improved JIT for SEPARATE_ARRAY
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/jit/zend_jit_disasm_x86.c1
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c9
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc21
3 files changed, 22 insertions, 9 deletions
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c
index 1d718b7bd2..ccabb564c9 100644
--- a/ext/opcache/jit/zend_jit_disasm_x86.c
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c
@@ -454,6 +454,7 @@ static int zend_jit_disasm_init(void)
REGISTER_HELPER(zend_jit_hot_func);
REGISTER_HELPER(zend_jit_check_constant);
REGISTER_HELPER(zend_jit_array_free);
+ REGISTER_HELPER(zend_jit_zval_array_dup);
#undef REGISTER_HELPER
#ifndef _WIN32
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 83cd44a554..99b3f8817d 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -1558,3 +1558,12 @@ static void ZEND_FASTCALL zend_jit_array_free(HashTable *ht)
}
FREE_HASHTABLE(ht);
}
+
+static HashTable *ZEND_FASTCALL zend_jit_zval_array_dup(zval *arr)
+{
+ HashTable *ht = Z_ARRVAL_P(arr);
+
+ ht = zend_array_dup(ht);
+ ZVAL_ARR(arr, ht);
+ return ht;
+}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 6c7eb92563..d0be13b108 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -1416,7 +1416,7 @@ static void* dasm_labels[zend_lb_MAX];
|| tmp_reg = (Z_REG(addr) == ZREG_FCARG1a) ? ZREG_R0 : ZREG_FCARG1a;
| GET_ZVAL_LVAL tmp_reg, addr
|| if (RC_MAY_BE_1(op_info)) {
-| cmp dword [Ra(tmp_reg)], 1 // if (GC_REFCOUNTED() > 1)
+| cmp dword [Ra(tmp_reg)], 1 // if (GC_REFCOUNT() > 1)
|| if (cold) {
| ja >1
|.cold_code
@@ -1429,13 +1429,12 @@ static void* dasm_labels[zend_lb_MAX];
| GC_DELREF Ra(tmp_reg)
|1:
|| if (Z_REG(addr) == ZREG_FCARG1a) {
-| mov aword T1, FCARG1a // save
-|| } else {
-| LOAD_ZVAL_ADDR FCARG1a, addr
-|| }
-| EXT_CALL zval_copy_ctor_func, r0
-|| if (Z_REG(addr) == ZREG_FCARG1a) {
-| mov FCARG1a, aword T1 // restore
+| EXT_CALL zend_jit_zval_array_dup, r0
+|| } else {
+| EXT_CALL zend_array_dup, r0
+| SET_ZVAL_PTR addr, r0
+| SET_ZVAL_TYPE_INFO addr, IS_ARRAY_EX
+| mov FCARG1a, r0
|| }
|| if (RC_MAY_BE_1(op_info)) {
|| if (cold) {
@@ -1444,8 +1443,12 @@ static void* dasm_labels[zend_lb_MAX];
|| }
|| }
|2:
-|| }
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov FCARG1a, r0
+|| }
+|| } else {
| GET_ZVAL_LVAL ZREG_FCARG1a, addr
+|| }
|.endmacro
|.macro EFREE_REG_24, op_array, opline