Skip to content

Commit 6690547

Browse files
committed
Use zend_hash_lookup()
1 parent 340013a commit 6690547

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

ext/opcache/jit/zend_jit_disasm_x86.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,7 @@ static int zend_jit_disasm_init(void)
412412
REGISTER_HELPER(zend_jit_leave_func_helper);
413413
REGISTER_HELPER(zend_jit_symtable_find);
414414
REGISTER_HELPER(zend_jit_hash_index_lookup_rw);
415-
REGISTER_HELPER(zend_jit_hash_index_lookup_w);
416415
REGISTER_HELPER(zend_jit_hash_lookup_rw);
417-
REGISTER_HELPER(zend_jit_hash_lookup_w);
418416
REGISTER_HELPER(zend_jit_symtable_lookup_rw);
419417
REGISTER_HELPER(zend_jit_symtable_lookup_w);
420418
REGISTER_HELPER(zend_jit_undefined_op_helper);

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,6 @@ static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_lon
259259
return retval;
260260
}
261261

262-
static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_w(HashTable *ht, zend_long idx)
263-
{
264-
zval *retval = _zend_hash_index_find(ht, idx);
265-
266-
if (!retval) {
267-
retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
268-
}
269-
return retval;
270-
}
271-
272262
static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str)
273263
{
274264
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
285275
return retval;
286276
}
287277

288-
static zval* ZEND_FASTCALL zend_jit_hash_lookup_w(HashTable *ht, zend_string *str)
289-
{
290-
zval *retval = zend_hash_find_ex(ht, str, 1);
291-
if (!retval) {
292-
retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
293-
}
294-
return retval;
295-
}
296-
297278
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
298279
{
299280
zend_ulong idx;
@@ -342,7 +323,6 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
342323
{
343324
zend_ulong idx;
344325
register const char *tmp = str->val;
345-
zval *retval;
346326

347327
do {
348328
if (*tmp > '9') {
@@ -357,19 +337,11 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
357337
}
358338
}
359339
if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
360-
retval = zend_hash_index_find(ht, idx);
361-
if (!retval) {
362-
retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
363-
}
364-
return retval;
340+
return zend_hash_index_lookup(ht, idx);
365341
}
366342
} while (0);
367343

368-
retval = zend_hash_find(ht, str);
369-
if (!retval) {
370-
retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
371-
}
372-
return retval;
344+
return zend_hash_lookup(ht, str);
373345
}
374346

375347
static int ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
@@ -713,18 +685,10 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
713685
if (ZEND_HANDLE_NUMERIC(offset_key, hval)) {
714686
goto num_index;
715687
}
716-
retval = zend_hash_find(ht, offset_key);
717-
if (!retval) {
718-
retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval));
719-
}
720-
return retval;
688+
return zend_hash_lookup(ht, offset_key);
721689

722690
num_index:
723-
ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
724-
return retval;
725-
726-
num_undef:
727-
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
691+
ZEND_HASH_INDEX_LOOKUP(ht, hval, retval);
728692
return retval;
729693
}
730694

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5546,7 +5546,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
55465546
| // hval = Z_LVAL_P(dim);
55475547
| GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
55485548
}
5549-
| EXT_CALL zend_jit_hash_index_lookup_w, r0
5549+
| EXT_CALL zend_hash_index_lookup, r0
55505550
}
55515551
break;
55525552
default:
@@ -5648,7 +5648,7 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
56485648
if (opline->op2_type != IS_CONST) {
56495649
| EXT_CALL zend_jit_symtable_lookup_w, r0
56505650
} else {
5651-
| EXT_CALL zend_jit_hash_lookup_w, r0
5651+
| EXT_CALL zend_hash_lookup, r0
56525652
}
56535653
break;
56545654
default:

0 commit comments

Comments
 (0)