com php-src: Refactored API for constant array element propagation: Zend/zend_ast.c Zend/zend_execute.c Zend/zend_exe cute.h
| From: | Dmitry Stogov | Date: | Thu, 15 Jun 2017 19:50:04 +0000 |
| Subject: | com php-src: Refactored API for constant array element propagation: Zend/zend_ast.c Zend/zend_execute.c Zend/zend_exe cute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98079@lists.php.net to get a copy of this message | ||
Commit: 8bb29704ea34749d1560f424c4726f4162d1adee
Author: Dmitry Stogov <dmitry@zend.com> Thu, 15 Jun 2017 22:50:04 +0300
Parents: 76db01d9ff213aec3f5f0e532c67c6ea8c4b5751
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8bb29704ea34749d1560f424c4726f4162d1adee
Log:
Refactored API for constant array element propagation
Changed paths:
M Zend/zend_ast.c
M Zend/zend_execute.c
M Zend/zend_execute.h
Diff:
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index a4d32d8..c19a47f 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -432,11 +432,7 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry
*sc
} else {
zval tmp;
- if (ast->attr == ZEND_DIM_IS) {
- zend_fetch_dimension_by_zval_is(&tmp, &op1, &op2, IS_CONST);
- } else {
- zend_fetch_dimension_by_zval(&tmp, &op1, &op2);
- }
+ zend_fetch_dimension_const(&tmp, &op1, &op2, (ast->attr == ZEND_DIM_IS) ?
BP_VAR_IS : BP_VAR_R);
if (UNEXPECTED(Z_ISREF(tmp))) {
ZVAL_DUP(result, Z_REFVAL(tmp));
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index a1cfcd3..1174c13 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1827,17 +1827,15 @@ static zend_never_inline void zend_fetch_dimension_address_read_LIST(zval
*resul
zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, BP_VAR_R, 0, 0);
}
-ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim)
+ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type)
{
- zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR);
-}
-
-ZEND_API void zend_fetch_dimension_by_zval_is(zval *result, zval *container, zval *dim, int
dim_type)
-{
- zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0);
+ if (type == BP_VAR_IS) {
+ zend_fetch_dimension_address_read_IS(result, container, dim, IS_CONST);
+ } else {
+ zend_fetch_dimension_address_read_R(result, container, dim, IS_CONST);
+ }
}
-
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t
container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type)
{
if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 5f0caf6..5938a97 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -298,8 +298,7 @@ ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_t
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int
fetch_type);
void zend_verify_abstract_class(zend_class_entry *ce);
-ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim);
-ZEND_API void zend_fetch_dimension_by_zval_is(zval *result, zval *container, zval *dim, int
dim_type);
+ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type);
ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t
var);