PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - var/php_gcov/PHP_5_2/Zend - zend_execute.h
Test: PHP Code Coverage
Date: 2009-11-19 Instrumented lines: 65
Code covered: 70.8 % Executed lines: 46
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | Zend Engine                                                          |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 2.00 of the Zend license,     |
       8                 :    | that is bundled with this package in the file LICENSE, and is        | 
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.zend.com/license/2_00.txt.                                |
      11                 :    | If you did not receive a copy of the Zend license and are unable to  |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@zend.com so we can mail you a copy immediately.              |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16                 :    |          Zeev Suraski <zeev@zend.com>                                |
      17                 :    +----------------------------------------------------------------------+
      18                 : */
      19                 : 
      20                 : /* $Id: zend_execute.h 282105 2009-06-14 10:05:11Z pajoye $ */
      21                 : 
      22                 : #ifndef ZEND_EXECUTE_H
      23                 : #define ZEND_EXECUTE_H
      24                 : 
      25                 : #include "zend_compile.h"
      26                 : #include "zend_hash.h"
      27                 : #include "zend_operators.h"
      28                 : #include "zend_variables.h"
      29                 : 
      30                 : typedef union _temp_variable {
      31                 :         zval tmp_var;
      32                 :         struct {
      33                 :                 zval **ptr_ptr;
      34                 :                 zval *ptr;
      35                 :                 zend_bool fcall_returned_reference;
      36                 :         } var;
      37                 :         struct {
      38                 :                 zval **ptr_ptr;
      39                 :                 zval *ptr;
      40                 :                 zend_bool fcall_returned_reference;
      41                 :                 zval *str;
      42                 :                 zend_uint offset;
      43                 :         } str_offset;
      44                 :         struct {
      45                 :                 zval **ptr_ptr;
      46                 :                 zval *ptr;
      47                 :                 zend_bool fcall_returned_reference;
      48                 :                 HashPointer fe_pos;
      49                 :         } fe;
      50                 :         zend_class_entry *class_entry;
      51                 : } temp_variable;
      52                 : 
      53                 : 
      54                 : BEGIN_EXTERN_C()
      55                 : ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
      56                 : ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
      57                 : 
      58                 : void init_executor(TSRMLS_D);
      59                 : void shutdown_executor(TSRMLS_D);
      60                 : void shutdown_destructors(TSRMLS_D);
      61                 : ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
      62                 : ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
      63                 : ZEND_API int zend_is_true(zval *op);
      64                 : #define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
      65                 : static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
      66        27342027 : {
      67                 :         TSRMLS_FETCH();
      68                 : 
      69        27342027 :         if (p!=EG(uninitialized_zval_ptr)) {
      70        27342027 :                 FREE_ZVAL_REL(p);
      71                 :         }
      72        27342027 : }
      73                 : ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
      74                 : ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
      75                 : ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
      76                 : ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
      77                 : 
      78                 : static inline int i_zend_is_true(zval *op)
      79        19578771 : {
      80                 :         int result;
      81                 : 
      82        19578771 :         switch (Z_TYPE_P(op)) {
      83                 :                 case IS_NULL:
      84           26796 :                         result = 0;
      85           26796 :                         break;
      86                 :                 case IS_LONG:
      87                 :                 case IS_BOOL:
      88                 :                 case IS_RESOURCE:
      89        19433515 :                         result = (Z_LVAL_P(op)?1:0);
      90        19433515 :                         break;
      91                 :                 case IS_DOUBLE:
      92              19 :                         result = (Z_DVAL_P(op) ? 1 : 0);
      93              19 :                         break;
      94                 :                 case IS_STRING:
      95           25184 :                         if (Z_STRLEN_P(op) == 0
      96                 :                                 || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
      97             301 :                                 result = 0;
      98                 :                         } else {
      99           24582 :                                 result = 1;
     100                 :                         }
     101           24883 :                         break;
     102                 :                 case IS_ARRAY:
     103           93369 :                         result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
     104           93369 :                         break;
     105                 :                 case IS_OBJECT:
     106             189 :                         if(IS_ZEND_STD_OBJECT(*op)) {
     107                 :                                 TSRMLS_FETCH();
     108                 : 
     109             189 :                                 if (Z_OBJ_HT_P(op)->cast_object) {
     110                 :                                         zval tmp;
     111             189 :                                         if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
     112             189 :                                                 result = Z_LVAL(tmp);
     113             189 :                                                 break;
     114                 :                                         }
     115               0 :                                 } else if (Z_OBJ_HT_P(op)->get) {
     116               0 :                                         zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
     117               0 :                                         if(Z_TYPE_P(tmp) != IS_OBJECT) {
     118                 :                                                 /* for safety - avoid loop */
     119               0 :                                                 convert_to_boolean(tmp);
     120               0 :                                                 result = Z_LVAL_P(tmp);
     121               0 :                                                 zval_ptr_dtor(&tmp);
     122               0 :                                                 break;
     123                 :                                         }
     124                 :                                 }
     125                 :                         
     126               0 :                                 if(EG(ze1_compatibility_mode)) {
     127               0 :                                         result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
     128                 :                                 } else {
     129               0 :                                         result = 1;
     130                 :                                 }
     131                 :                         } else {
     132               0 :                                 result = 1;
     133                 :                         }
     134               0 :                         break;
     135                 :                 default:
     136               0 :                         result = 0;
     137                 :                         break;
     138                 :         }
     139        19578771 :         return result;
     140                 : }
     141                 : 
     142                 : ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
     143                 : ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC);
     144                 : 
     145                 : /* dedicated Zend executor functions - do not use! */
     146                 : static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
     147        13400409 : {
     148        13400409 :         void **p = EG(argument_stack).top_element-2;
     149        13400409 :         int delete_count = (int)(zend_uintptr_t) *p;
     150                 : 
     151        13400409 :         EG(argument_stack).top -= (delete_count+2);
     152        50959599 :         while (--delete_count>=0) {
     153        24158781 :                 zval *q = *(zval **)(--p);
     154        24158781 :                 *p = NULL;
     155        24158781 :                 zval_ptr_dtor(&q);
     156                 :         }
     157        13400409 :         EG(argument_stack).top_element = p;
     158        13400409 : }
     159                 : 
     160                 : static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
     161         4050864 : {
     162         4050864 :         void **p = EG(argument_stack).top_element-2;
     163         4050864 :         int arg_count = (int)(zend_uintptr_t) *p;
     164                 : 
     165         4050864 :         if (requested_arg>arg_count) {
     166           29543 :                 return FAILURE;
     167                 :         }
     168         4021321 :         *data = (p-arg_count+requested_arg-1);
     169         4021321 :         return SUCCESS;
     170                 : }
     171                 : 
     172                 : static inline void zend_arg_types_stack_2_pop(zend_ptr_stack *stack, zval **object, zend_function **fbc)
     173        13129173 : {
     174                 :         void *a, *b;
     175                 : 
     176        13129173 :         zend_ptr_stack_2_pop(stack, &a, &b);
     177                 : 
     178        13129173 :         *object =  (zval *) a;
     179        13129173 :         *fbc = (zend_function *) b;
     180        13129173 : }
     181                 : 
     182                 : static inline void zend_arg_types_stack_3_pop(zend_ptr_stack *stack, zend_class_entry **called_scope, zval **object, zend_function **fbc)
     183               0 : {
     184                 :         void *a, *b, *c;
     185                 : 
     186               0 :         zend_ptr_stack_3_pop(stack, &a, &b, &c);
     187                 : 
     188               0 :         *called_scope = (zend_class_entry *) a;
     189               0 :         *object = (zval *) b;
     190               0 :         *fbc = (zend_function *) c;
     191               0 : }
     192                 : 
     193                 : void execute_new_code(TSRMLS_D);
     194                 : 
     195                 : 
     196                 : /* services */
     197                 : ZEND_API char *get_active_class_name(char **space TSRMLS_DC);
     198                 : ZEND_API char *get_active_function_name(TSRMLS_D);
     199                 : ZEND_API char *zend_get_executed_filename(TSRMLS_D);
     200                 : ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
     201                 : ZEND_API zend_bool zend_is_executing(TSRMLS_D);
     202                 : 
     203                 : ZEND_API void zend_set_timeout(long seconds);
     204                 : ZEND_API void zend_unset_timeout(TSRMLS_D);
     205                 : ZEND_API void zend_timeout(int dummy);
     206                 : ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
     207                 : void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
     208                 : 
     209                 : #ifdef ZEND_WIN32
     210                 : void zend_init_timeout_thread(void);
     211                 : void zend_shutdown_timeout_thread(void);
     212                 : #define WM_REGISTER_ZEND_TIMEOUT                (WM_USER+1)
     213                 : #define WM_UNREGISTER_ZEND_TIMEOUT              (WM_USER+2)
     214                 : #endif
     215                 : 
     216                 : #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
     217                 : #define zendi_zval_dtor(p) zval_dtor(&(p))
     218                 : 
     219                 : #define active_opline (*EG(opline_ptr))
     220                 : 
     221                 : /* The following tries to resolve the classname of a zval of type object.
     222                 :  * Since it is slow it should be only used in error messages.
     223                 :  */
     224                 : #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
     225                 : 
     226                 : ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var);
     227                 : 
     228                 : #define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */
     229                 : #define ZEND_USER_OPCODE_RETURN     1 /* exit from executor (return from function) */
     230                 : #define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */
     231                 : 
     232                 : #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
     233                 : 
     234                 : ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler);
     235                 : ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
     236                 : 
     237                 : /* former zend_execute_locks.h */
     238                 : typedef struct _zend_free_op {
     239                 :         zval* var;
     240                 : /*      int   is_var; */
     241                 : } zend_free_op;
     242                 : 
     243                 : ZEND_API zval *zend_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
     244                 : ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
     245                 : 
     246                 : ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
     247                 : 
     248                 : END_EXTERN_C()
     249                 : 
     250                 : #endif /* ZEND_EXECUTE_H */
     251                 : 
     252                 : /*
     253                 :  * Local variables:
     254                 :  * tab-width: 4
     255                 :  * c-basic-offset: 4
     256                 :  * indent-tabs-mode: t
     257                 :  * End:
     258                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Thu, 19 Nov 2009 08:20:04 +0000 (5 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.