Skip to content

Commit dcdc8ab

Browse files
authored
Prevent inlining of zend_compile_expr_inner() to guarantee low stack usage of compilation (#23294)
1 parent 6c7eeb9 commit dcdc8ab

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Zend/zend_compile.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12447,7 +12447,9 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */
1244712447
}
1244812448
/* }}} */
1244912449

12450-
static void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */
12450+
/* Keep this out of zend_compile_expr(): the two form a recursion cycle, so inlining merges this
12451+
* frame into every nesting level of an expression, tripling the stack needed to compile it. */
12452+
static zend_never_inline void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */
1245112453
{
1245212454
/* CG(zend_lineno) = ast->lineno; */
1245312455
CG(zend_lineno) = zend_ast_get_lineno(ast);

0 commit comments

Comments
 (0)