]> granicus.if.org Git - php/commitdiff
Use zend_hash_lookup()
authorDmitry Stogov <dmitry@zend.com>
Fri, 19 Mar 2021 20:34:38 +0000 (23:34 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 19 Mar 2021 20:34:38 +0000 (23:34 +0300)
ext/opcache/jit/zend_jit_disasm_x86.c
ext/opcache/jit/zend_jit_helpers.c
ext/opcache/jit/zend_jit_x86.dasc

index 977e85e1cb6f28bb82e94405a726d55f930e0064..6a9892bafcdea700d4fad09189d0b940edda3eea 100644 (file)
@@ -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);
index 8f434090b834b92a8f1f806b58b14eec0c0e3790..53e0107bdc71675ed3147fb0a25ebc185b61afbd 100644 (file)
@@ -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;
 }
 
index 6aac9306e408cf106d7a4a9af29c04aacf4c3a00..73f97be95bcec5ca3869b5e97485110519a1b2d0 100644 (file)
@@ -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: