Skip to content

Commit 5695fe4

Browse files
committed
Deprecate leading underscore for _zend_hash_find_known_hash
When should we actually remove it? PHP 9.0?
1 parent 084d49a commit 5695fe4

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

Zend/zend_hash.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,13 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *ke
22702270
return p ? &p->val : NULL;
22712271
}
22722272

2273-
ZEND_API zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key)
2273+
ZEND_API ZEND_ATTRIBUTE_DEPRECATED
2274+
zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key)
2275+
{
2276+
return zend_hash_find_known_hash(ht, key);
2277+
}
2278+
2279+
ZEND_API zval* ZEND_FASTCALL zend_hash_find_known_hash(const HashTable *ht, zend_string *key)
22742280
{
22752281
Bucket *p;
22762282

Zend/zend_hash.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,19 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char
177177
ZEND_API zval* ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h);
178178
ZEND_API zval* ZEND_FASTCALL _zend_hash_index_find(const HashTable *ht, zend_ulong h);
179179

180-
/* The same as zend_hash_find(), but hash value of the key must be already calculated */
181-
ZEND_API zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key);
180+
/**
181+
* The same as zend_hash_find(), but hash value of the key must be already calculated.
182+
* Use zend_hash_find_known_hash() when targeting PHP 8.1+; old name kept for bc only.
183+
*/
184+
ZEND_API ZEND_ATTRIBUTE_DEPRECATED
185+
zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key);
186+
187+
ZEND_API zval* ZEND_FASTCALL zend_hash_find_known_hash(const HashTable *ht, zend_string *key);
182188

183189
static zend_always_inline zval *zend_hash_find_ex(const HashTable *ht, zend_string *key, bool known_hash)
184190
{
185191
if (known_hash) {
186-
return _zend_hash_find_known_hash(ht, key);
192+
return zend_hash_find_known_hash(ht, key);
187193
} else {
188194
return zend_hash_find(ht, key);
189195
}

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5144,7 +5144,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
51445144
| EXT_CALL zend_hash_find, REG0
51455145
|1:
51465146
} else {
5147-
| EXT_CALL _zend_hash_find_known_hash, REG0
5147+
| EXT_CALL zend_hash_find_known_hash, REG0
51485148
}
51495149
| mov REG0, RETVALx
51505150
if (not_found_exit_addr) {
@@ -5168,7 +5168,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
51685168
| EXT_CALL zend_hash_find, REG0
51695169
|1:
51705170
} else {
5171-
| EXT_CALL _zend_hash_find_known_hash, REG0
5171+
| EXT_CALL zend_hash_find_known_hash, REG0
51725172
}
51735173
| mov REG0, RETVALx
51745174
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
@@ -13901,7 +13901,7 @@ static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t o
1390113901
} else {
1390213902
zend_string *str = Z_STR_P(RT_CONSTANT(opline, opline->op1));
1390313903
| LOAD_ADDR FCARG2x, str
13904-
| EXT_CALL _zend_hash_find_known_hash, REG0
13904+
| EXT_CALL zend_hash_find_known_hash, REG0
1390513905
}
1390613906
if (exit_addr) {
1390713907
if (smart_branch_opcode == ZEND_JMPZ) {

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5617,7 +5617,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
56175617
| EXT_CALL zend_hash_find, r0
56185618
|1:
56195619
} else {
5620-
| EXT_CALL _zend_hash_find_known_hash, r0
5620+
| EXT_CALL zend_hash_find_known_hash, r0
56215621
}
56225622
| test r0, r0
56235623
if (not_found_exit_addr) {
@@ -5640,7 +5640,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
56405640
| EXT_CALL zend_hash_find, r0
56415641
|1:
56425642
} else {
5643-
| EXT_CALL _zend_hash_find_known_hash, r0
5643+
| EXT_CALL zend_hash_find_known_hash, r0
56445644
}
56455645
| test r0, r0
56465646
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) {
@@ -14753,7 +14753,7 @@ static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t o
1475314753
} else {
1475414754
zend_string *str = Z_STR_P(RT_CONSTANT(opline, opline->op1));
1475514755
| LOAD_ADDR FCARG2a, str
14756-
| EXT_CALL _zend_hash_find_known_hash, r0
14756+
| EXT_CALL zend_hash_find_known_hash, r0
1475714757
}
1475814758
| test r0, r0
1475914759
if (exit_addr) {

0 commit comments

Comments
 (0)