Skip to content

Commit

Permalink
Refactored API for constant array element propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Jun 15, 2017
1 parent 76db01d commit 8bb2970
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
6 changes: 1 addition & 5 deletions Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
14 changes: 6 additions & 8 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8bb2970

Please sign in to comment.