@@ -10819,56 +10819,53 @@ static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zen
10819
10819
return 1;
10820
10820
}
10821
10821
10822
- #define ZEND_WRONG_PROPERTY_OFFSET 0
10823
-
10824
- static uint32_t zend_get_known_property_offset(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename, zend_property_info **prop_info)
10822
+ static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
10825
10823
{
10826
- zend_property_info *info;
10827
-
10828
- *prop_info = NULL;
10824
+ zend_property_info *info = NULL;
10829
10825
10830
10826
if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) {
10831
- return ZEND_WRONG_PROPERTY_OFFSET ;
10827
+ return NULL ;
10832
10828
}
10833
10829
10834
- if (ce->info.user.filename != filename) {
10835
- /* class declaration might be changed independently */
10836
- return ZEND_WRONG_PROPERTY_OFFSET;
10837
- }
10830
+ if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
10831
+ if (ce->info.user.filename != filename) {
10832
+ /* class declaration might be changed independently */
10833
+ return NULL;
10834
+ }
10838
10835
10839
- if (ce->parent) {
10840
- zend_class_entry *parent = ce->parent;
10836
+ if (ce->parent) {
10837
+ zend_class_entry *parent = ce->parent;
10841
10838
10842
- do {
10843
- if (parent->type == ZEND_INTERNAL_CLASS) {
10844
- break;
10845
- } else if (parent->info.user.filename != filename) {
10846
- /* some of parents class declarations might be changed independently */
10847
- /* TODO: this check may be not enough, because even
10848
- * in the same it's possible to conditionally define
10849
- * few classes with the same name, and "parent" may
10850
- * change from request to request.
10851
- */
10852
- return ZEND_WRONG_PROPERTY_OFFSET;
10853
- }
10854
- parent = parent->parent;
10855
- } while (parent);
10839
+ do {
10840
+ if (parent->type == ZEND_INTERNAL_CLASS) {
10841
+ break;
10842
+ } else if (parent->info.user.filename != filename) {
10843
+ /* some of parents class declarations might be changed independently */
10844
+ /* TODO: this check may be not enough, because even
10845
+ * in the same it's possible to conditionally define
10846
+ * few classes with the same name, and "parent" may
10847
+ * change from request to request.
10848
+ */
10849
+ return NULL;
10850
+ }
10851
+ parent = parent->parent;
10852
+ } while (parent);
10853
+ }
10856
10854
}
10857
10855
10858
10856
info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
10859
10857
if (info == NULL ||
10860
- info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
10858
+ !IS_VALID_PROPERTY_OFFSET( info->offset) ||
10861
10859
(info->flags & ZEND_ACC_STATIC)) {
10862
- return ZEND_WRONG_PROPERTY_OFFSET ;
10860
+ return NULL ;
10863
10861
}
10864
10862
10865
10863
if (!(info->flags & ZEND_ACC_PUBLIC) &&
10866
10864
(!on_this || info->ce != ce)) {
10867
- return ZEND_WRONG_PROPERTY_OFFSET ;
10865
+ return NULL ;
10868
10866
}
10869
10867
10870
- *prop_info = info;
10871
- return info->offset;
10868
+ return info;
10872
10869
}
10873
10870
10874
10871
static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
@@ -10879,14 +10876,16 @@ static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string
10879
10876
return 1;
10880
10877
}
10881
10878
10882
- if (ce->info.user.filename != filename) {
10883
- /* class declaration might be changed independently */
10884
- return 1;
10879
+ if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
10880
+ if (ce->info.user.filename != filename) {
10881
+ /* class declaration might be changed independently */
10882
+ return 1;
10883
+ }
10885
10884
}
10886
10885
10887
10886
info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
10888
10887
if (info == NULL ||
10889
- info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
10888
+ !IS_VALID_PROPERTY_OFFSET( info->offset) ||
10890
10889
(info->flags & ZEND_ACC_STATIC)) {
10891
10890
return 1;
10892
10891
}
@@ -10902,7 +10901,6 @@ static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string
10902
10901
static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, zend_bool op1_indirect, zend_class_entry *ce, zend_bool ce_is_instanceof, zend_bool use_this, int may_throw)
10903
10902
{
10904
10903
zval *member;
10905
- uint32_t offset;
10906
10904
zend_property_info *prop_info;
10907
10905
zend_bool may_be_dynamic = 1;
10908
10906
zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
@@ -10914,7 +10912,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
10914
10912
10915
10913
member = RT_CONSTANT(opline, opline->op2);
10916
10914
ZEND_ASSERT(Z_TYPE_P(member) == IS_STRING && Z_STRVAL_P(member)[0] != '\0');
10917
- offset = zend_get_known_property_offset (ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename, &prop_info );
10915
+ prop_info = zend_get_known_property_info (ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename);
10918
10916
10919
10917
if (opline->op1_type == IS_UNUSED || use_this) {
10920
10918
| GET_ZVAL_PTR FCARG1a, this_addr
@@ -10952,7 +10950,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
10952
10950
| GET_ZVAL_PTR FCARG1a, op1_addr
10953
10951
}
10954
10952
10955
- if (offset == ZEND_WRONG_PROPERTY_OFFSET ) {
10953
+ if (!prop_info ) {
10956
10954
| mov r0, EX->run_time_cache
10957
10955
| mov r2, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)]
10958
10956
| cmp r2, aword [FCARG1a + offsetof(zend_object, ce)]
@@ -11004,8 +11002,8 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11004
11002
|.code
11005
11003
}
11006
11004
} else {
11007
- prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, offset);
11008
- | mov edx, dword [FCARG1a + offset + 8]
11005
+ prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, prop_info-> offset);
11006
+ | mov edx, dword [FCARG1a + prop_info-> offset + 8]
11009
11007
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
11010
11008
int32_t exit_point = zend_jit_trace_get_exit_point(opline, opline, NULL, ZEND_JIT_EXIT_TO_VM);
11011
11009
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
@@ -11074,7 +11072,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11074
11072
11075
11073
|.cold_code
11076
11074
11077
- if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || offset == ZEND_WRONG_PROPERTY_OFFSET ) {
11075
+ if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || !prop_info ) {
11078
11076
|5:
11079
11077
| SAVE_VALID_OPLINE opline, r0
11080
11078
if (opline->opcode == ZEND_FETCH_OBJ_W) {
@@ -11120,7 +11118,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11120
11118
}
11121
11119
}
11122
11120
11123
- if (offset == ZEND_WRONG_PROPERTY_OFFSET
11121
+ if (!prop_info
11124
11122
&& may_be_dynamic
11125
11123
&& opline->opcode != ZEND_FETCH_OBJ_W) {
11126
11124
|8:
@@ -11155,7 +11153,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_op *opline, const zen
11155
11153
}
11156
11154
11157
11155
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
11158
- && offset != ZEND_WRONG_PROPERTY_OFFSET
11156
+ && prop_info
11159
11157
&& opline->op1_type != IS_VAR
11160
11158
&& opline->op1_type != IS_TMP_VAR) {
11161
11159
may_throw = 0;
0 commit comments