Skip to content

Commit 4e58749

Browse files
committed
Use specialized VM functions again
1 parent 38d3bfc commit 4e58749

File tree

3 files changed

+52
-32
lines changed

3 files changed

+52
-32
lines changed

Zend/zend_execute.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,26 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(v
15061506
zend_throw_error(NULL, "Cannot use object as array");
15071507
}
15081508

1509+
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_array_offset_access(const zval *offset)
1510+
{
1511+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_RW);
1512+
}
1513+
1514+
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_array_offset_isset(const zval *offset)
1515+
{
1516+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_IS);
1517+
}
1518+
1519+
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_array_offset_unset(const zval *offset)
1520+
{
1521+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_UNSET);
1522+
}
1523+
1524+
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_string_offset_access(const zval *offset)
1525+
{
1526+
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), offset, BP_VAR_RW);
1527+
}
1528+
15091529
static zend_never_inline void zend_assign_to_object_dim(zend_object *obj, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
15101530
{
15111531
obj->handlers->write_dimension(obj, dim, value);
@@ -1631,7 +1651,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
16311651
}
16321652
return offset;
16331653
}
1634-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, type);
1654+
zend_illegal_string_offset_access(dim);
16351655
return 0;
16361656
}
16371657
case IS_UNDEF:
@@ -1647,7 +1667,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
16471667
dim = Z_REFVAL_P(dim);
16481668
goto try_again;
16491669
default:
1650-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, type);
1670+
zend_illegal_string_offset_access(dim);
16511671
return 0;
16521672
}
16531673

@@ -2370,7 +2390,7 @@ static zend_never_inline uint8_t slow_index_convert(HashTable *ht, const zval *d
23702390
value->lval = 1;
23712391
return IS_LONG;
23722392
default:
2373-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_R);
2393+
zend_illegal_array_offset_access(dim);
23742394
return IS_NULL;
23752395
}
23762396
}
@@ -2444,7 +2464,7 @@ static zend_never_inline uint8_t slow_index_convert_w(HashTable *ht, const zval
24442464
value->lval = 1;
24452465
return IS_LONG;
24462466
default:
2447-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), dim, BP_VAR_W);
2467+
zend_illegal_array_offset_access(dim);
24482468
return IS_NULL;
24492469
}
24502470
}
@@ -2742,7 +2762,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
27422762
ZVAL_NULL(result);
27432763
return;
27442764
}
2745-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_R);
2765+
zend_illegal_string_offset_access(dim);
27462766
ZVAL_NULL(result);
27472767
return;
27482768
}
@@ -2781,7 +2801,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
27812801
dim = Z_REFVAL_P(dim);
27822802
goto try_string_offset;
27832803
default:
2784-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_R);
2804+
zend_illegal_string_offset_access(dim);
27852805
ZVAL_NULL(result);
27862806
return;
27872807
}
@@ -2903,7 +2923,7 @@ static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable
29032923
ZVAL_UNDEFINED_OP2();
29042924
goto str_idx;
29052925
} else {
2906-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_IS);
2926+
zend_illegal_array_offset_isset(offset);
29072927
return NULL;
29082928
}
29092929
}
@@ -3026,7 +3046,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_array_key_exists_fast(HashTable
30263046
str = ZSTR_EMPTY_ALLOC();
30273047
goto str_key;
30283048
} else {
3029-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), key, BP_VAR_R);
3049+
zend_illegal_array_offset_access(key);
30303050
return 0;
30313051
}
30323052
}

Zend/zend_vm_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6098,7 +6098,7 @@ ZEND_VM_C_LABEL(num_index):
60986098
str = ZSTR_EMPTY_ALLOC();
60996099
ZEND_VM_C_GOTO(str_index);
61006100
} else {
6101-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_W);
6101+
zend_illegal_array_offset_access(offset);
61026102
zval_ptr_dtor_nogc(expr_ptr);
61036103
}
61046104
FREE_OP2();
@@ -6610,7 +6610,7 @@ ZEND_VM_C_LABEL(num_index_dim):
66106610
key = ZSTR_EMPTY_ALLOC();
66116611
ZEND_VM_C_GOTO(str_index_dim);
66126612
} else {
6613-
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), offset, BP_VAR_UNSET);
6613+
zend_illegal_array_offset_unset(offset);
66146614
}
66156615
break;
66166616
} else if (Z_ISREF_P(container)) {

Zend/zend_vm_execute.h

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)