Browse Source

Get rid of ELS_*(), and use TSRMLS_*() instead.

This patch is *bound* to break some files, as I must have had typos somewhere.
If you use any uncommon extension, please try to build it...
experimental/zts_stdc_scanners
Zeev Suraski 25 years ago
parent
commit
2c254ba762
  1. 78
      Zend/zend.c
  2. 4
      Zend/zend.h
  3. 22
      Zend/zend_API.c
  4. 2
      Zend/zend_API.h
  5. 4
      Zend/zend_builtin_functions.c
  6. 4
      Zend/zend_compile.c
  7. 10
      Zend/zend_compile.h
  8. 38
      Zend/zend_constants.c
  9. 32
      Zend/zend_constants.h
  10. 148
      Zend/zend_execute.c
  11. 22
      Zend/zend_execute.h
  12. 48
      Zend/zend_execute_API.c
  13. 6
      Zend/zend_execute_locks.h
  14. 12
      Zend/zend_globals_macros.h
  15. 26
      Zend/zend_ini.c
  16. 12
      Zend/zend_ini.h
  17. 4
      Zend/zend_language_parser.y
  18. 2
      Zend/zend_language_scanner.l
  19. 18
      Zend/zend_list.c
  20. 8
      Zend/zend_list.h
  21. 4
      Zend/zend_modules.h
  22. 2
      Zend/zend_operators.c
  23. 4
      Zend/zend_variables.c

78
Zend/zend.c

@ -261,7 +261,7 @@ static void zend_set_default_compile_time_values(CLS_D)
#ifdef ZTS
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
{
zend_function tmp_func;
zend_class_entry tmp_class;
@ -282,7 +282,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
}
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
{
if (compiler_globals->function_table != global_function_table) {
zend_hash_destroy(compiler_globals->function_table);
@ -295,28 +295,28 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
}
static void executor_globals_ctor(zend_executor_globals *executor_globals)
static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
{
if (global_constants_table) {
zend_startup_constants(ELS_C);
zend_copy_constants(executor_globals->zend_constants, global_constants_table);
zend_startup_constants(TSRMLS_C);
zend_copy_constants(EG(zend_constants), global_constants_table);
}
zend_init_rsrc_plist(ELS_C);
zend_init_rsrc_plist(TSRMLS_C);
EG(lambda_count)=0;
EG(user_error_handler) = NULL;
EG(in_execution) = 0;
}
static void executor_globals_dtor(zend_executor_globals *executor_globals)
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
{
zend_shutdown_constants(ELS_C);
zend_destroy_rsrc_plist(ELS_C);
zend_ini_shutdown(ELS_C);
zend_shutdown_constants(TSRMLS_C);
zend_destroy_rsrc_plist(TSRMLS_C);
zend_ini_shutdown(TSRMLS_C);
}
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
{
start_memory_manager(ALS_C);
}
@ -331,10 +331,10 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
#ifdef ZTS
static void zend_new_thread_end_handler(THREAD_T thread_id)
{
ELS_FETCH();
TSRMLS_FETCH();
zend_copy_ini_directives(ELS_C);
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP ELS_CC);
zend_copy_ini_directives(TSRMLS_C);
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
#endif
@ -344,8 +344,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifdef ZTS
zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
void ***tsrm_ls;
alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL);
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL);
#else
start_memory_manager(ALS_C);
#endif
@ -393,31 +394,32 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifdef ZTS
global_constants_table = NULL;
compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals), (void (*)(void *)) compiler_globals_ctor, (void (*)(void *)) compiler_globals_dtor);
executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals), (void (*)(void *)) executor_globals_ctor, (void (*)(void *)) executor_globals_dtor);
ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
compiler_globals_dtor(compiler_globals);
tsrm_ls = ts_resource_ex(0, NULL);
compiler_globals_dtor(compiler_globals, tsrm_ls);
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
zend_startup_constants(executor_globals);
zend_startup_constants(tsrm_ls);
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
#else
zend_startup_constants();
zend_set_default_compile_time_values(CLS_C);
EG(user_error_handler) = NULL;
#endif
zend_register_standard_constants(ELS_C);
zend_register_standard_constants(TSRMLS_C);
#ifndef ZTS
zend_init_rsrc_plist(ELS_C);
zend_init_rsrc_plist(TSRMLS_C);
#endif
if (start_builtin_functions) {
zend_startup_builtin_functions();
}
zend_ini_startup(ELS_C);
zend_ini_startup(TSRMLS_C);
#ifdef ZTS
tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
@ -467,7 +469,7 @@ BEGIN_EXTERN_C()
ZEND_API void _zend_bailout(char *filename, uint lineno)
{
CLS_FETCH();
ELS_FETCH();
TSRMLS_FETCH();
if (!EG(bailout_set)) {
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
@ -508,11 +510,11 @@ ZEND_API char *get_zend_version()
}
void zend_activate(CLS_D ELS_DC)
void zend_activate(CLS_D TSRMLS_DC)
{
EG(bailout_set) = 0;
init_compiler(CLS_C ELS_CC);
init_executor(CLS_C ELS_CC);
init_compiler(CLS_C TSRMLS_CC);
init_executor(CLS_C TSRMLS_CC);
startup_scanner(CLS_C);
}
@ -524,7 +526,7 @@ void zend_activate_modules()
void zend_deactivate_modules()
{
ELS_FETCH();
TSRMLS_FETCH();
EG(opline_ptr) = NULL; /* we're no longer executing anything */
zend_try {
@ -532,7 +534,7 @@ void zend_deactivate_modules()
} zend_end_try();
}
void zend_deactivate(CLS_D ELS_DC)
void zend_deactivate(CLS_D TSRMLS_DC)
{
/* we're no longer executing anything */
EG(opline_ptr) = NULL;
@ -543,14 +545,14 @@ void zend_deactivate(CLS_D ELS_DC)
} zend_end_try();
/* shutdown_executor() takes care of its own bailout handling */
shutdown_executor(ELS_C);
shutdown_executor(TSRMLS_C);
zend_try {
shutdown_compiler(CLS_C);
} zend_end_try();
zend_try {
zend_ini_deactivate(ELS_C);
zend_ini_deactivate(TSRMLS_C);
} zend_end_try();
}
@ -586,7 +588,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
char *error_filename;
uint error_lineno;
zval *orig_user_error_handler;
ELS_FETCH();
TSRMLS_FETCH();
CLS_FETCH();
/* Obtain relevant filename and lineno */
@ -609,8 +611,8 @@ ZEND_API void zend_error(int type, const char *format, ...)
error_filename = zend_get_compiled_filename(CLS_C);
error_lineno = zend_get_compiled_lineno(CLS_C);
} else if (zend_is_executing()) {
error_filename = zend_get_executed_filename(ELS_C);
error_lineno = zend_get_executed_lineno(ELS_C);
error_filename = zend_get_executed_filename(TSRMLS_C);
error_lineno = zend_get_executed_lineno(TSRMLS_C);
} else {
error_filename = NULL;
error_lineno = 0;
@ -740,7 +742,7 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ..
}
ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...)
ZEND_API int zend_execute_scripts(int type CLS_DC TSRMLS_DC, int file_count, ...)
{
va_list files;
int i;
@ -756,7 +758,7 @@ ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...)
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE CLS_CC);
zend_destroy_file_handle(file_handle CLS_CC);
if (EG(active_op_array)) {
zend_execute(EG(active_op_array) ELS_CC);
zend_execute(EG(active_op_array) TSRMLS_CC);
zval_ptr_dtor(EG(return_value_ptr_ptr));
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
EG(global_return_value_ptr) = NULL;
@ -782,14 +784,14 @@ ZEND_API char *zend_make_compiled_string_description(char *name)
int cur_lineno;
char *compiled_string_description;
CLS_FETCH();
ELS_FETCH();
TSRMLS_FETCH();
if (zend_is_compiling()) {
cur_filename = zend_get_compiled_filename(CLS_C);
cur_lineno = zend_get_compiled_lineno(CLS_C);
} else if (zend_is_executing()) {
cur_filename = zend_get_executed_filename(ELS_C);
cur_lineno = zend_get_executed_lineno(ELS_C);
cur_filename = zend_get_executed_filename(TSRMLS_C);
cur_lineno = zend_get_executed_lineno(TSRMLS_C);
} else {
cur_filename = "Unknown";
cur_lineno = 0;

4
Zend/zend.h

@ -161,8 +161,8 @@ typedef unsigned short zend_ushort;
#include "zend_hash.h"
#include "zend_llist.h"
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used ELS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used ELS_CC
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
/*
* zval

22
Zend/zend_API.c

@ -40,7 +40,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...)
int arg_count;
va_list ptr;
zval **param, *param_ptr;
ELS_FETCH();
TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@ -79,7 +79,7 @@ ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_
void **p;
int arg_count;
zval *param_ptr;
ELS_FETCH();
TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@ -119,7 +119,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...)
int arg_count;
va_list ptr;
zval ***param;
ELS_FETCH();
TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@ -143,7 +143,7 @@ ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_arra
{
void **p;
int arg_count;
ELS_FETCH();
TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@ -165,7 +165,7 @@ ZEND_API int ParameterPassedByReference(int ht, uint n)
void **p;
ulong arg_count;
zval *arg;
ELS_FETCH();
TSRMLS_FETCH();
p = EG(argument_stack).elements+EG(argument_stack).top-2;
arg_count = (ulong) *p;
@ -479,7 +479,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
void **p;
int arg_count;
int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
ELS_FETCH();
TSRMLS_FETCH();
for (spec_walk = type_spec; *spec_walk; spec_walk++) {
c = *spec_walk;
@ -1010,9 +1010,9 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
if (module) {
module->module_number = zend_next_free_module();
if (module->module_startup_func) {
ELS_FETCH();
TSRMLS_FETCH();
if (module->module_startup_func(MODULE_PERSISTENT, module->module_number ELS_CC)==FAILURE) {
if (module->module_startup_func(MODULE_PERSISTENT, module->module_number TSRMLS_CC)==FAILURE) {
zend_error(E_CORE_ERROR,"Unable to start %s module",module->name);
return FAILURE;
}
@ -1148,12 +1148,12 @@ void module_destructor(zend_module_entry *module)
int module_registry_request_startup(zend_module_entry *module)
{
if (module->request_startup_func) {
ELS_FETCH();
TSRMLS_FETCH();
#if 0
zend_printf("%s: Request startup\n",module->name);
#endif
if (module->request_startup_func(module->type, module->module_number ELS_CC)==FAILURE) {
if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
exit(1);
}
@ -1305,7 +1305,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
{
char *lcname;
int retval = 0;
ELS_FETCH();
TSRMLS_FETCH();
switch (Z_TYPE_P(callable)) {
case IS_STRING:

2
Zend/zend_API.h

@ -68,7 +68,7 @@
#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
extern ts_rsrc_id module_name##_globals_id;
#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
module_name##_globals_id = ts_allocate_id(sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
#else

4
Zend/zend_builtin_functions.c

@ -426,7 +426,7 @@ ZEND_FUNCTION(define)
c.flags = case_sensitive; /* non persistent */
c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
c.name_len = (*var)->value.str.len+1;
if (zend_register_constant(&c ELS_CC) == SUCCESS) {
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@ -945,7 +945,7 @@ ZEND_FUNCTION(create_function)
sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code));
eval_name = zend_make_compiled_string_description("runtime-created function");
retval = zend_eval_string(eval_code, NULL, eval_name CLS_CC ELS_CC);
retval = zend_eval_string(eval_code, NULL, eval_name CLS_CC TSRMLS_CC);
efree(eval_code);
efree(eval_name);

4
Zend/zend_compile.c

@ -84,10 +84,10 @@ void zend_init_compiler_data_structures(CLS_D)
}
void init_compiler(CLS_D ELS_DC)
void init_compiler(CLS_D TSRMLS_DC)
{
zend_init_compiler_data_structures(CLS_C);
zend_init_rsrc_list(ELS_C);
zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
CG(unclean_shutdown) = 0;

10
Zend/zend_compile.h

@ -196,14 +196,14 @@ typedef struct _zend_file_handle {
BEGIN_EXTERN_C()
void init_compiler(CLS_D ELS_DC);
void init_compiler(CLS_D TSRMLS_DC);
void shutdown_compiler(CLS_D);
void zend_init_compiler_data_structures(CLS_D);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type CLS_DC);
void zend_activate(CLS_D ELS_DC);
void zend_deactivate(CLS_D ELS_DC);
void zend_activate(CLS_D TSRMLS_DC);
void zend_deactivate(CLS_D TSRMLS_DC);
void zend_activate_modules(void);
void zend_deactivate_modules(void);
@ -365,8 +365,8 @@ ZEND_API void function_add_ref(zend_function *function);
/* helper functions in zend_language_scanner.l */
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type CLS_DC);
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename CLS_DC);
ZEND_API zend_op_array *compile_filename(int type, zval *filename CLS_DC ELS_DC);
ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...);
ZEND_API zend_op_array *compile_filename(int type, zval *filename CLS_DC TSRMLS_DC);
ZEND_API int zend_execute_scripts(int type CLS_DC TSRMLS_DC, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle CLS_DC);
ZEND_API void init_op_array(zend_op_array *op_array, int type, int initial_ops_size CLS_DC);
ZEND_API void destroy_op_array(zend_op_array *op_array);

38
Zend/zend_constants.c

@ -73,13 +73,13 @@ static int clean_module_constant(zend_constant *c, int *module_number)
void clean_module_constants(int module_number)
{
ELS_FETCH();
TSRMLS_FETCH();
zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number);
}
int zend_startup_constants(ELS_D)
int zend_startup_constants(TSRMLS_D)
{
#ifdef ZEND_WIN32
DWORD dwBuild=0;
@ -98,7 +98,7 @@ int zend_startup_constants(ELS_D)
void zend_register_standard_constants(ELS_D)
void zend_register_standard_constants(TSRMLS_D)
{
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
@ -126,29 +126,29 @@ void zend_register_standard_constants(ELS_D)
c.name_len = sizeof("TRUE");
c.value.value.lval = 1;
c.value.type = IS_BOOL;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
c.name = zend_strndup(ZEND_STRL("FALSE"));
c.name_len = sizeof("FALSE");
c.value.value.lval = 0;
c.value.type = IS_BOOL;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
c.name_len = sizeof("ZEND_THREAD_SAFE");
c.value.value.lval = ZTS_V;
c.value.type = IS_BOOL;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
c.name = zend_strndup(ZEND_STRL("NULL"));
c.name_len = sizeof("NULL");
c.value.type = IS_NULL;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
}
}
int zend_shutdown_constants(ELS_D)
int zend_shutdown_constants(TSRMLS_D)
{
zend_hash_destroy(EG(zend_constants));
free(EG(zend_constants));
@ -158,13 +158,13 @@ int zend_shutdown_constants(ELS_D)
void clean_non_persistent_constants(void)
{
ELS_FETCH();
TSRMLS_FETCH();
zend_hash_apply(EG(zend_constants), (int (*)(void *)) clean_non_persistent_constant);
}
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC)
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
{
zend_constant c;
@ -174,11 +174,11 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval,
c.name = zend_strndup(name,name_len);
c.name_len = name_len;
c.module_number = module_number;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
}
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC)
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
{
zend_constant c;
@ -188,11 +188,11 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv
c.name = zend_strndup(name,name_len);
c.name_len = name_len;
c.module_number = module_number;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
}
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC)
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
{
zend_constant c;
@ -203,13 +203,13 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st
c.name = zend_strndup(name,name_len);
c.name_len = name_len;
c.module_number = module_number;
zend_register_constant(&c ELS_CC);
zend_register_constant(&c TSRMLS_CC);
}
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC)
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
{
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number ELS_CC);
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
}
@ -218,7 +218,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result)
zend_constant *c;
char *lookup_name = estrndup(name,name_len);
int retval;
ELS_FETCH();
TSRMLS_FETCH();
zend_str_tolower(lookup_name, name_len);
@ -239,7 +239,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result)
}
ZEND_API int zend_register_constant(zend_constant *c ELS_DC)
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
{
char *lowercase_name = zend_strndup(c->name, c->name_len);
int ret = SUCCESS;

32
Zend/zend_constants.h

@ -34,28 +34,28 @@ typedef struct _zend_constant {
int module_number;
} zend_constant;
#define REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),module_number ELS_CC)
#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number ELS_CC)
#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number ELS_CC)
#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number ELS_CC)
#define REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),module_number TSRMLS_CC)
#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number TSRMLS_CC)
#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number TSRMLS_CC)
#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number TSRMLS_CC)
#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0 ELS_CC)
#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0 ELS_CC)
#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0 ELS_CC)
#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 ELS_CC)
#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0 TSRMLS_CC)
#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0 TSRMLS_CC)
#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0 TSRMLS_CC)
#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 TSRMLS_CC)
void clean_module_constants(int module_number);
void free_zend_constant(zend_constant *c);
int zend_startup_constants(ELS_D);
int zend_shutdown_constants(ELS_D);
void zend_register_standard_constants(ELS_D);
int zend_startup_constants(TSRMLS_D);
int zend_shutdown_constants(TSRMLS_D);
void zend_register_standard_constants(TSRMLS_D);
void clean_non_persistent_constants(void);
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result);
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC);
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC);
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC);
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC);
ZEND_API int zend_register_constant(zend_constant *c ELS_DC);
ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
void zend_copy_constants(HashTable *target, HashTable *sourc);
void copy_zend_constant(zend_constant *c);

148
Zend/zend_execute.c

@ -32,8 +32,8 @@
#include "zend_fast_cache.h"
#include "zend_execute_locks.h"
#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free ELS_CC)
#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts ELS_CC)
#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC)
#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC)
#define get_incdec_op(op, opcode) \
switch (opcode) { \
@ -54,20 +54,20 @@
/* Prototypes */
static zval get_overloaded_property(temp_variable *T ELS_DC);
static void set_overloaded_property(temp_variable *T, zval *value ELS_DC);
static void call_overloaded_function(temp_variable *T, int arg_count, zval *return_value ELS_DC);
static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC);
static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC);
static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC);
static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts ELS_DC);
static zval get_overloaded_property(temp_variable *T TSRMLS_DC);
static void set_overloaded_property(temp_variable *T, zval *value TSRMLS_DC);
static void call_overloaded_function(temp_variable *T, int arg_count, zval *return_value TSRMLS_DC);
static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC);
static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array);
static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array);
static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array);
#define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED))
static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_free ELS_DC)
static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_free TSRMLS_DC)
{
switch(node->op_type) {
case IS_CONST:
@ -88,7 +88,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr
switch (Ts[node->u.var].EA.type) {
case IS_OVERLOADED_OBJECT:
Ts[node->u.var].tmp_var = get_overloaded_property(&Ts[node->u.var] ELS_CC);
Ts[node->u.var].tmp_var = get_overloaded_property(&Ts[node->u.var] TSRMLS_CC);
Ts[node->u.var].tmp_var.refcount=1;
Ts[node->u.var].tmp_var.is_ref=1;
return &Ts[node->u.var].tmp_var;
@ -128,7 +128,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr
return NULL;
}
static inline zval *_get_object_zval_ptr(znode *node, temp_variable *Ts, int *should_free ELS_DC)
static inline zval *_get_object_zval_ptr(znode *node, temp_variable *Ts, int *should_free TSRMLS_DC)
{
switch(node->op_type) {
case IS_TMP_VAR:
@ -158,7 +158,7 @@ static inline zval *_get_object_zval_ptr(znode *node, temp_variable *Ts, int *sh
}
static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts ELS_DC)
static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
{
if (node->op_type==IS_VAR) {
if (Ts[node->u.var].var.ptr_ptr) {
@ -173,7 +173,7 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts ELS_DC)
}
static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC)
static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
{
zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
zval **retval;
@ -226,7 +226,7 @@ static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2
static inline void zend_switch_free(zend_op *opline, temp_variable *Ts ELS_DC)
static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC)
{
switch (opline->op1.op_type) {
case IS_VAR:
@ -247,7 +247,7 @@ static inline void zend_switch_free(zend_op *opline, temp_variable *Ts ELS_DC)
}
}
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC)
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC)
{
zval *variable_ptr;
zval *value_ptr;
@ -300,7 +300,7 @@ void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, z
}
static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts ELS_DC)
static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts TSRMLS_DC)
{
zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
zval *variable_ptr;
@ -308,7 +308,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (!variable_ptr_ptr) {
switch (Ts[op1->u.var].EA.type) {
case IS_OVERLOADED_OBJECT:
set_overloaded_property(&Ts[op1->u.var], value ELS_CC);
set_overloaded_property(&Ts[op1->u.var], value TSRMLS_CC);
if (type == IS_TMP_VAR) {
zval_dtor(value);
}
@ -503,7 +503,7 @@ static void print_refcount(zval *p, char *str)
}
static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC)
static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
{
int free_op1;
zval *varname = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R);
@ -572,7 +572,7 @@ static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_v
}
static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC)
static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
{
zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
zval **retval;
@ -656,7 +656,7 @@ fetch_string_dim:
return retval;
}
static void fetch_overloaded_element(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type, zval ***retval, int overloaded_element_type ELS_DC)
static void fetch_overloaded_element(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type, zval ***retval, int overloaded_element_type TSRMLS_DC)
{
zend_overloaded_element overloaded_element;
@ -692,7 +692,7 @@ static void fetch_overloaded_element(znode *result, znode *op1, znode *op2, temp
}
static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC)
static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
{
zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
zval *container;
@ -700,7 +700,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
if (container_ptr == NULL) {
fetch_overloaded_element(result, op1, op2, Ts, type, retval, OE_IS_ARRAY ELS_CC);
fetch_overloaded_element(result, op1, op2, Ts, type, retval, OE_IS_ARRAY TSRMLS_CC);
return;
}
@ -739,7 +739,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
new_zval->refcount++;
zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) retval);
} else {
*retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type ELS_CC);
*retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type TSRMLS_CC);
}
SELECTIVE_PZVAL_LOCK(**retval, result);
break;
@ -802,7 +802,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
}
static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts ELS_DC)
static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC)
{
int free_op1;
zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R);
@ -813,12 +813,12 @@ static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1,
return;
}
Ts[result->u.var].var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R ELS_CC);
Ts[result->u.var].var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result);
}
static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC)
static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
{
zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
zval *container;
@ -826,7 +826,7 @@ static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, t
if (container_ptr == NULL) {
fetch_overloaded_element(result, op1, op2, Ts, type, retval, OE_IS_OBJECT ELS_CC);
fetch_overloaded_element(result, op1, op2, Ts, type, retval, OE_IS_OBJECT TSRMLS_CC);
return;
}
@ -891,12 +891,12 @@ static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, t
SEPARATE_ZVAL(container_ptr);
container = *container_ptr;
}
*retval = zend_fetch_property_address_inner(container->value.obj.properties, op2, Ts, type ELS_CC);
*retval = zend_fetch_property_address_inner(container->value.obj.properties, op2, Ts, type TSRMLS_CC);
SELECTIVE_PZVAL_LOCK(**retval, result);
}
static zval get_overloaded_property(temp_variable *T ELS_DC)
static zval get_overloaded_property(temp_variable *T TSRMLS_DC)
{
zval result;
@ -908,7 +908,7 @@ static zval get_overloaded_property(temp_variable *T ELS_DC)
}
static void set_overloaded_property(temp_variable *T, zval *value ELS_DC)
static void set_overloaded_property(temp_variable *T, zval *value TSRMLS_DC)
{
if ((T->EA.data.overloaded_element.object)->value.obj.ce->handle_property_set) {
(T->EA.data.overloaded_element.object)->value.obj.ce->handle_property_set(&T->EA.data.overloaded_element, value);
@ -921,10 +921,10 @@ static void set_overloaded_property(temp_variable *T, zval *value ELS_DC)
}
static void call_overloaded_function(temp_variable *T, int arg_count, zval *return_value ELS_DC)
static void call_overloaded_function(temp_variable *T, int arg_count, zval *return_value TSRMLS_DC)
{
if ((T->EA.data.overloaded_element.object)->value.obj.ce->handle_function_call) {
(T->EA.data.overloaded_element.object)->value.obj.ce->handle_function_call(arg_count, return_value, T->EA.data.overloaded_element.object, 1 ELS_CC, &T->EA.data.overloaded_element);
(T->EA.data.overloaded_element.object)->value.obj.ce->handle_function_call(arg_count, return_value, T->EA.data.overloaded_element.object, 1 TSRMLS_CC, &T->EA.data.overloaded_element);
} else {
zend_error(E_ERROR, "Class '%s' does not support overloaded method calls",
(T->EA.data.overloaded_element.object)->value.obj.ce->name);
@ -969,7 +969,7 @@ typedef struct _object_info {
zval *ptr;
} object_info;
ZEND_API void execute(zend_op_array *op_array ELS_DC)
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
{
zend_op *opline;
zend_function_state function_state;
@ -1020,7 +1020,7 @@ ZEND_API void execute(zend_op_array *op_array ELS_DC)
}
#endif
zend_clean_garbage(ELS_C);
zend_clean_garbage(TSRMLS_C);
switch(opline->opcode) {
case ZEND_ADD:
@ -1199,27 +1199,27 @@ binary_assign_op_addr: {
FREE_OP(&opline->op1, EG(free_op1));
NEXT_OPCODE();
case ZEND_FETCH_R:
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_W:
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_RW:
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_FUNC_ARG:
if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) {
/* Behave like FETCH_W */
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
} else {
/* Behave like FETCH_R */
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
}
NEXT_OPCODE();
case ZEND_FETCH_UNSET:
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr);
if (Ts[opline->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(Ts[opline->result.u.var].var.ptr_ptr);
@ -1227,33 +1227,33 @@ binary_assign_op_addr: {
PZVAL_LOCK(*Ts[opline->result.u.var].var.ptr_ptr);
NEXT_OPCODE();
case ZEND_FETCH_IS:
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC);
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_DIM_R:
if (opline->extended_value == ZEND_FETCH_ADD_LOCK) {
PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr);
}
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_DIM_W:
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_DIM_RW:
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_DIM_IS:
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_DIM_FUNC_ARG:
if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) {
/* Behave like FETCH_DIM_W */
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
} else {
/* Behave like FETCH_DIM_R, except for locking used for list() */
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
}
NEXT_OPCODE();
@ -1263,7 +1263,7 @@ binary_assign_op_addr: {
PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr);
}
*/
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr);
if (Ts[opline->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(Ts[opline->result.u.var].var.ptr_ptr);
@ -1271,30 +1271,30 @@ binary_assign_op_addr: {
PZVAL_LOCK(*Ts[opline->result.u.var].var.ptr_ptr);
NEXT_OPCODE();
case ZEND_FETCH_OBJ_R:
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_OBJ_W:
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_OBJ_RW:
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW TSRMLS_CC);
NEXT_OPCODE();
case ZEND_FETCH_OBJ_IS:
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_FETCH_OBJ_FUNC_ARG:
if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) {
/* Behave like FETCH_OBJ_W */
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W TSRMLS_CC);
} else {
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
}
NEXT_OPCODE();
case ZEND_FETCH_OBJ_UNSET:
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R TSRMLS_CC);
PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr);
if (Ts[opline->result.u.var].var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
@ -1303,19 +1303,19 @@ binary_assign_op_addr: {
PZVAL_LOCK(*Ts[opline->result.u.var].var.ptr_ptr);
NEXT_OPCODE();
case ZEND_FETCH_DIM_TMP_VAR:
zend_fetch_dimension_address_from_tmp_var(&opline->result, &opline->op1, &opline->op2, Ts ELS_CC);
zend_fetch_dimension_address_from_tmp_var(&opline->result, &opline->op1, &opline->op2, Ts TSRMLS_CC);
AI_USE_PTR(Ts[opline->result.u.var].var);
NEXT_OPCODE();
case ZEND_ASSIGN: {
zval *value;
value = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R);
zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (EG(free_op2)?IS_TMP_VAR:opline->op2.op_type), Ts ELS_CC);
zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (EG(free_op2)?IS_TMP_VAR:opline->op2.op_type), Ts TSRMLS_CC);
/* zend_assign_to_variable() always takes care of op2, never free it! */
}
NEXT_OPCODE();
case ZEND_ASSIGN_REF:
zend_assign_to_variable_reference(&opline->result, get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W), get_zval_ptr_ptr(&opline->op2, Ts, BP_VAR_W), Ts ELS_CC);
zend_assign_to_variable_reference(&opline->result, get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W), get_zval_ptr_ptr(&opline->op2, Ts, BP_VAR_W), Ts TSRMLS_CC);
NEXT_OPCODE();
case ZEND_JMP:
#if DEBUG_ZEND>=2
@ -1490,7 +1490,7 @@ binary_assign_op_addr: {
}
active_function_table = &ce->function_table;
} else { /* used for member function calls */
object.ptr = _get_object_zval_ptr(&opline->op1, Ts, &EG(free_op1) ELS_CC);
object.ptr = _get_object_zval_ptr(&opline->op1, Ts, &EG(free_op1) TSRMLS_CC);
if ((!object.ptr && Ts[opline->op1.u.var].EA.type==IS_OVERLOADED_OBJECT)
|| ((object.ptr && object.ptr->type==IS_OBJECT) && (object.ptr->value.obj.ce->handle_function_call))) { /* overloaded function call */
@ -1562,7 +1562,7 @@ do_fcall_common:
if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, object.ptr, return_value_used ELS_CC);
((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, object.ptr, return_value_used TSRMLS_CC);
if (object.ptr) {
object.ptr->refcount--;
}
@ -1602,7 +1602,7 @@ do_fcall_common:
EG(return_value_ptr_ptr) = Ts[opline->result.u.var].var.ptr_ptr;
EG(active_op_array) = (zend_op_array *) function_state.function;
zend_execute(EG(active_op_array) ELS_CC);
zend_execute(EG(active_op_array) TSRMLS_CC);
if (return_value_used && !Ts[opline->result.u.var].var.ptr) {
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
@ -1624,7 +1624,7 @@ do_fcall_common:
} else { /* ZEND_OVERLOADED_FUNCTION */
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
call_overloaded_function(&Ts[fbc->overloaded_function.var], opline->extended_value, Ts[opline->result.u.var].var.ptr ELS_CC);
call_overloaded_function(&Ts[fbc->overloaded_function.var], opline->extended_value, Ts[opline->result.u.var].var.ptr TSRMLS_CC);
efree(fbc);
if (!return_value_used) {
zval_ptr_dtor(&Ts[opline->result.u.var].var.ptr);
@ -1637,7 +1637,7 @@ do_fcall_common:
}
function_state.function = (zend_function *) op_array;
EG(function_state_ptr) = &function_state;
zend_ptr_stack_clear_multiple(ELS_C);
zend_ptr_stack_clear_multiple(TSRMLS_C);
}
NEXT_OPCODE();
case ZEND_RETURN: {
@ -1768,22 +1768,22 @@ send_by_ref:
case ZEND_RECV: {
zval **param;
if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param ELS_CC)==FAILURE) {
if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
zend_error(E_WARNING, "Missing argument %d for %s()\n", opline->op1.u.constant.value.lval, get_active_function_name());
if (opline->result.op_type == IS_VAR) {
PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr);
}
} else if (PZVAL_IS_REF(*param)) {
zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC);
zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL TSRMLS_CC);
} else {
zend_assign_to_variable(NULL, &opline->result, NULL, *param, IS_VAR, Ts ELS_CC);
zend_assign_to_variable(NULL, &opline->result, NULL, *param, IS_VAR, Ts TSRMLS_CC);
}
}
NEXT_OPCODE();
case ZEND_RECV_INIT: {
zval **param, *assignment_value;
if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param ELS_CC)==FAILURE) {
if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param TSRMLS_CC)==FAILURE) {
if (opline->op2.u.constant.type == IS_CONSTANT || opline->op2.u.constant.type==IS_CONSTANT_ARRAY) {
zval *default_value;
@ -1807,9 +1807,9 @@ send_by_ref:
}
if (PZVAL_IS_REF(assignment_value) && param) {
zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC);
zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL TSRMLS_CC);
} else {
zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, Ts ELS_CC);
zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, Ts TSRMLS_CC);
}
}
NEXT_OPCODE();
@ -1846,7 +1846,7 @@ send_by_ref:
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
zend_switch_free(brk_opline, Ts ELS_CC);
zend_switch_free(brk_opline, Ts TSRMLS_CC);
break;
case ZEND_FREE:
zendi_zval_dtor(Ts[brk_opline->op1.u.var].tmp_var);
@ -1896,7 +1896,7 @@ send_by_ref:
}
NEXT_OPCODE();
case ZEND_SWITCH_FREE:
zend_switch_free(opline, Ts ELS_CC);
zend_switch_free(opline, Ts TSRMLS_CC);
NEXT_OPCODE();
case ZEND_NEW: {
zval *tmp = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
@ -2083,7 +2083,7 @@ send_by_ref:
break;
case ZEND_INCLUDE:
case ZEND_REQUIRE:
new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename CLS_CC ELS_CC);
new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename CLS_CC TSRMLS_CC);
break;
case ZEND_EVAL: {
char *eval_desc = zend_make_compiled_string_description("eval()'d code");
@ -2104,7 +2104,7 @@ send_by_ref:
EG(return_value_ptr_ptr) = Ts[opline->result.u.var].var.ptr_ptr;
EG(active_op_array) = new_op_array;
zend_execute(new_op_array ELS_CC);
zend_execute(new_op_array TSRMLS_CC);
if (!return_value_used) {
if (Ts[opline->result.u.var].var.ptr) {

22
Zend/zend_execute.h

@ -47,22 +47,22 @@ typedef union _temp_variable {
} temp_variable;
ZEND_API extern void (*zend_execute)(zend_op_array *op_array ELS_DC);
ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
void init_executor(CLS_D ELS_DC);
void shutdown_executor(ELS_D);
ZEND_API void execute(zend_op_array *op_array ELS_DC);
void init_executor(CLS_D TSRMLS_DC);
void shutdown_executor(TSRMLS_D);
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
ZEND_API int zend_is_true(zval *op);
static inline void safe_free_zval_ptr(zval *p)
{
ELS_FETCH();
TSRMLS_FETCH();
if (p!=EG(uninitialized_zval_ptr)) {
FREE_ZVAL(p);
}
}
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC ELS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC TSRMLS_DC);
static inline int i_zend_is_true(zval *op)
{
int result;
@ -103,7 +103,7 @@ static inline int i_zend_is_true(zval *op)
ZEND_API int zval_update_constant(zval **pp, void *arg);
/* dedicated Zend executor functions - do not use! */
static inline void zend_ptr_stack_clear_multiple(ELS_D)
static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
{
void **p = EG(argument_stack).top_element-2;
int delete_count = (ulong) *p;
@ -115,7 +115,7 @@ static inline void zend_ptr_stack_clear_multiple(ELS_D)
EG(argument_stack).top_element = p;
}
static inline int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC)
static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
{
void **p = EG(argument_stack).top_element-2;
int arg_count = (ulong) *p;
@ -132,8 +132,8 @@ void execute_new_code(CLS_D);
/* services */
ZEND_API char *get_active_function_name(void);
ZEND_API char *zend_get_executed_filename(ELS_D);
ZEND_API uint zend_get_executed_lineno(ELS_D);
ZEND_API char *zend_get_executed_filename(TSRMLS_D);
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
ZEND_API zend_bool zend_is_executing(void);
ZEND_API void zend_set_timeout(long seconds);
@ -152,7 +152,7 @@ void zend_shutdown_timeout_thread();
#define active_opline (*EG(opline_ptr))
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC);
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
#define IS_OVERLOADED_OBJECT 1
#define IS_STRING_OFFSET 2

48
Zend/zend_execute_API.c

@ -33,7 +33,7 @@
#endif
ZEND_API void (*zend_execute)(zend_op_array *op_array ELS_DC);
ZEND_API void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
#ifdef ZEND_WIN32
#include <process.h>
@ -58,14 +58,14 @@ static void zend_handle_sigsegv(int dummy)
signal(SIGSEGV, SIG_DFL);
}
{
ELS_FETCH();
TSRMLS_FETCH();
fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
active_opline->opcode,
active_opline-EG(active_op_array)->opcodes,
get_active_function_name(),
zend_get_executed_filename(ELS_C),
zend_get_executed_lineno(ELS_C));
zend_get_executed_filename(TSRMLS_C),
zend_get_executed_lineno(TSRMLS_C));
}
if (original_sigsegv_handler!=zend_handle_sigsegv) {
original_sigsegv_handler(dummy);
@ -102,7 +102,7 @@ static int is_not_internal_class(zend_class_entry *ce)
}
void init_executor(CLS_D ELS_DC)
void init_executor(CLS_D TSRMLS_DC)
{
INIT_ZVAL(EG(uninitialized_zval));
INIT_ZVAL(EG(error_zval));
@ -150,7 +150,7 @@ void init_executor(CLS_D ELS_DC)
}
void shutdown_executor(ELS_D)
void shutdown_executor(TSRMLS_D)
{
zend_try {
zend_ptr_stack_destroy(&EG(arg_types_stack));
@ -177,7 +177,7 @@ void shutdown_executor(ELS_D)
zend_hash_apply(EG(class_table), (int (*)(void *)) is_not_internal_class);
} zend_end_try();
zend_destroy_rsrc_list(ELS_C); /* must be destroyed after the main symbol table and
zend_destroy_rsrc_list(TSRMLS_C); /* must be destroyed after the main symbol table and
* op arrays are destroyed.
*/
@ -204,7 +204,7 @@ void shutdown_executor(ELS_D)
ZEND_API char *get_active_function_name()
{
ELS_FETCH();
TSRMLS_FETCH();
switch(EG(function_state_ptr)->function->type) {
case ZEND_USER_FUNCTION: {
@ -226,7 +226,7 @@ ZEND_API char *get_active_function_name()
}
ZEND_API char *zend_get_executed_filename(ELS_D)
ZEND_API char *zend_get_executed_filename(TSRMLS_D)
{
if (EG(active_op_array)) {
return EG(active_op_array)->filename;
@ -236,7 +236,7 @@ ZEND_API char *zend_get_executed_filename(ELS_D)
}
ZEND_API uint zend_get_executed_lineno(ELS_D)
ZEND_API uint zend_get_executed_lineno(TSRMLS_D)
{
if (EG(opline_ptr)) {
return active_opline->lineno;
@ -248,7 +248,7 @@ ZEND_API uint zend_get_executed_lineno(ELS_D)
ZEND_API zend_bool zend_is_executing()
{
ELS_FETCH();
TSRMLS_FETCH();
return EG(in_execution);
}
@ -383,7 +383,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
int (*orig_unary_op)(zval *result, zval *op1);
int (*orig_binary_op)(zval *result, zval *op1, zval *op2);
zval function_name_copy;
ELS_FETCH();
TSRMLS_FETCH();
*retval_ptr_ptr = NULL;
@ -493,7 +493,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
ALLOC_ZVAL(dummy);
INIT_ZVAL(*dummy);
zend_hash_update(EG(active_symbol_table), "this", sizeof("this"), &dummy, sizeof(zval *), (void **) &this_ptr);
zend_assign_to_variable_reference(NULL, this_ptr, object_pp, NULL ELS_CC);
zend_assign_to_variable_reference(NULL, this_ptr, object_pp, NULL TSRMLS_CC);
}
original_return_value = EG(return_value_ptr_ptr);
original_op_array = EG(active_op_array);
@ -504,7 +504,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
orig_free_op2 = EG(free_op2);
orig_unary_op = EG(unary_op);
orig_binary_op = EG(binary_op);
zend_execute(EG(active_op_array) ELS_CC);
zend_execute(EG(active_op_array) TSRMLS_CC);
if (!symbol_table) {
zend_hash_destroy(EG(active_symbol_table));
FREE_HASHTABLE(EG(active_symbol_table));
@ -519,17 +519,17 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
EG(binary_op) = orig_binary_op;
} else {
ALLOC_INIT_ZVAL(*retval_ptr_ptr);
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 ELS_CC);
((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, (object_pp?*object_pp:NULL), 1 TSRMLS_CC);
INIT_PZVAL(*retval_ptr_ptr);
}
zend_ptr_stack_clear_multiple(ELS_C);
zend_ptr_stack_clear_multiple(TSRMLS_C);
EG(function_state_ptr) = original_function_state_ptr;
return SUCCESS;
}
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC ELS_DC)
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC TSRMLS_DC)
{
zval pv;
zend_op_array *new_op_array;
@ -566,7 +566,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS
EG(active_op_array) = new_op_array;
EG(no_extensions)=1;
zend_execute(new_op_array ELS_CC);
zend_execute(new_op_array TSRMLS_CC);
if (local_retval_ptr) {
if (retval_ptr) {
@ -600,7 +600,7 @@ void execute_new_code(CLS_D)
{
zend_op *opline, *end;
zend_op *ret_opline;
ELS_FETCH();
TSRMLS_FETCH();
if (!CG(interactive)
|| CG(active_op_array)->backpatch_count>0
@ -635,7 +635,7 @@ void execute_new_code(CLS_D)
}
EG(active_op_array) = CG(active_op_array);
zend_execute(CG(active_op_array) ELS_CC);
zend_execute(CG(active_op_array) TSRMLS_CC);
zval_ptr_dtor(EG(return_value_ptr_ptr));
CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
@ -644,7 +644,7 @@ void execute_new_code(CLS_D)
ZEND_API void zend_timeout(int dummy)
{
ELS_FETCH();
TSRMLS_FETCH();
/* is there any point in this? we're terminating the request anyway...
PLS_FETCH();
@ -686,7 +686,7 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa
}
#endif
KillTimer(timeout_window, wParam);
EG(timed_out) = 1;
executor_globals->timed_out = 1;
}
break;
default:
@ -753,7 +753,7 @@ void zend_shutdown_timeout_thread()
void zend_set_timeout(long seconds)
{
ELS_FETCH();
TSRMLS_FETCH();
EG(timeout_seconds) = seconds;
#ifdef ZEND_WIN32
@ -786,7 +786,7 @@ void zend_set_timeout(long seconds)
void zend_unset_timeout(void)
{
ELS_FETCH();
TSRMLS_FETCH();
#ifdef ZEND_WIN32
PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);

6
Zend/zend_execute_locks.h

@ -8,9 +8,9 @@ static inline void zend_pzval_lock_func(zval *z)
((z)->refcount++);
}
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z ELS_CC)
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z TSRMLS_CC)
static inline void zend_pzval_unlock_func(zval *z ELS_DC)
static inline void zend_pzval_unlock_func(zval *z TSRMLS_DC)
{
((z)->refcount--);
if (!(z)->refcount) {
@ -20,7 +20,7 @@ static inline void zend_pzval_unlock_func(zval *z ELS_DC)
}
}
static inline void zend_clean_garbage(ELS_D)
static inline void zend_clean_garbage(TSRMLS_D)
{
while (EG(garbage_ptr)) {
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);

12
Zend/zend_globals_macros.h

@ -50,19 +50,9 @@ int zendparse(void);
/* Executor */
#ifdef ZTS
# define ELS_D zend_executor_globals *executor_globals
# define ELS_DC , ELS_D
# define ELS_C executor_globals
# define ELS_CC , ELS_C
# define EG(v) (executor_globals->v)
# define ELS_FETCH() zend_executor_globals *executor_globals = (zend_executor_globals *) ts_resource(executor_globals_id)
# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
#else
# define ELS_D void
# define ELS_DC
# define ELS_C
# define ELS_CC
# define EG(v) (executor_globals.v)
# define ELS_FETCH()
extern ZEND_API zend_executor_globals executor_globals;
#endif

26
Zend/zend_ini.c

@ -60,7 +60,7 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage)
/*
* Startup / shutdown
*/
ZEND_API int zend_ini_startup(ELS_D)
ZEND_API int zend_ini_startup(TSRMLS_D)
{
registered_zend_ini_directives = &EG(ini_directives);
if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) {
@ -70,21 +70,21 @@ ZEND_API int zend_ini_startup(ELS_D)
}
ZEND_API int zend_ini_shutdown(ELS_D)
ZEND_API int zend_ini_shutdown(TSRMLS_D)
{
zend_hash_destroy(&EG(ini_directives));
return SUCCESS;
}
ZEND_API int zend_ini_deactivate(ELS_D)
ZEND_API int zend_ini_deactivate(TSRMLS_D)
{
zend_hash_apply_with_argument(&EG(ini_directives), (int (*)(void *, void *)) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE);
return SUCCESS;
}
ZEND_API int zend_copy_ini_directives(ELS_D)
ZEND_API int zend_copy_ini_directives(TSRMLS_D)
{
zend_ini_entry ini_entry;
@ -92,7 +92,7 @@ ZEND_API int zend_copy_ini_directives(ELS_D)
return FAILURE;
}
zend_hash_copy(&EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP ELS_CC);
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
return SUCCESS;
}
@ -117,7 +117,7 @@ static int ini_key_compare(const void *a, const void *b)
}
ZEND_API void zend_ini_sort_entries(ELS_D)
ZEND_API void zend_ini_sort_entries(TSRMLS_D)
{
zend_hash_sort(&EG(ini_directives), qsort, ini_key_compare, 0);
}
@ -170,7 +170,7 @@ static int zend_ini_refresh_cache(zend_ini_entry *p, int stage)
}
ZEND_API void zend_ini_refresh_caches(int stage ELS_DC)
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC)
{
zend_hash_apply_with_argument(&EG(ini_directives), (int (*)(void *, void *)) zend_ini_refresh_cache, (void *)(long) stage);
}
@ -180,7 +180,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value,
{
zend_ini_entry *ini_entry;
char *duplicate;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
return FAILURE;
@ -214,7 +214,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value,
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage)
{
zend_ini_entry *ini_entry;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
return FAILURE;
@ -246,7 +246,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
ZEND_API long zend_ini_long(char *name, uint name_length, int orig)
{
zend_ini_entry *ini_entry;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (orig && ini_entry->modified) {
@ -263,7 +263,7 @@ ZEND_API long zend_ini_long(char *name, uint name_length, int orig)
ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
{
zend_ini_entry *ini_entry;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (orig && ini_entry->modified) {
@ -280,7 +280,7 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig)
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
{
zend_ini_entry *ini_entry;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
if (orig && ini_entry->modified) {
@ -297,7 +297,7 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig)
zend_ini_entry *get_ini_entry(char *name, uint name_length)
{
zend_ini_entry *ini_entry;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) {
return ini_entry;

12
Zend/zend_ini.h

@ -82,17 +82,17 @@ struct _zend_ini_entry {
};
ZEND_API int zend_ini_startup(ELS_D);
ZEND_API int zend_ini_shutdown(ELS_D);
ZEND_API int zend_ini_deactivate(ELS_D);
ZEND_API int zend_ini_startup(TSRMLS_D);
ZEND_API int zend_ini_shutdown(TSRMLS_D);
ZEND_API int zend_ini_deactivate(TSRMLS_D);
ZEND_API int zend_copy_ini_directives(ELS_D);
ZEND_API int zend_copy_ini_directives(TSRMLS_D);
ZEND_API void zend_ini_sort_entries(ELS_D);
ZEND_API void zend_ini_sort_entries(TSRMLS_D);
ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_number);
ZEND_API void zend_unregister_ini_entries(int module_number);
ZEND_API void zend_ini_refresh_caches(int stage ELS_DC);
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module);

4
Zend/zend_language_parser.y

@ -139,7 +139,7 @@ start:
;
top_statement_list:
top_statement_list { zend_do_extended_info(CLS_C); } top_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
top_statement_list { zend_do_extended_info(CLS_C); } top_statement { TSRMLS_FETCH(); HANDLE_INTERACTIVE(); }
| /* empty */
;
@ -151,7 +151,7 @@ top_statement:
inner_statement_list:
inner_statement_list { zend_do_extended_info(CLS_C); } inner_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
inner_statement_list { zend_do_extended_info(CLS_C); } inner_statement { TSRMLS_FETCH(); HANDLE_INTERACTIVE(); }
| /* empty */
;

2
Zend/zend_language_scanner.l

@ -380,7 +380,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type CLS
}
zend_op_array *compile_filename(int type, zval *filename CLS_DC ELS_DC)
zend_op_array *compile_filename(int type, zval *filename CLS_DC TSRMLS_DC)
{
zend_file_handle file_handle;
zval tmp;

18
Zend/zend_list.c

@ -35,7 +35,7 @@ ZEND_API int zend_list_insert(void *ptr, int type)
{
int index;
zend_rsrc_list_entry le;
ELS_FETCH();
TSRMLS_FETCH();
le.ptr=ptr;
le.type=type;
@ -49,7 +49,7 @@ ZEND_API int zend_list_insert(void *ptr, int type)
ZEND_API int zend_list_delete(int id)
{
zend_rsrc_list_entry *le;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
@ -67,7 +67,7 @@ ZEND_API int zend_list_delete(int id)
ZEND_API void *zend_list_find(int id, int *type)
{
zend_rsrc_list_entry *le;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
*type = le->type;
@ -82,7 +82,7 @@ ZEND_API void *zend_list_find(int id, int *type)
ZEND_API int zend_list_addref(int id)
{
zend_rsrc_list_entry *le;
ELS_FETCH();
TSRMLS_FETCH();
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
@ -212,7 +212,7 @@ void plist_entry_destructor(void *ptr)
}
int zend_init_rsrc_list(ELS_D)
int zend_init_rsrc_list(TSRMLS_D)
{
if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
@ -223,13 +223,13 @@ int zend_init_rsrc_list(ELS_D)
}
int zend_init_rsrc_plist(ELS_D)
int zend_init_rsrc_plist(TSRMLS_D)
{
return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
}
void zend_destroy_rsrc_list(ELS_D)
void zend_destroy_rsrc_list(TSRMLS_D)
{
Bucket *p, *q;
HashTable *ht = &EG(regular_list);
@ -260,7 +260,7 @@ void zend_destroy_rsrc_list(ELS_D)
void zend_destroy_rsrc_plist(ELS_D)
void zend_destroy_rsrc_plist(TSRMLS_D)
{
zend_hash_reverse_destroy(&EG(persistent_list));
}
@ -279,7 +279,7 @@ static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id)
static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number)
{
if (ld->module_number == *module_number) {
ELS_FETCH();
TSRMLS_FETCH();
zend_hash_apply_with_argument(&EG(regular_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id));
zend_hash_apply_with_argument(&EG(persistent_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id));

8
Zend/zend_list.h

@ -66,10 +66,10 @@ void list_entry_destructor(void *ptr);
void plist_entry_destructor(void *ptr);
void zend_clean_module_rsrc_dtors(int module_number);
int zend_init_rsrc_list(ELS_D);
int zend_init_rsrc_plist(ELS_D);
void zend_destroy_rsrc_list(ELS_D);
void zend_destroy_rsrc_plist(ELS_D);
int zend_init_rsrc_list(TSRMLS_D);
int zend_init_rsrc_plist(TSRMLS_D);
void zend_destroy_rsrc_list(TSRMLS_D);
void zend_destroy_rsrc_plist(TSRMLS_D);
int zend_init_rsrc_list_dtors(void);
void zend_destroy_rsrc_list_dtors(void);

4
Zend/zend_modules.h

@ -23,8 +23,8 @@
#include "zend.h"
#define INIT_FUNC_ARGS int type, int module_number ELS_DC
#define INIT_FUNC_ARGS_PASSTHRU type, module_number ELS_CC
#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC
#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
#define SHUTDOWN_FUNC_ARGS int type, int module_number
#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module

2
Zend/zend_operators.c

@ -411,7 +411,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC)
{
long lval;
double dval;
ELS_FETCH();
TSRMLS_FETCH();
switch (op->type) {
case IS_NULL:

4
Zend/zend_variables.c

@ -45,7 +45,7 @@ ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
break;
case IS_ARRAY:
case IS_CONSTANT_ARRAY: {
ELS_FETCH();
TSRMLS_FETCH();
if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
zend_hash_destroy(zvalue->value.ht);
@ -103,7 +103,7 @@ ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
case IS_CONSTANT_ARRAY: {
zval *tmp;
HashTable *original_ht = zvalue->value.ht;
ELS_FETCH();
TSRMLS_FETCH();
if (zvalue->value.ht == &EG(symbol_table)) {
return SUCCESS; /* do nothing */

Loading…
Cancel
Save