Good catch! Kill them all if you can ;-)
On Sep 14, 2013 2:05 PM, "Nikita Popov" <ni...@php.net> wrote:

> Commit:    bdfa03d79df529b555e2d25da288b50647e7c537
> Author:    Nikita Popov <ni...@php.net>         Sat, 14 Sep 2013 14:40:48
> +0200
> Parents:   8748e146b98fb79e66e3be40b211005e36031d64
> Branches:  master
>
> Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=bdfa03d79df529b555e2d25da288b50647e7c537
>
> Log:
> Save a TSRMLS_FETCH() for zval_ptr_dtor in executor
>
> This gives me about 9% improvement on Zend/bench.php for a zts build.
>
> Changed paths:
>   M  Zend/zend_execute.c
>   M  Zend/zend_execute.h
>   M  Zend/zend_execute_API.c
>   M  Zend/zend_generators.c
>   M  Zend/zend_vm_def.h
>   M  Zend/zend_vm_execute.h
>
>
> Diff:
> diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
> index 63ecbe4..c79a551 100644
> --- a/Zend/zend_execute.c
> +++ b/Zend/zend_execute.c
> @@ -94,7 +94,7 @@ static zend_always_inline void
> zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
>  }
>
>  #undef zval_ptr_dtor
> -#define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv)  ZEND_FILE_LINE_CC)
> +#define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv) ZEND_FILE_LINE_CC
> TSRMLS_CC)
>
>  #define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1 TSRMLS_CC)
>  #define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u TSRMLS_CC)
> @@ -1500,7 +1500,7 @@ void zend_clean_and_cache_symbol_table(HashTable
> *symbol_table TSRMLS_DC) /* {{{
>  }
>  /* }}} */
>
> -static zend_always_inline void
> i_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
> +static zend_always_inline void
> i_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{
> */
>  {
>         zval ***cv = EX_CV_NUM(execute_data, 0);
>         zval ***end = cv + EX(op_array)->last_var;
> @@ -1513,9 +1513,9 @@ static zend_always_inline void
> i_free_compiled_variables(zend_execute_data *exec
>  }
>  /* }}} */
>
> -void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{
> */
> +void zend_free_compiled_variables(zend_execute_data *execute_data
> TSRMLS_DC) /* {{{ */
>  {
> -       i_free_compiled_variables(execute_data);
> +       i_free_compiled_variables(execute_data TSRMLS_CC);
>  }
>  /* }}} */
>
> diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
> index ff07587..b68a82e 100644
> --- a/Zend/zend_execute.h
> +++ b/Zend/zend_execute.h
> @@ -71,18 +71,14 @@ ZEND_API int zend_eval_stringl_ex(char *str, int
> str_len, zval *retval_ptr, char
>  ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info
> *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry
> **pce TSRMLS_DC);
>  ZEND_API int zend_verify_arg_error(int error_type, const zend_function
> *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const
> char *given_msg, const char *given_kind TSRMLS_DC);
>
> -static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr
> ZEND_FILE_LINE_DC)
> +static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr
> ZEND_FILE_LINE_DC TSRMLS_DC)
>  {
>         if (!Z_DELREF_P(zval_ptr)) {
> -               TSRMLS_FETCH();
> -
>                 ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
>                 GC_REMOVE_ZVAL_FROM_BUFFER(zval_ptr);
>                 zval_dtor(zval_ptr);
>                 efree_rel(zval_ptr);
>         } else {
> -               TSRMLS_FETCH();
> -
>                 if (Z_REFCOUNT_P(zval_ptr) == 1) {
>                         Z_UNSET_ISREF_P(zval_ptr);
>                 }
> @@ -295,7 +291,7 @@ static zend_always_inline void
> zend_vm_stack_clear_multiple(int nested TSRMLS_DC
>         while (p != end) {
>                 zval *q = (zval *) *(--p);
>                 *p = NULL;
> -               i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
> +               i_zval_ptr_dtor(q ZEND_FILE_LINE_CC TSRMLS_CC);
>         }
>         if (nested) {
>                 EG(argument_stack)->top = p;
> @@ -394,7 +390,7 @@ ZEND_API zval **zend_get_zval_ptr_ptr(int op_type,
> const znode_op *node, const z
>  ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
>
>  void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC);
> -void zend_free_compiled_variables(zend_execute_data *execute_data);
> +void zend_free_compiled_variables(zend_execute_data *execute_data
> TSRMLS_DC);
>
>  #define CACHED_PTR(num) \
>         EG(active_op_array)->run_time_cache[(num)]
> diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
> index d65308f..779e6d8 100644
> --- a/Zend/zend_execute_API.c
> +++ b/Zend/zend_execute_API.c
> @@ -423,7 +423,8 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{
> */
>
>  ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
>  {
> -       i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC);
> +       TSRMLS_FETCH();
> +       i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
>  }
>  /* }}} */
>
> diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
> index c6b211a..c55dc67 100644
> --- a/Zend/zend_generators.c
> +++ b/Zend/zend_generators.c
> @@ -46,7 +46,7 @@ ZEND_API void zend_generator_close(zend_generator
> *generator, zend_bool finished
>                 zend_op_array *op_array = execute_data->op_array;
>
>                 if (!execute_data->symbol_table) {
> -                       zend_free_compiled_variables(execute_data);
> +                       zend_free_compiled_variables(execute_data
> TSRMLS_CC);
>                 } else {
>
> zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
>                 }
> diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
> index d95a3dc..4621b47 100644
> --- a/Zend/zend_vm_def.h
> +++ b/Zend/zend_vm_def.h
> @@ -1833,7 +1833,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
>         EG(current_execute_data) = EX(prev_execute_data);
>         EG(opline_ptr) = NULL;
>         if (!EG(active_symbol_table)) {
> -               i_free_compiled_variables(execute_data);
> +               i_free_compiled_variables(execute_data TSRMLS_CC);
>         }
>
>         zend_vm_stack_free((char*)execute_data -
> (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC);
> diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
> index ac62b29..677cabe 100644
> --- a/Zend/zend_vm_execute.h
> +++ b/Zend/zend_vm_execute.h
> @@ -396,7 +396,7 @@ static int ZEND_FASTCALL
> zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
>         EG(current_execute_data) = EX(prev_execute_data);
>         EG(opline_ptr) = NULL;
>         if (!EG(active_symbol_table)) {
> -               i_free_compiled_variables(execute_data);
> +               i_free_compiled_variables(execute_data TSRMLS_CC);
>         }
>
>         zend_vm_stack_free((char*)execute_data -
> (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC);
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to