Skip to content

Commit 512bc24

Browse files
committed
Move handling of ZEND_AST_OP_ARRAY last
1 parent d49f243 commit 512bc24

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Zend/zend_ast.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,14 +1104,7 @@ static size_t ZEND_FASTCALL zend_ast_tree_size(zend_ast *ast)
11041104

11051105
static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
11061106
{
1107-
if (ast->kind == ZEND_AST_OP_ARRAY) {
1108-
zend_ast_zval *new = (zend_ast_zval*)buf;
1109-
new->kind = ZEND_AST_OP_ARRAY;
1110-
new->attr = ast->attr;
1111-
ZVAL_COPY(&new->val, &((zend_ast_zval *) ast)->val);
1112-
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
1113-
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
1114-
} else if (ast->kind == ZEND_AST_ZVAL) {
1107+
if (ast->kind == ZEND_AST_ZVAL) {
11151108
zend_ast_zval *new = (zend_ast_zval*)buf;
11161109
new->kind = ZEND_AST_ZVAL;
11171110
new->attr = ast->attr;
@@ -1125,6 +1118,13 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
11251118
ZVAL_STR_COPY(&new->val, zend_ast_get_constant_name(ast));
11261119
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
11271120
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
1121+
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
1122+
zend_ast_zval *new = (zend_ast_zval*)buf;
1123+
new->kind = ZEND_AST_OP_ARRAY;
1124+
new->attr = ast->attr;
1125+
ZVAL_COPY(&new->val, &((zend_ast_zval *) ast)->val);
1126+
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
1127+
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
11281128
} else if (zend_ast_is_list(ast)) {
11291129
zend_ast_list *list = zend_ast_get_list(ast);
11301130
zend_ast_list *new = (zend_ast_list*)buf;

Zend/zend_ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
enum _zend_ast_kind {
3535
/* special nodes */
3636
ZEND_AST_ZVAL = 1 << ZEND_AST_SPECIAL_SHIFT,
37-
ZEND_AST_OP_ARRAY,
3837
ZEND_AST_CONSTANT,
38+
ZEND_AST_OP_ARRAY,
3939
ZEND_AST_ZNODE,
4040

4141
/* declaration nodes */

ext/opcache/zend_persist.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ static zend_ast *zend_persist_ast(zend_ast *ast)
176176
uint32_t i;
177177
zend_ast *node;
178178

179-
if (ast->kind == ZEND_AST_OP_ARRAY) {
179+
if (ast->kind == ZEND_AST_ZVAL || ast->kind == ZEND_AST_CONSTANT) {
180180
zend_ast_zval *copy = zend_shared_memdup(ast, sizeof(zend_ast_zval));
181-
zend_persist_op_array(&copy->val);
181+
zend_persist_zval(&copy->val);
182182
node = (zend_ast *) copy;
183-
} else if (ast->kind == ZEND_AST_ZVAL || ast->kind == ZEND_AST_CONSTANT) {
183+
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
184184
zend_ast_zval *copy = zend_shared_memdup(ast, sizeof(zend_ast_zval));
185-
zend_persist_zval(&copy->val);
185+
zend_persist_op_array(&copy->val);
186186
node = (zend_ast *) copy;
187187
} else if (zend_ast_is_list(ast)) {
188188
zend_ast_list *list = zend_ast_get_list(ast);

ext/opcache/zend_persist_calc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ static void zend_persist_ast_calc(zend_ast *ast)
7777
{
7878
uint32_t i;
7979

80-
if (ast->kind == ZEND_AST_OP_ARRAY) {
81-
ADD_SIZE(sizeof(zend_ast_zval));
82-
zend_persist_op_array_calc(&((zend_ast_zval*)(ast))->val);
83-
} else if (ast->kind == ZEND_AST_ZVAL || ast->kind == ZEND_AST_CONSTANT) {
80+
if (ast->kind == ZEND_AST_ZVAL || ast->kind == ZEND_AST_CONSTANT) {
8481
ADD_SIZE(sizeof(zend_ast_zval));
8582
zend_persist_zval_calc(&((zend_ast_zval*)(ast))->val);
83+
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
84+
ADD_SIZE(sizeof(zend_ast_zval));
85+
zend_persist_op_array_calc(&((zend_ast_zval*)(ast))->val);
8686
} else if (zend_ast_is_list(ast)) {
8787
zend_ast_list *list = zend_ast_get_list(ast);
8888
ADD_SIZE(sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children);

0 commit comments

Comments
 (0)