Skip to content

Commit 42f9b80

Browse files
committed
Fix assertions when type inference is run for JIT
1 parent 8f0da22 commit 42f9b80

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,8 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
18771877
} \
18781878
} \
18791879
if (ssa_var_info[__var].type != __type) { \
1880-
ZEND_ASSERT(__ssa_var->var >= op_array->last_var || \
1880+
ZEND_ASSERT(ssa_opcodes != NULL || \
1881+
__ssa_var->var >= op_array->last_var || \
18811882
(ssa_var_info[__var].type & MAY_BE_REF) \
18821883
== (__type & MAY_BE_REF)); \
18831884
if (ssa_var_info[__var].type & ~__type) { \
@@ -3445,7 +3446,7 @@ static zend_always_inline int _zend_update_type_info(
34453446
zend_property_info *prop_info = zend_fetch_prop_info(op_array, ssa, opline, ssa_op);
34463447

34473448
tmp = zend_fetch_prop_type(script, prop_info, &ce);
3448-
if (opline->result_type != IS_TMP_VAR) {
3449+
if (opline->result_type == IS_VAR) {
34493450
tmp |= MAY_BE_REF | MAY_BE_INDIRECT;
34503451
} else if (!(opline->op1_type & (IS_VAR|IS_TMP_VAR)) || !(t1 & MAY_BE_RC1)) {
34513452
zend_class_entry *ce = NULL;
@@ -3481,7 +3482,7 @@ static zend_always_inline int _zend_update_type_info(
34813482
case ZEND_FETCH_STATIC_PROP_FUNC_ARG:
34823483
tmp = zend_fetch_prop_type(script,
34833484
zend_fetch_static_prop_info(script, op_array, ssa, opline), &ce);
3484-
if (opline->result_type != IS_TMP_VAR) {
3485+
if (opline->result_type == IS_VAR) {
34853486
tmp |= MAY_BE_REF | MAY_BE_INDIRECT;
34863487
} else {
34873488
tmp &= ~MAY_BE_RC1;
@@ -3600,6 +3601,8 @@ static zend_always_inline int _zend_update_type_info(
36003601
} else {
36013602
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
36023603
}
3604+
} else if (opline->result_type == IS_CV) {
3605+
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
36033606
} else {
36043607
tmp |= MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN;
36053608
switch (opline->opcode) {
@@ -3698,6 +3701,7 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
36983701
int i, j;
36993702
uint32_t tmp, worklist_len = zend_bitset_len(ssa_vars_count);
37003703
bool update_worklist = 1;
3704+
const zend_op **ssa_opcodes = NULL;
37013705

37023706
while (!zend_bitset_empty(worklist, worklist_len)) {
37033707
j = zend_bitset_first(worklist, worklist_len);

0 commit comments

Comments
 (0)