Skip to content

Commit 8d305c8

Browse files
committed
[JIT] Avoid generating fast property assign path for readonly properties
readonly properties will usually be IS_UNDEF on assignment, dodging the fast path anyway. The fast path does not handle the readonly scope check. The alternative would be handling scope there, but since there are some many variants that might be more trouble than it's worth.
1 parent 11094d5 commit 8d305c8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14435,7 +14435,11 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1443514435
} else {
1443614436
prop_ref = ir_ADD_OFFSET(obj_ref, prop_info->offset);
1443714437
prop_addr = ZEND_ADDR_REF_ZVAL(prop_ref);
14438-
if (!ce || ce_is_instanceof || !(ce->ce_flags & ZEND_ACC_IMMUTABLE) || ce->__get || ce->__set || (prop_info->flags & ZEND_ACC_READONLY)) {
14438+
if (prop_info->flags & ZEND_ACC_READONLY) {
14439+
ZEND_ASSERT(slow_inputs == IR_UNUSED);
14440+
goto slow_path;
14441+
}
14442+
if (!ce || ce_is_instanceof || !(ce->ce_flags & ZEND_ACC_IMMUTABLE) || ce->__get || ce->__set) {
1443914443
// Undefined property with magic __get()/__set()
1444014444
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
1444114445
int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
@@ -14527,6 +14531,8 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1452714531
ir_ref arg3, arg5;
1452814532

1452914533
ir_MERGE_list(slow_inputs);
14534+
14535+
slow_path:
1453014536
jit_SET_EX_OPLINE(jit, opline);
1453114537

1453214538
if (Z_MODE(val_addr) == IS_REG) {

0 commit comments

Comments
 (0)