com php-src: Merge remote-tracking branch 'php-src/master' into ast: Zend/zend.h Zend/zend_execute_API.c ext/opcache/Optimiz er/optimize_func_calls.c
ext/opcache/Optimizer/pass1 _5.c ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_persist.c ext/opcache/zend_persist _calc.c
| From: | Nikita Popov | Date: | Sat, 16 Aug 2014 20:31:13 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'php-src/master' into ast: Zend/zend.h Zend/zend_execute_API.c ext/opcache/Optimiz er/optimize_func_calls.c ext/opcache/Optimizer/pass1 _5.c ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_persist.c ext/opcache/zend_persist _calc.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80893@lists.php.net to get a copy of this message | ||
Commit: 904a83a137bd52e0b8da29df8b5500c88a9f6a9f
Author: Nikita Popov <nikic@php.net> Sat, 16 Aug 2014 22:31:13 +0200
Parents: ee3d28ed331593c532c812a11e2b3b18574bf176 d790eceb01009489358c3781c94ebea3b3400f67
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=904a83a137bd52e0b8da29df8b5500c88a9f6a9f
Log:
Merge remote-tracking branch 'php-src/master' into ast
Conflicts:
ext/opcache/Optimizer/optimize_func_calls.c
Changed paths:
MM Zend/zend.h
MM Zend/zend_execute_API.c
MM ext/opcache/Optimizer/optimize_func_calls.c
MM ext/opcache/Optimizer/pass1_5.c
MM ext/opcache/zend_accelerator_util_funcs.c
MM ext/opcache/zend_persist.c
MM ext/opcache/zend_persist_calc.c
Diff:
diff --cc ext/opcache/Optimizer/optimize_func_calls.c
index 9e3ed29,ead951a..853d4bd
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@@ -1,12 -20,6 +20,11 @@@
/* pass 4
* - optimize INIT_FCALL_BY_NAME to DO_FCALL
*/
- #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
+
+#define ZEND_OP2_IS_CONST_STRING(opline) \
+ (ZEND_OP2_TYPE(opline) == IS_CONST && \
+ Z_TYPE(op_array->literals[(opline)->op2.constant]) == IS_STRING)
+
typedef struct _optimizer_call_info {
zend_function *func;
zend_op *opline;
diff --cc ext/opcache/zend_accelerator_util_funcs.c
index 7c59d01,fc16fbe...0639e35
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@@ -323,49 -303,31 +303,47 @@@ static inline void zend_clone_zval(zva
}
}
- #if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC)
{
- int i;
- zend_ast *node;
-
- if (ast->kind == ZEND_CONST) {
- node = emalloc(sizeof(zend_ast) + sizeof(zval));
- node->kind = ZEND_CONST;
- node->children = 0;
- ZVAL_COPY_VALUE(&node->u.val, &ast->u.val);
- zend_clone_zval(&node->u.val, 0 TSRMLS_CC);
+ zend_uint i;
+
+ if (ast->kind == ZEND_AST_ZVAL) {
+ zend_ast_zval *copy = emalloc(sizeof(zend_ast_zval));
+ copy->kind = ZEND_AST_ZVAL;
+ copy->attr = ast->attr;
+ ZVAL_COPY_VALUE(©->val, zend_ast_get_zval(ast));
+ zend_clone_zval(©->val, 0 TSRMLS_CC);
+ return (zend_ast *) copy;
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_ast_list *copy = emalloc(
+ sizeof(zend_ast_list) + sizeof(zend_ast *) * (list->children - 1));
+ copy->kind = list->kind;
+ copy->attr = list->attr;
+ copy->children = list->children;
+ for (i = 0; i < list->children; i++) {
+ if (list->child[i]) {
+ copy->child[i] = zend_ast_clone(list->child[i] TSRMLS_CC);
+ } else {
+ copy->child[i] = NULL;
+ }
+ }
+ return (zend_ast *) copy;
} else {
- node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- node->kind = ast->kind;
- node->children = ast->children;
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- (&node->u.child)[i] = zend_ast_clone((&ast->u.child)[i] TSRMLS_CC);
+ zend_uint children = zend_ast_get_num_children(ast);
+ zend_ast *copy = emalloc(sizeof(zend_ast) + sizeof(zend_ast *) * (children - 1));
+ copy->kind = ast->kind;
+ copy->attr = ast->attr;
+ for (i = 0; i < children; i++) {
+ if (ast->child[i]) {
+ copy->child[i] = zend_ast_clone(ast->child[i] TSRMLS_CC);
} else {
- (&node->u.child)[i] = NULL;
+ copy->child[i] = NULL;
}
}
+ return copy;
}
- return node;
}
- #endif
static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
{
diff --cc ext/opcache/zend_persist.c
index d703235,e87a942..cbe7d4d
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@@ -149,32 -142,19 +142,31 @@@ static void zend_hash_persist_immutable
}
}
- #if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC)
{
- int i;
+ zend_uint i;
zend_ast *node;
- if (ast->kind == ZEND_CONST) {
- node = zend_accel_memdup(ast, sizeof(zend_ast));
- zend_persist_zval(&node->u.val TSRMLS_CC);
+ if (ast->kind == ZEND_AST_ZVAL) {
+ zend_ast_zval *copy = zend_accel_memdup(ast, sizeof(zend_ast_zval));
+ zend_persist_zval(©->val TSRMLS_CC);
+ node = (zend_ast *) copy;
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_ast_list *copy = zend_accel_memdup(ast,
+ sizeof(zend_ast_list) + sizeof(zend_ast *) * (list->children - 1));
+ for (i = 0; i < list->children; i++) {
+ if (copy->child[i]) {
+ copy->child[i] = zend_persist_ast(copy->child[i] TSRMLS_CC);
+ }
+ }
+ node = (zend_ast *) copy;
} else {
- node = zend_accel_memdup(ast, sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- for (i = 0; i < ast->children; i++) {
- if ((&node->u.child)[i]) {
- (&node->u.child)[i] = zend_persist_ast((&node->u.child)[i] TSRMLS_CC);
+ zend_uint children = zend_ast_get_num_children(ast);
+ node = zend_accel_memdup(ast, sizeof(zend_ast) + sizeof(zend_ast *) * (children - 1));
+ for (i = 0; i < children; i++) {
+ if (node->child[i]) {
+ node->child[i] = zend_persist_ast(node->child[i] TSRMLS_CC);
}
}
}
diff --cc ext/opcache/zend_persist_calc.c
index f26a6fe,08e9211..b1f90c9
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@@ -85,29 -81,19 +81,28 @@@ static uint zend_hash_persist_calc(Hash
RETURN_SIZE();
}
- #if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
static uint zend_persist_ast_calc(zend_ast *ast TSRMLS_DC)
{
- int i;
+ zend_uint i;
START_SIZE();
- if (ast->kind == ZEND_CONST) {
- ADD_SIZE(sizeof(zend_ast));
- ADD_SIZE(zend_persist_zval_calc(&ast->u.val TSRMLS_CC));
+ if (ast->kind == ZEND_AST_ZVAL) {
+ ADD_SIZE(sizeof(zend_ast_zval));
+ ADD_SIZE(zend_persist_zval_calc(zend_ast_get_zval(ast) TSRMLS_CC));
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ ADD_SIZE(sizeof(zend_ast_list) + sizeof(zend_ast *) * (list->children - 1));
+ for (i = 0; i < list->children; i++) {
+ if (list->child[i]) {
+ ADD_SIZE(zend_persist_ast_calc(list->child[i] TSRMLS_CC));
+ }
+ }
} else {
- ADD_SIZE(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- ADD_SIZE(zend_persist_ast_calc((&ast->u.child)[i] TSRMLS_CC));
+ zend_uint children = zend_ast_get_num_children(ast);
+ ADD_SIZE(sizeof(zend_ast) + sizeof(zend_ast *) * (children - 1));
+ for (i = 0; i < children; i++) {
+ if (ast->child[i]) {
+ ADD_SIZE(zend_persist_ast_calc(ast->child[i] TSRMLS_CC));
}
}
}