Skip to content

Commit 4f799e3

Browse files
committed
Make (void) immediately free constants
1 parent 7b57bfb commit 4f799e3

File tree

5 files changed

+1400
-1422
lines changed

5 files changed

+1400
-1422
lines changed

Zend/zend_compile.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10601,10 +10601,12 @@ static void zend_compile_void_cast(znode *result, zend_ast *ast)
1060110601
switch (expr_node.op_type) {
1060210602
case IS_TMP_VAR:
1060310603
case IS_VAR:
10604-
case IS_CONST:
1060510604
opline = zend_emit_op(NULL, ZEND_FREE, &expr_node, NULL);
1060610605
opline->extended_value = ZEND_FREE_VOID_CAST;
1060710606
break;
10607+
case IS_CONST:
10608+
zend_do_free(&expr_node);
10609+
break;
1060810610
}
1060910611
}
1061010612

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3202,7 +3202,7 @@ ZEND_VM_COLD_CONST_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
32023202
ZEND_VM_JMP(opline);
32033203
}
32043204

3205-
ZEND_VM_HANDLER(70, ZEND_FREE, CONST|TMPVAR, ANY)
3205+
ZEND_VM_HANDLER(70, ZEND_FREE, TMPVAR, ANY)
32063206
{
32073207
USE_OPLINE
32083208

0 commit comments

Comments
 (0)