43
43
44
44
/* Virtual current working directory support */
45
45
#include "zend_virtual_cwd.h"
46
+ #include "zend_instrument.h"
46
47
47
48
#ifdef HAVE_GCC_GLOBAL_REGS
48
49
# if defined(__GNUC__ ) && ZEND_GCC_VERSION >= 4008 && defined(i386 )
@@ -137,6 +138,7 @@ ZEND_API const zend_internal_function zend_pass_function = {
137
138
0 , /* num_args */
138
139
0 , /* required_num_args */
139
140
NULL , /* arg_info */
141
+ NULL ,
140
142
ZEND_FN (pass ), /* handler */
141
143
NULL , /* module */
142
144
{NULL ,NULL ,NULL ,NULL } /* reserved */
@@ -3302,10 +3304,7 @@ static int zend_check_symbol(zval *pz)
3302
3304
#define CHECK_SYMBOL_TABLES ()
3303
3305
#endif
3304
3306
3305
- ZEND_API void execute_internal (zend_execute_data * execute_data , zval * return_value )
3306
- {
3307
- execute_data -> func -> internal_function .handler (execute_data , return_value );
3308
- }
3307
+ ZEND_API extern inline void execute_internal (zend_execute_data * execute_data , zval * return_value );
3309
3308
3310
3309
ZEND_API void zend_clean_and_cache_symbol_table (zend_array * symbol_table ) /* {{{ */
3311
3310
{
@@ -3503,6 +3502,9 @@ ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name) /*
3503
3502
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3504
3503
init_func_run_time_cache_i (& fbc -> op_array );
3505
3504
}
3505
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
3506
+ zend_instrument_install_handlers (fbc );
3507
+ }
3506
3508
return fbc ;
3507
3509
}
3508
3510
return NULL ;
@@ -3518,6 +3520,9 @@ ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name,
3518
3520
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3519
3521
init_func_run_time_cache_i (& fbc -> op_array );
3520
3522
}
3523
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
3524
+ zend_instrument_install_handlers (fbc );
3525
+ }
3521
3526
return fbc ;
3522
3527
}
3523
3528
return NULL ;
@@ -3550,6 +3555,12 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu
3550
3555
ZEND_MAP_PTR_SET (op_array -> run_time_cache , ptr );
3551
3556
memset (ptr , 0 , op_array -> cache_size );
3552
3557
}
3558
+ if (!ZEND_MAP_PTR (op_array -> instrument_cache )) {
3559
+ ZEND_MAP_PTR_INIT (op_array -> instrument_cache ,
3560
+ zend_arena_alloc (& CG (arena ), sizeof (void * )));
3561
+ ZEND_MAP_PTR_SET (op_array -> instrument_cache , NULL );
3562
+ zend_instrument_install_handlers ((zend_function * ) op_array );
3563
+ }
3553
3564
EX (run_time_cache ) = RUN_TIME_CACHE (op_array );
3554
3565
3555
3566
EG (current_execute_data ) = execute_data ;
@@ -3574,6 +3585,9 @@ ZEND_API void zend_init_func_execute_data(zend_execute_data *ex, zend_op_array *
3574
3585
if (!RUN_TIME_CACHE (op_array )) {
3575
3586
init_func_run_time_cache (op_array );
3576
3587
}
3588
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (op_array -> instrument_cache ))) {
3589
+ zend_instrument_install_handlers ((zend_function * ) op_array );
3590
+ }
3577
3591
i_init_func_execute_data (op_array , return_value , 1 EXECUTE_DATA_CC );
3578
3592
3579
3593
#if defined(ZEND_VM_IP_GLOBAL_REG ) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL ) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID ))
@@ -3925,6 +3939,9 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
3925
3939
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3926
3940
init_func_run_time_cache (& fbc -> op_array );
3927
3941
}
3942
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
3943
+ zend_instrument_install_handlers (fbc );
3944
+ }
3928
3945
} else {
3929
3946
if (ZSTR_VAL (function )[0 ] == '\\' ) {
3930
3947
lcname = zend_string_alloc (ZSTR_LEN (function ) - 1 , 0 );
@@ -3943,6 +3960,9 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
3943
3960
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3944
3961
init_func_run_time_cache (& fbc -> op_array );
3945
3962
}
3963
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
3964
+ zend_instrument_install_handlers (fbc );
3965
+ }
3946
3966
called_scope = NULL ;
3947
3967
}
3948
3968
@@ -3987,6 +4007,9 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zend_o
3987
4007
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3988
4008
init_func_run_time_cache (& fbc -> op_array );
3989
4009
}
4010
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
4011
+ zend_instrument_install_handlers (fbc );
4012
+ }
3990
4013
3991
4014
return zend_vm_stack_push_call_frame (call_info ,
3992
4015
fbc , num_args , object_or_called_scope );
@@ -4072,6 +4095,9 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
4072
4095
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
4073
4096
init_func_run_time_cache (& fbc -> op_array );
4074
4097
}
4098
+ if (UNEXPECTED (!ZEND_MAP_PTR_GET (fbc -> common .instrument_cache ))) {
4099
+ zend_instrument_install_handlers (fbc );
4100
+ }
4075
4101
4076
4102
return zend_vm_stack_push_call_frame (call_info ,
4077
4103
fbc , num_args , object_or_called_scope );
0 commit comments