summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2021-03-19 23:34:38 +0300
committerDmitry Stogov <dmitry@zend.com>2021-03-19 23:34:38 +0300
commit6690547a58f07778e795e857e574159fe8fb3650 (patch)
tree1c35505ea4d6bf4adb54749057827cb1fadb7ed3 /ext
parent340013ad01aa6bda92c6c71080f315fc63c9841c (diff)
downloadphp-git-6690547a58f07778e795e857e574159fe8fb3650.tar.gz
Use zend_hash_lookup()
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/jit/zend_jit_disasm_x86.c2
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c44
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc4
3 files changed, 6 insertions, 44 deletions
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c
index 977e85e1cb..6a9892bafc 100644
--- a/ext/opcache/jit/zend_jit_disasm_x86.c
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c
@@ -412,9 +412,7 @@ static int zend_jit_disasm_init(void)
REGISTER_HELPER(zend_jit_leave_func_helper);
REGISTER_HELPER(zend_jit_symtable_find);
REGISTER_HELPER(zend_jit_hash_index_lookup_rw);
- REGISTER_HELPER(zend_jit_hash_index_lookup_w);
REGISTER_HELPER(zend_jit_hash_lookup_rw);
- REGISTER_HELPER(zend_jit_hash_lookup_w);
REGISTER_HELPER(zend_jit_symtable_lookup_rw);
REGISTER_HELPER(zend_jit_symtable_lookup_w);
REGISTER_HELPER(zend_jit_undefined_op_helper);
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 8f434090b8..53e0107bdc 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -259,16 +259,6 @@ static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_lon
return retval;
}
-static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_w(HashTable *ht, zend_long idx)
-{
- zval *retval = _zend_hash_index_find(ht, idx);
-
- if (!retval) {
- retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
- }
- return retval;
-}
-
static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str)
{
zval *retval = zend_hash_find_ex(ht, str, 1);
@@ -285,15 +275,6 @@ static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *s
return retval;
}
-static zval* ZEND_FASTCALL zend_jit_hash_lookup_w(HashTable *ht, zend_string *str)
-{
- zval *retval = zend_hash_find_ex(ht, str, 1);
- if (!retval) {
- retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
- }
- return retval;
-}
-
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
{
zend_ulong idx;
@@ -342,7 +323,6 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
{
zend_ulong idx;
register const char *tmp = str->val;
- zval *retval;
do {
if (*tmp > '9') {
@@ -357,19 +337,11 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
}
}
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
- retval = zend_hash_index_find(ht, idx);
- if (!retval) {
- retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
- }
- return retval;
+ return zend_hash_index_lookup(ht, idx);
}
} while (0);
- retval = zend_hash_find(ht, str);
- if (!retval) {
- retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
- }
- return retval;
+ return zend_hash_lookup(ht, str);
}
static int ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
@@ -713,18 +685,10 @@ str_index:
if (ZEND_HANDLE_NUMERIC(offset_key, hval)) {
goto num_index;
}
- retval = zend_hash_find(ht, offset_key);
- if (!retval) {
- retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval));
- }
- return retval;
+ return zend_hash_lookup(ht, offset_key);
num_index:
- ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
- return retval;
-
-num_undef:
- retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
+ ZEND_HASH_INDEX_LOOKUP(ht, hval, retval);
return retval;
}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 6aac9306e4..73f97be95b 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -5546,7 +5546,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
| // hval = Z_LVAL_P(dim);
| GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
}
- | EXT_CALL zend_jit_hash_index_lookup_w, r0
+ | EXT_CALL zend_hash_index_lookup, r0
}
break;
default:
@@ -5648,7 +5648,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
if (opline->op2_type != IS_CONST) {
| EXT_CALL zend_jit_symtable_lookup_w, r0
} else {
- | EXT_CALL zend_jit_hash_lookup_w, r0
+ | EXT_CALL zend_hash_lookup, r0
}
break;
default: