Skip to content

Commit 2e50c8d

Browse files
committed
Emit EXT_STMT after each pipe stage, and attach the TMP var that holds the intermediary result
1 parent 0596135 commit 2e50c8d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Zend/zend_compile.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ static void zend_add_to_list(void *result, void *item) /* {{{ */
19201920
}
19211921
/* }}} */
19221922

1923-
static void zend_do_extended_stmt(void) /* {{{ */
1923+
static void zend_do_extended_stmt(znode* result) /* {{{ */
19241924
{
19251925
zend_op *opline;
19261926

@@ -1931,6 +1931,9 @@ static void zend_do_extended_stmt(void) /* {{{ */
19311931
opline = get_next_op();
19321932

19331933
opline->opcode = ZEND_EXT_STMT;
1934+
if (result) {
1935+
SET_NODE(opline->op1, result);
1936+
}
19341937
}
19351938
/* }}} */
19361939

@@ -6050,7 +6053,7 @@ static void zend_compile_for(zend_ast *ast) /* {{{ */
60506053

60516054
zend_update_jump_target_to_next(opnum_jmp);
60526055
zend_compile_for_expr_list(&result, cond_ast);
6053-
zend_do_extended_stmt();
6056+
zend_do_extended_stmt(NULL);
60546057

60556058
zend_emit_cond_jump(ZEND_JMPNZ, &result, opnum_start);
60566059

@@ -6171,7 +6174,7 @@ static void zend_compile_if(zend_ast *ast) /* {{{ */
61716174

61726175
if (i > 0) {
61736176
CG(zend_lineno) = cond_ast->lineno;
6174-
zend_do_extended_stmt();
6177+
zend_do_extended_stmt(NULL);
61756178
}
61766179

61776180
zend_compile_expr(&cond_node, cond_ast);
@@ -6500,6 +6503,8 @@ static void zend_compile_pipe(znode *result, zend_ast *ast)
65006503
}
65016504

65026505
zend_compile_expr(result, fcall_ast);
6506+
CG(zend_lineno) = fcall_ast->lineno;
6507+
zend_do_extended_stmt(result);
65036508
}
65046509

65056510
static void zend_compile_match(znode *result, zend_ast *ast)
@@ -8532,7 +8537,7 @@ static zend_op_array *zend_compile_func_decl_ex(
85328537
/* put the implicit return on the really last line */
85338538
CG(zend_lineno) = decl->end_lineno;
85348539

8535-
zend_do_extended_stmt();
8540+
zend_do_extended_stmt(NULL);
85368541
zend_emit_final_return(0);
85378542

85388543
pass_two(CG(active_op_array));
@@ -11602,7 +11607,7 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */
1160211607
CG(zend_lineno) = ast->lineno;
1160311608

1160411609
if ((CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) && !zend_is_unticked_stmt(ast)) {
11605-
zend_do_extended_stmt();
11610+
zend_do_extended_stmt(NULL);
1160611611
}
1160711612

1160811613
switch (ast->kind) {

0 commit comments

Comments
 (0)