diff options
Diffstat (limited to 'ext/opcache/ZendAccelerator.c')
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 404 |
1 files changed, 199 insertions, 205 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 486cb39a17..5faa9c61c3 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -74,13 +74,13 @@ typedef int gid_t; #define SHM_PROTECT() \ do { \ if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(1 TSRMLS_CC); \ + zend_accel_shared_protect(1); \ } \ } while (0) #define SHM_UNPROTECT() \ do { \ if (ZCG(accel_directives).protect_memory) { \ - zend_accel_shared_protect(0 TSRMLS_CC); \ + zend_accel_shared_protect(0); \ } \ } while (0) @@ -103,9 +103,9 @@ zend_bool accel_startup_ok = 0; static char *zps_failure_reason = NULL; char *zps_api_failure_reason = NULL; -static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); -static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); +static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); +static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); +static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len); static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; @@ -164,7 +164,7 @@ static ZEND_FUNCTION(accel_chdir) } } -static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) +static inline char* accel_getcwd(int *cwd_len) { if (ZCG(cwd)) { *cwd_len = ZCG(cwd_len); @@ -181,10 +181,10 @@ static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) } } -void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC) +void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason) { if ((((double) ZSMMG(wasted_shared_memory)) / ZCG(accel_directives).memory_consumption) >= ZCG(accel_directives).max_wasted_percentage) { - zend_accel_schedule_restart(reason TSRMLS_CC); + zend_accel_schedule_restart(reason); } } @@ -195,7 +195,7 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason T */ static ZEND_INI_MH(accel_include_path_on_modify) { - int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); ZCG(include_path_key) = NULL; if (ret == SUCCESS) { @@ -210,7 +210,7 @@ static ZEND_INI_MH(accel_include_path_on_modify) if (!ZCG(include_path_key) && !zend_accel_hash_is_full(&ZCSG(include_paths))) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); ZCG(include_path_key) = zend_accel_hash_find(&ZCSG(include_paths), ZCG(include_path), ZCG(include_path_len)); if (!ZCG(include_path_key) && @@ -224,11 +224,11 @@ static ZEND_INI_MH(accel_include_path_on_modify) ZCG(include_path_key) = key + ZCG(include_path_len) + 1; zend_accel_hash_update(&ZCSG(include_paths), key, ZCG(include_path_len), 0, ZCG(include_path_key)); } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } else { @@ -243,29 +243,29 @@ static ZEND_INI_MH(accel_include_path_on_modify) } /* Interned strings support */ -static zend_string *(*orig_new_interned_string)(zend_string *str TSRMLS_DC); -static void (*orig_interned_strings_snapshot)(TSRMLS_D); -static void (*orig_interned_strings_restore)(TSRMLS_D); +static zend_string *(*orig_new_interned_string)(zend_string *str); +static void (*orig_interned_strings_snapshot)(void); +static void (*orig_interned_strings_restore)(void); /* O+ disables creation of interned strings by regular PHP compiler, instead, * it creates interned strings in shared memory when saves a script. * Such interned strings are shared across all PHP processes */ -static zend_string *accel_new_interned_string_for_php(zend_string *str TSRMLS_DC) +static zend_string *accel_new_interned_string_for_php(zend_string *str) { return str; } -static void accel_interned_strings_snapshot_for_php(TSRMLS_D) +static void accel_interned_strings_snapshot_for_php(void) { } -static void accel_interned_strings_restore_for_php(TSRMLS_D) +static void accel_interned_strings_restore_for_php(void) { } #ifndef ZTS -static void accel_interned_strings_restore_state(TSRMLS_D) +static void accel_interned_strings_restore_state(void) { uint idx = ZCSG(interned_strings).nNumUsed; uint nIndex; @@ -292,13 +292,13 @@ static void accel_interned_strings_restore_state(TSRMLS_D) } } -static void accel_interned_strings_save_state(TSRMLS_D) +static void accel_interned_strings_save_state(void) { ZCSG(interned_strings_saved_top) = ZCSG(interned_strings_top); } #endif -zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) +zend_string *accel_new_interned_string(zend_string *str) { /* for now interned strings are supported only for non-ZTS build */ #ifndef ZTS @@ -366,18 +366,18 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) #ifndef ZTS /* Copy PHP interned strings from PHP process memory into the shared memory */ -static void accel_use_shm_interned_strings(TSRMLS_D) +static void accel_use_shm_interned_strings(void) { uint idx, j; Bucket *p, *q; /* empty string */ - CG(empty_string) = accel_new_interned_string(CG(empty_string) TSRMLS_CC); + CG(empty_string) = accel_new_interned_string(CG(empty_string)); for (j = 0; j < 256; j++) { char s[2]; s[0] = j; s[1] = 0; - CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0) TSRMLS_CC); + CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0)); } /* function table hash keys */ @@ -385,10 +385,10 @@ static void accel_use_shm_interned_strings(TSRMLS_D) p = CG(function_table)->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } if (Z_FUNC(p->val)->common.function_name) { - Z_FUNC(p->val)->common.function_name = accel_new_interned_string(Z_FUNC(p->val)->common.function_name TSRMLS_CC); + Z_FUNC(p->val)->common.function_name = accel_new_interned_string(Z_FUNC(p->val)->common.function_name); } } @@ -401,11 +401,11 @@ static void accel_use_shm_interned_strings(TSRMLS_D) ce = (zend_class_entry*)Z_PTR(p->val); if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } if (ce->name) { - ce->name = accel_new_interned_string(ce->name TSRMLS_CC); + ce->name = accel_new_interned_string(ce->name); } for (j = 0; j < ce->properties_info.nNumUsed; j++) { @@ -417,11 +417,11 @@ static void accel_use_shm_interned_strings(TSRMLS_D) info = (zend_property_info*)Z_PTR(q->val); if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } if (info->name) { - info->name = accel_new_interned_string(info->name TSRMLS_CC); + info->name = accel_new_interned_string(info->name); } } @@ -429,10 +429,10 @@ static void accel_use_shm_interned_strings(TSRMLS_D) q = ce->function_table.arData + j; if (Z_TYPE(q->val) == IS_UNDEF) continue; if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } if (Z_FUNC(q->val)->common.function_name) { - Z_FUNC(q->val)->common.function_name = accel_new_interned_string(Z_FUNC(q->val)->common.function_name TSRMLS_CC); + Z_FUNC(q->val)->common.function_name = accel_new_interned_string(Z_FUNC(q->val)->common.function_name); } } @@ -440,7 +440,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D) q = ce->constants_table.arData + j; if (!Z_TYPE(q->val) == IS_UNDEF) continue; if (q->key) { - q->key = accel_new_interned_string(q->key TSRMLS_CC); + q->key = accel_new_interned_string(q->key); } } } @@ -450,7 +450,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D) p = EG(zend_constants)->arData + idx; if (!Z_TYPE(p->val) == IS_UNDEF) continue; if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } } @@ -463,15 +463,15 @@ static void accel_use_shm_interned_strings(TSRMLS_D) auto_global = (zend_auto_global*)Z_PTR(p->val);; - auto_global->name = accel_new_interned_string(auto_global->name TSRMLS_CC); + auto_global->name = accel_new_interned_string(auto_global->name); if (p->key) { - p->key = accel_new_interned_string(p->key TSRMLS_CC); + p->key = accel_new_interned_string(p->key); } } } #endif -static inline void accel_restart_enter(TSRMLS_D) +static inline void accel_restart_enter(void) { #ifdef ZEND_WIN32 INCREMENT(restart_in); @@ -485,7 +485,7 @@ static inline void accel_restart_enter(TSRMLS_D) ZCSG(restart_in_progress) = 1; } -static inline void accel_restart_leave(TSRMLS_D) +static inline void accel_restart_leave(void) { #ifdef ZEND_WIN32 ZCSG(restart_in_progress) = 0; @@ -500,7 +500,7 @@ static inline void accel_restart_leave(TSRMLS_D) #endif } -static inline int accel_restart_is_active(TSRMLS_D) +static inline int accel_restart_is_active(void) { if (ZCSG(restart_in_progress)) { #ifndef ZEND_WIN32 @@ -524,7 +524,7 @@ static inline int accel_restart_is_active(TSRMLS_D) } /* Creates a read lock for SHM access */ -static inline void accel_activate_add(TSRMLS_D) +static inline void accel_activate_add(void) { #ifdef ZEND_WIN32 INCREMENT(mem_usage); @@ -538,7 +538,7 @@ static inline void accel_activate_add(TSRMLS_D) } /* Releases a lock for SHM access */ -static inline void accel_deactivate_sub(TSRMLS_D) +static inline void accel_deactivate_sub(void) { #ifdef ZEND_WIN32 if (ZCG(counted)) { @@ -554,10 +554,10 @@ static inline void accel_deactivate_sub(TSRMLS_D) #endif } -static inline void accel_unlock_all(TSRMLS_D) +static inline void accel_unlock_all(void) { #ifdef ZEND_WIN32 - accel_deactivate_sub(TSRMLS_C); + accel_deactivate_sub(); #else static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0); @@ -610,7 +610,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check) } #endif -static inline int accel_is_inactive(TSRMLS_D) +static inline int accel_is_inactive(void) { #ifdef ZEND_WIN32 if (LOCKVAL(mem_usage) == 0) { @@ -641,7 +641,7 @@ static inline int accel_is_inactive(TSRMLS_D) return FAILURE; } -static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf TSRMLS_DC) +static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf) { php_stream_wrapper *wrapper; php_stream_statbuf stream_statbuf; @@ -651,7 +651,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf return FAILURE; } - wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC); + wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY); if (!wrapper) { return FAILURE; } @@ -663,7 +663,7 @@ static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf er = EG(error_reporting); EG(error_reporting) = 0; zend_try { - ret = wrapper->wops->url_stat(wrapper, (char*)filename, PHP_STREAM_URL_STAT_QUIET, &stream_statbuf, NULL TSRMLS_CC); + ret = wrapper->wops->url_stat(wrapper, (char*)filename, PHP_STREAM_URL_STAT_QUIET, &stream_statbuf, NULL); } zend_catch { ret = -1; } zend_end_try(); @@ -722,7 +722,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha } #endif -static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size TSRMLS_DC) +static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size) { zend_stat_t statbuf; #ifdef ZEND_WIN32 @@ -733,7 +733,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle !EG(current_execute_data) && file_handle->filename == SG(request_info).path_translated) { - zend_stat_t *tmpbuf = sapi_module.get_stat(TSRMLS_C); + zend_stat_t *tmpbuf = sapi_module.get_stat(); if (tmpbuf) { if (size) { @@ -758,7 +758,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle break; case ZEND_HANDLE_FP: if (zend_fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { - if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { + if (zend_get_stream_timestamp(file_handle->filename, &statbuf) != SUCCESS) { return 0; } } @@ -770,7 +770,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle if (file_path) { if (is_stream_path(file_path)) { - if (zend_get_stream_timestamp(file_path, &statbuf TSRMLS_CC) == SUCCESS) { + if (zend_get_stream_timestamp(file_path, &statbuf) == SUCCESS) { break; } } @@ -779,7 +779,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle } } - if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { + if (zend_get_stream_timestamp(file_handle->filename, &statbuf) != SUCCESS) { return 0; } break; @@ -799,7 +799,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle er = EG(error_reporting); EG(error_reporting) = 0; zend_try { - ret = stream->ops->stat(stream, &sb TSRMLS_CC); + ret = stream->ops->stat(stream, &sb); } zend_catch { ret = -1; } zend_end_try(); @@ -822,7 +822,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle return statbuf.st_mtime; } -static inline int do_validate_timestamps(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) +static inline int do_validate_timestamps(zend_persistent_script *persistent_script, zend_file_handle *file_handle) { zend_file_handle ps_handle; char *full_path_ptr = NULL; @@ -836,7 +836,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri return FAILURE; } } else { - full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename) TSRMLS_CC); + full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename)); if (full_path_ptr && strcmp(persistent_script->full_path->val, full_path_ptr) != 0) { efree(full_path_ptr); return FAILURE; @@ -852,7 +852,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri return FAILURE; } - if (zend_get_file_handle_timestamp(file_handle, NULL TSRMLS_CC) == persistent_script->timestamp) { + if (zend_get_file_handle_timestamp(file_handle, NULL) == persistent_script->timestamp) { if (full_path_ptr) { efree(full_path_ptr); file_handle->opened_path = NULL; @@ -868,19 +868,19 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri ps_handle.filename = persistent_script->full_path->val; ps_handle.opened_path = persistent_script->full_path->val; - if (zend_get_file_handle_timestamp(&ps_handle, NULL TSRMLS_CC) == persistent_script->timestamp) { + if (zend_get_file_handle_timestamp(&ps_handle, NULL) == persistent_script->timestamp) { return SUCCESS; } return FAILURE; } -int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) +int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle) { if (ZCG(accel_directives).revalidate_freq && persistent_script->dynamic_members.revalidate >= ZCG(request_time)) { return SUCCESS; - } else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) { + } else if (do_validate_timestamps(persistent_script, file_handle) == FAILURE) { return FAILURE; } else { persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq; @@ -914,7 +914,7 @@ static unsigned int zend_accel_script_checksum(zend_persistent_script *persisten /* Instead of resolving full real path name each time we need to identify file, * we create a key that consist from requested file name, current working * directory, current include_path, etc */ -char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len TSRMLS_DC) +char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_length, int *key_len) { int key_length; @@ -930,7 +930,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt int cwd_len; char *cwd; - if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) == NULL) { + if ((cwd = accel_getcwd(&cwd_len)) == NULL) { /* we don't handle this well for now. */ zend_accel_error(ACCEL_LOG_INFO, "getcwd() failed for '%s' (%d), please try to set opcache.use_cwd to 0 in ini file", file_handle->filename, errno); if (file_handle->opened_path) { @@ -955,7 +955,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt !zend_accel_hash_is_full(&ZCSG(include_paths))) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); ZCG(include_path_key) = zend_accel_hash_find(&ZCSG(include_paths), ZCG(include_path), ZCG(include_path_len)); if (ZCG(include_path_key)) { @@ -973,11 +973,11 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt include_path = ZCG(include_path_key); include_path_len = 1; } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } @@ -987,7 +987,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt in include path too. */ if (EG(current_execute_data) && - (parent_script = zend_get_executed_filename(TSRMLS_C)) != NULL && + (parent_script = zend_get_executed_filename()) != NULL && parent_script[0] != '[') { parent_script_len = strlen(parent_script); @@ -1040,21 +1040,21 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt return ZCG(key); } -static inline char *accel_make_persistent_key(zend_file_handle *file_handle, int *key_len TSRMLS_DC) +static inline char *accel_make_persistent_key(zend_file_handle *file_handle, int *key_len) { - return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len TSRMLS_CC); + return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len); } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC) +int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force) { char *realpath; zend_persistent_script *persistent_script; - if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock(TSRMLS_C) != SUCCESS) { + if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) { return FAILURE; } - realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + realpath = accelerator_orig_zend_resolve_path(filename, filename_len); if (!realpath) { return FAILURE; @@ -1070,9 +1070,9 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc if (force || !ZCG(accel_directives).validate_timestamps || - do_validate_timestamps(persistent_script, &file_handle TSRMLS_CC) == FAILURE) { + do_validate_timestamps(persistent_script, &file_handle) == FAILURE) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1080,28 +1080,28 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } - accelerator_shm_read_unlock(TSRMLS_C); + accelerator_shm_read_unlock(); efree(realpath); return SUCCESS; } /* Adds another key for existing cached script */ -static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_hash_entry *bucket TSRMLS_DC) +static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_hash_entry *bucket) { if (!zend_accel_hash_find(&ZCSG(hash), key, key_length)) { if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); } else { char *new_key = zend_shared_alloc(key_length + 1); if (new_key) { @@ -1110,13 +1110,13 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", new_key); } } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } } } } -static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length, int *from_shared_memory TSRMLS_DC) +static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length, int *from_shared_memory) { zend_accel_hash_entry *bucket; uint memory_used; @@ -1126,18 +1126,18 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr return new_persistent_script; } - if (!zend_accel_script_optimize(new_persistent_script TSRMLS_CC)) { + if (!zend_accel_script_optimize(new_persistent_script)) { return new_persistent_script; } /* exclusive lock */ - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); + zend_shared_alloc_unlock(); return new_persistent_script; } @@ -1152,26 +1152,26 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr if (!ZCG(accel_directives).revalidate_path && (!ZCG(accel_directives).validate_timestamps || (new_persistent_script->timestamp == existing_persistent_script->timestamp))) { - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); + zend_accel_add_key(key, key_length, bucket); } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); return new_persistent_script; } } /* Calculate the required memory size */ - memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length TSRMLS_CC); + memory_used = zend_accel_script_persist_calc(new_persistent_script, key, key_length); /* Allocate shared memory */ ZCG(mem) = zend_shared_alloc(memory_used); if (!ZCG(mem)) { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); + zend_shared_alloc_unlock(); return new_persistent_script; } /* Copy into shared memory */ - new_persistent_script = zend_accel_script_persist(new_persistent_script, &key, key_length TSRMLS_CC); + new_persistent_script = zend_accel_script_persist(new_persistent_script, &key, key_length); /* Consistency check */ if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) { @@ -1201,14 +1201,14 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr } else { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH); } } } new_persistent_script->dynamic_members.memory_consumption = ZEND_ALIGNED_SIZE(new_persistent_script->size); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); *from_shared_memory = 1; return new_persistent_script; @@ -1227,7 +1227,7 @@ static const struct jit_auto_global_info static zend_string *jit_auto_globals_str[4]; -static int zend_accel_get_auto_globals(TSRMLS_D) +static int zend_accel_get_auto_globals(void) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); int n = 1; @@ -1242,7 +1242,7 @@ static int zend_accel_get_auto_globals(TSRMLS_D) return mask; } -static int zend_accel_get_auto_globals_no_jit(TSRMLS_D) +static int zend_accel_get_auto_globals_no_jit(void) { if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[3])) { return 8; @@ -1250,7 +1250,7 @@ static int zend_accel_get_auto_globals_no_jit(TSRMLS_D) return 0; } -static void zend_accel_set_auto_globals(int mask TSRMLS_DC) +static void zend_accel_set_auto_globals(int mask) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); int n = 1; @@ -1258,24 +1258,24 @@ static void zend_accel_set_auto_globals(int mask TSRMLS_DC) for (i = 0; i < ag_size ; i++) { if ((mask & n) && !(ZCG(auto_globals_mask) & n)) { ZCG(auto_globals_mask) |= n; - zend_is_auto_global(jit_auto_globals_str[i] TSRMLS_CC); + zend_is_auto_global(jit_auto_globals_str[i]); } n += n; } } -static void zend_accel_init_auto_globals(TSRMLS_D) +static void zend_accel_init_auto_globals(void) { int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); for (i = 0; i < ag_size ; i++) { jit_auto_globals_str[i] = zend_string_init(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1); zend_string_hash_val(jit_auto_globals_str[i]); - jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i] TSRMLS_CC); + jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i]); } } -static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_handle, int type, char *key, unsigned int key_length, zend_op_array **op_array_p, int *from_shared_memory TSRMLS_DC) +static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_handle, int type, char *key, unsigned int key_length, zend_op_array **op_array_p, int *from_shared_memory) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1288,7 +1288,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Try to open file */ if (file_handle->type == ZEND_HANDLE_FILENAME) { - if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle TSRMLS_CC) == SUCCESS) { + if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == SUCCESS) { /* key may be changed by zend_stream_open_function() */ if (key == ZCG(key)) { key_length = ZCG(key_len); @@ -1296,10 +1296,10 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } else { *op_array_p = NULL; if (type == ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } return NULL; } @@ -1308,7 +1308,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* check blacklist right after ensuring that file was opened */ if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, file_handle->opened_path)) { ZCSG(blacklist_misses)++; - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } @@ -1321,7 +1321,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Stream callbacks needs to be called in context of original * function and class tables (see: https://bugs.php.net/bug.php?id=64353) */ - if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) { + if (zend_stream_fixup(file_handle, &buf, &size) == FAILURE) { *op_array_p = NULL; return NULL; } @@ -1335,26 +1335,26 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Obtain the file timestamps, *before* actually compiling them, * otherwise we have a race-condition. */ - timestamp = zend_get_file_handle_timestamp(file_handle, ZCG(accel_directives).max_file_size > 0 ? &size : NULL TSRMLS_CC); + timestamp = zend_get_file_handle_timestamp(file_handle, ZCG(accel_directives).max_file_size > 0 ? &size : NULL); /* If we can't obtain a timestamp (that means file is possibly socket) * we won't cache it */ if (timestamp == 0) { - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } /* check if file is too new (may be it's not written completely yet) */ if (ZCG(accel_directives).file_update_protection && (ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) { - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } if (ZCG(accel_directives).max_file_size > 0 && size > (size_t)ZCG(accel_directives).max_file_size) { ZCSG(blacklist_misses)++; - *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } } @@ -1378,7 +1378,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES; CG(compiler_options) |= ZEND_COMPILE_DELAYED_BINDING; CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION; - op_array = *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + op_array = *op_array_p = accelerator_orig_compile_file(file_handle, type); CG(compiler_options) = orig_compiler_options; } zend_catch { op_array = NULL; @@ -1395,7 +1395,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han if (!op_array) { /* compilation failed */ free_persistent_script(new_persistent_script, 1); - zend_accel_free_user_functions(&ZCG(function_table) TSRMLS_CC); + zend_accel_free_user_functions(&ZCG(function_table)); if (do_bailout) { zend_bailout(); } @@ -1406,7 +1406,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han Here we aren't sure we would store it, but we will need it further anyway. */ - zend_accel_move_user_functions(&ZCG(function_table), &new_persistent_script->function_table TSRMLS_CC); + zend_accel_move_user_functions(&ZCG(function_table), &new_persistent_script->function_table); new_persistent_script->main_op_array = *op_array; efree(op_array); /* we have valid persistent_script, so it's safe to free op_array */ @@ -1414,9 +1414,9 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han /* Fill in the ping_auto_globals_mask for the new script. If jit for auto globals is enabled we will have to ping the used auto global variables before execution */ if (PG(auto_globals_jit)) { - new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(TSRMLS_C); + new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals(); } else { - new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit(TSRMLS_C); + new_persistent_script->ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit(); } if (ZCG(accel_directives).validate_timestamps) { @@ -1435,11 +1435,11 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han zend_string_hash_val(new_persistent_script->full_path); /* Now persistent_script structure is ready in process memory */ - return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory TSRMLS_CC); + return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory); } /* zend_compile() replacement */ -zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) +zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) { zend_persistent_script *persistent_script = NULL; char *key = NULL; @@ -1449,11 +1449,11 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (!file_handle->filename || !ZCG(enabled) || !accel_startup_ok || (!ZCG(counted) && !ZCSG(accelerator_enabled)) || - (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) || + (ZCSG(restart_in_progress) && accel_restart_is_active()) || (is_stream_path(file_handle->filename) && !is_cacheable_stream_path(file_handle->filename))) { /* The Accelerator is disabled, act as if without the Accelerator */ - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* Make sure we only increase the currently running processes semaphore @@ -1462,7 +1462,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T */ if (!ZCG(counted)) { ZCG(counted) = 1; - accel_activate_add(TSRMLS_C); + accel_activate_add(); } /* In case this callback is called from include_once, require_once or it's @@ -1480,7 +1480,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T (EG(current_execute_data)->opline->extended_value == ZEND_INCLUDE_ONCE || EG(current_execute_data)->opline->extended_value == ZEND_REQUIRE_ONCE))) { if (!ZCG(key_len)) { - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* persistent script was already found by overridden open() or * resolve_path() callbacks */ @@ -1489,8 +1489,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T key_length = ZCG(key_len); } else { /* try to find cached script by key */ - if ((key = accel_make_persistent_key(file_handle, &key_length TSRMLS_CC)) == NULL) { - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + if ((key = accel_make_persistent_key(file_handle, &key_length)) == NULL) { + return accelerator_orig_compile_file(file_handle, type); } persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length); if (!persistent_script) { @@ -1499,12 +1499,12 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* open file to resolve the path */ if (file_handle->type == ZEND_HANDLE_FILENAME && - accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) { + accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == FAILURE) { if (type == ZEND_REQUIRE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); zend_bailout(); } else { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); } return NULL; } @@ -1516,9 +1516,9 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (!ZCG(accel_directives).revalidate_path && !persistent_script->corrupted) { SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_lock(); + zend_accel_add_key(key, key_length, bucket); + zend_shared_alloc_unlock(); SHM_PROTECT(); } } @@ -1537,8 +1537,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* If script is found then validate_timestamps if option is enabled */ if (persistent_script && ZCG(accel_directives).validate_timestamps) { - if (validate_timestamp_and_record(persistent_script, file_handle TSRMLS_CC) == FAILURE) { - zend_shared_alloc_lock(TSRMLS_C); + if (validate_timestamp_and_record(persistent_script, file_handle) == FAILURE) { + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1546,10 +1546,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); persistent_script = NULL; } } @@ -1563,7 +1563,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* The checksum is wrong */ zend_accel_error(ACCEL_LOG_INFO, "Checksum failed for '%s': expected=0x%0.8X, found=0x%0.8X", persistent_script->full_path, persistent_script->dynamic_members.checksum, checksum); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (!persistent_script->corrupted) { persistent_script->corrupted = 1; persistent_script->timestamp = 0; @@ -1571,10 +1571,10 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T if (ZSMMG(memory_exhausted)) { zend_accel_restart_reason reason = zend_accel_hash_is_full(&ZCSG(hash)) ? ACCEL_RESTART_HASH : ACCEL_RESTART_OOM; - zend_accel_schedule_restart_if_necessary(reason TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(reason); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); persistent_script = NULL; } } @@ -1590,14 +1590,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* No memory left. Behave like without the Accelerator */ if (ZSMMG(memory_exhausted) || ZCSG(restart_pending)) { SHM_PROTECT(); - return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return accelerator_orig_compile_file(file_handle, type); } /* Try and cache the script and assume that it is returned from_shared_memory. * If it isn't compile_and_cache_file() changes the flag to 0 */ from_shared_memory = 0; - persistent_script = compile_and_cache_file(file_handle, type, key, key_length, &op_array, &from_shared_memory TSRMLS_CC); + persistent_script = compile_and_cache_file(file_handle, type, key, key_length, &op_array, &from_shared_memory); /* Caching is disabled, returning op_array; * or something went wrong during compilation, returning NULL @@ -1646,7 +1646,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T } } } - zend_file_handle_dtor(file_handle TSRMLS_CC); + zend_file_handle_dtor(file_handle); from_shared_memory = 1; } @@ -1656,14 +1656,14 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T /* Fetch jit auto globals used in the script before execution */ if (persistent_script->ping_auto_globals_mask) { - zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask TSRMLS_CC); + zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask); } - return zend_accel_load_script(persistent_script, from_shared_memory TSRMLS_CC); + return zend_accel_load_script(persistent_script, from_shared_memory); } /* zend_stream_open_function() replacement for PHP 5.3 and above */ -static int persistent_stream_open_function(const char *filename, zend_file_handle *handle TSRMLS_DC) +static int persistent_stream_open_function(const char *filename, zend_file_handle *handle) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && @@ -1718,11 +1718,11 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl } ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; - return accelerator_orig_zend_stream_open_function(filename, handle TSRMLS_CC); + return accelerator_orig_zend_stream_open_function(filename, handle); } /* zend_resolve_path() replacement for PHP 5.3 and above */ -static char* persistent_zend_resolve_path(const char *filename, int filename_len TSRMLS_DC) +static char* persistent_zend_resolve_path(const char *filename, int filename_len) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && @@ -1763,7 +1763,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len handle.filename = (char*)filename; handle.free_filename = 0; handle.opened_path = NULL; - key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC); + key = accel_make_persistent_key_ex(&handle, filename_len, &key_length); if (!ZCG(accel_directives).revalidate_path && key && (persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length)) != NULL && @@ -1776,7 +1776,7 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len } /* find the full real path */ - resolved_path = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + resolved_path = accelerator_orig_zend_resolve_path(filename, filename_len); /* Check if requested file already cached (by real path) */ if (resolved_path && @@ -1787,9 +1787,9 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len if (key && !ZCG(accel_directives).revalidate_path) { /* add another "key" for the same bucket */ SHM_UNPROTECT(); - zend_shared_alloc_lock(TSRMLS_C); - zend_accel_add_key(key, key_length, bucket TSRMLS_CC); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_lock(); + zend_accel_add_key(key, key_length, bucket); + zend_shared_alloc_unlock(); SHM_PROTECT(); } ZCG(cache_opline) = (EG(current_execute_data) && key) ? EG(current_execute_data)->opline : NULL; @@ -1804,10 +1804,10 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len } ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; - return accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC); + return accelerator_orig_zend_resolve_path(filename, filename_len); } -static void zend_reset_cache_vars(TSRMLS_D) +static void zend_reset_cache_vars(void) { ZSMMG(memory_exhausted) = 0; ZCSG(hits) = 0; @@ -1820,7 +1820,6 @@ static void zend_reset_cache_vars(TSRMLS_D) static void accel_activate(void) { - TSRMLS_FETCH(); if (!ZCG(enabled) || !accel_startup_ok) { return; @@ -1829,7 +1828,7 @@ static void accel_activate(void) SHM_UNPROTECT(); /* PHP-5.4 and above return "double", but we use 1 sec precision */ ZCG(auto_globals_mask) = 0; - ZCG(request_time) = (time_t)sapi_get_request_time(TSRMLS_C); + ZCG(request_time) = (time_t)sapi_get_request_time(); ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; ZCG(include_path_check) = !ZCG(include_path_key); @@ -1840,14 +1839,14 @@ static void accel_activate(void) #else zend_accel_error(ACCEL_LOG_WARNING, "Stuck count for pid %d", getpid()); #endif - accel_unlock_all(TSRMLS_C); + accel_unlock_all(); ZCG(counted) = 0; } if (ZCSG(restart_pending)) { - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); if (ZCSG(restart_pending) != 0) { /* check again, to ensure that the cache wasn't already cleaned by another process */ - if (accel_is_inactive(TSRMLS_C) == SUCCESS) { + if (accel_is_inactive() == SUCCESS) { zend_accel_error(ACCEL_LOG_DEBUG, "Restarting!"); ZCSG(restart_pending) = 0; switch ZCSG(restart_reason) { @@ -1861,9 +1860,9 @@ static void accel_activate(void) ZCSG(manual_restarts)++; break; } - accel_restart_enter(TSRMLS_C); + accel_restart_enter(); - zend_reset_cache_vars(TSRMLS_C); + zend_reset_cache_vars(); zend_accel_hash_clean(&ZCSG(hash)); /* include_paths keeps only the first path */ @@ -1876,17 +1875,17 @@ static void accel_activate(void) #if !defined(ZTS) if (ZCG(accel_directives).interned_strings_buffer) { - accel_interned_strings_restore_state(TSRMLS_C); + accel_interned_strings_restore_state(); } #endif zend_shared_alloc_restore_state(); ZCSG(accelerator_enabled) = ZCSG(cache_status_before_restart); ZCSG(last_restart_time) = ZCG(request_time); - accel_restart_leave(TSRMLS_C); + accel_restart_leave(); } } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); } /* check if ZCG(function_table) wasn't somehow polluted on the way */ @@ -1926,8 +1925,7 @@ static void accel_fast_zval_dtor(zval *zvalue) if (Z_REFCOUNTED_P(zvalue) && Z_DELREF_P(zvalue) == 0) { switch (Z_TYPE_P(zvalue)) { case IS_ARRAY: { - TSRMLS_FETCH(); - GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue)); + GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue)); if (Z_ARR_P(zvalue) != &EG(symbol_table)) { /* break possible cycles */ ZVAL_NULL(zvalue); @@ -1937,15 +1935,13 @@ static void accel_fast_zval_dtor(zval *zvalue) break; case IS_OBJECT: { - TSRMLS_FETCH(); - + OBJ_RELEASE(Z_OBJ_P(zvalue)); } break; case IS_RESOURCE: { - TSRMLS_FETCH(); - + /* destroy resource */ zend_list_delete(Z_RES_P(zvalue)); } @@ -1964,7 +1960,7 @@ static void accel_fast_zval_dtor(zval *zvalue) } } -static int accel_clean_non_persistent_function(zval *zv TSRMLS_DC) +static int accel_clean_non_persistent_function(zval *zv) { zend_function *function = Z_PTR_P(zv); @@ -1998,7 +1994,7 @@ static inline void zend_accel_fast_del_bucket(HashTable *ht, uint32_t idx, Bucke } } -static void zend_accel_fast_shutdown(TSRMLS_D) +static void zend_accel_fast_shutdown(void) { if (EG(full_tables_cleanup)) { EG(symbol_table).ht.pDestructor = accel_fast_zval_dtor; @@ -2081,19 +2077,18 @@ static void accel_deactivate(void) * In general, they're restored by persistent_compile_file(), but in case * the script is aborted abnormally, they may become messed up. */ - TSRMLS_FETCH(); if (!ZCG(enabled) || !accel_startup_ok) { return; } - zend_shared_alloc_safe_unlock(TSRMLS_C); /* be sure we didn't leave cache locked */ - accel_unlock_all(TSRMLS_C); + zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */ + accel_unlock_all(); ZCG(counted) = 0; #if !ZEND_DEBUG if (ZCG(accel_directives).fast_shutdown) { - zend_accel_fast_shutdown(TSRMLS_C); + zend_accel_fast_shutdown(); } #endif @@ -2127,7 +2122,7 @@ static int accelerator_remove_cb(zend_extension *element1, zend_extension *eleme return 0; } -static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_extension *, zend_extension *) TSRMLS_DC) +static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_extension *, zend_extension *)) { accel_startup_ok = 0; zps_failure_reason = reason; @@ -2135,7 +2130,7 @@ static void zps_startup_failure(char *reason, char *api_reason, int (*cb)(zend_e zend_llist_del_element(&zend_extensions, NULL, (int (*)(void *, void *))cb); } -static inline int accel_find_sapi(TSRMLS_D) +static inline int accel_find_sapi(void) { static const char *supported_sapis[] = { "apache", @@ -2166,9 +2161,9 @@ static inline int accel_find_sapi(TSRMLS_D) return FAILURE; } -static int zend_accel_init_shm(TSRMLS_D) +static int zend_accel_init_shm(void) { - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals)); if (!accel_shared_globals) { @@ -2212,12 +2207,12 @@ static int zend_accel_init_shm(TSRMLS_D) # ifndef ZTS if (ZCG(accel_directives).interned_strings_buffer) { - accel_use_shm_interned_strings(TSRMLS_C); - accel_interned_strings_save_state(TSRMLS_C); + accel_use_shm_interned_strings(); + accel_interned_strings_save_state(); } # endif - zend_reset_cache_vars(TSRMLS_C); + zend_reset_cache_vars(); ZCSG(oom_restarts) = 0; ZCSG(hash_restarts) = 0; @@ -2228,19 +2223,19 @@ static int zend_accel_init_shm(TSRMLS_D) ZCSG(last_restart_time) = 0; ZCSG(restart_in_progress) = 0; - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); return SUCCESS; } -static void accel_globals_ctor(zend_accel_globals *accel_globals TSRMLS_DC) +static void accel_globals_ctor(zend_accel_globals *accel_globals) { #if defined(COMPILE_DL_OPCACHE) && defined(ZTS) ZEND_TSRMLS_CACHE_UPDATE; #endif memset(accel_globals, 0, sizeof(zend_accel_globals)); zend_hash_init(&accel_globals->function_table, zend_hash_num_elements(CG(function_table)), NULL, ZEND_FUNCTION_DTOR, 1); - zend_accel_copy_internal_functions(TSRMLS_C); + zend_accel_copy_internal_functions(); } static void accel_globals_internal_func_dtor(zval *zv) @@ -2248,7 +2243,7 @@ static void accel_globals_internal_func_dtor(zval *zv) free(Z_PTR_P(zv)); } -static void accel_globals_dtor(zend_accel_globals *accel_globals TSRMLS_DC) +static void accel_globals_dtor(zend_accel_globals *accel_globals) { accel_globals->function_table.pDestructor = accel_globals_internal_func_dtor; zend_hash_destroy(&accel_globals->function_table); @@ -2258,7 +2253,6 @@ static int accel_startup(zend_extension *extension) { zend_function *func; zend_ini_entry *ini_entry; - TSRMLS_FETCH(); #ifdef ZTS accel_globals_id = ts_allocate_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor); @@ -2270,20 +2264,20 @@ static int accel_startup(zend_extension *extension) _setmaxstdio(2048); /* The default configuration is limited to 512 stdio files */ #endif - if (start_accel_module(TSRMLS_C) == FAILURE) { + if (start_accel_module() == FAILURE) { accel_startup_ok = 0; zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!"); return FAILURE; } /* no supported SAPI found - disable acceleration and stop initialization */ - if (accel_find_sapi(TSRMLS_C) == FAILURE) { + if (accel_find_sapi() == FAILURE) { accel_startup_ok = 0; if (!ZCG(accel_directives).enable_cli && strcmp(sapi_module.name, "cli") == 0) { - zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb TSRMLS_CC); + zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb); } else { - zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); + zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb); } return SUCCESS; } @@ -2296,7 +2290,7 @@ static int accel_startup(zend_extension *extension) /********************************************/ switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) { case ALLOC_SUCCESS: - if (zend_accel_init_shm(TSRMLS_C) == FAILURE) { + if (zend_accel_init_shm() == FAILURE) { accel_startup_ok = 0; return FAILURE; } @@ -2307,7 +2301,7 @@ static int accel_startup(zend_extension *extension) return SUCCESS; case SUCCESSFULLY_REATTACHED: accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals); - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); orig_new_interned_string = zend_new_interned_string; orig_interned_strings_snapshot = zend_interned_strings_snapshot; orig_interned_strings_restore = zend_interned_strings_restore; @@ -2316,9 +2310,9 @@ static int accel_startup(zend_extension *extension) zend_interned_strings_snapshot = accel_interned_strings_snapshot_for_php; zend_interned_strings_restore = accel_interned_strings_restore_for_php; #ifndef ZTS - accel_use_shm_interned_strings(TSRMLS_C); + accel_use_shm_interned_strings(); #endif - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); break; case FAILED_REATTACHED: accel_startup_ok = 0; @@ -2330,7 +2324,7 @@ static int accel_startup(zend_extension *extension) /* from this point further, shared memory is supposed to be OK */ /* Init auto-global strings */ - zend_accel_init_auto_globals(TSRMLS_C); + zend_accel_init_auto_globals(); /* Override compiler */ accelerator_orig_compile_file = zend_compile_file; @@ -2365,7 +2359,7 @@ static int accel_startup(zend_extension *extension) !zend_accel_hash_is_full(&ZCSG(include_paths))) { char *key; - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); key = zend_shared_alloc(ZCG(include_path_len) + 2); if (key) { memcpy(key, ZCG(include_path), ZCG(include_path_len) + 1); @@ -2373,9 +2367,9 @@ static int accel_startup(zend_extension *extension) ZCG(include_path_key) = key + ZCG(include_path_len) + 1; zend_accel_hash_update(&ZCSG(include_paths), key, ZCG(include_path_len), 0, ZCG(include_path_key)); } else { - zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC); + zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM); } - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); } } else { ZCG(include_path) = ""; @@ -2385,16 +2379,16 @@ static int accel_startup(zend_extension *extension) ini_entry->on_modify = accel_include_path_on_modify; } - zend_shared_alloc_lock(TSRMLS_C); + zend_shared_alloc_lock(); zend_shared_alloc_save_state(); - zend_shared_alloc_unlock(TSRMLS_C); + zend_shared_alloc_unlock(); SHM_PROTECT(); accel_startup_ok = 1; /* Override file_exists(), is_file() and is_readable() */ - zend_accel_override_file_functions(TSRMLS_C); + zend_accel_override_file_functions(); /* Load black list */ accel_blacklist.entries = NULL; @@ -2407,7 +2401,7 @@ static int accel_startup(zend_extension *extension) #if 0 /* FIXME: We probably don't need it here */ - zend_accel_copy_internal_functions(TSRMLS_C); + zend_accel_copy_internal_functions(); #endif return SUCCESS; @@ -2422,7 +2416,7 @@ static void accel_free_ts_resources() #endif } -void accel_shutdown(TSRMLS_D) +void accel_shutdown(void) { zend_ini_entry *ini_entry; @@ -2455,7 +2449,7 @@ void accel_shutdown(TSRMLS_D) } } -void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) +void zend_accel_schedule_restart(zend_accel_restart_reason reason) { if (ZCSG(restart_pending)) { /* don't schedule twice */ @@ -2479,9 +2473,9 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) /* this is needed because on WIN32 lock is not decreased unless ZCG(counted) is set */ #ifdef ZEND_WIN32 -#define accel_deactivate_now() ZCG(counted) = 1; accel_deactivate_sub(TSRMLS_C) +#define accel_deactivate_now() ZCG(counted) = 1; accel_deactivate_sub() #else -#define accel_deactivate_now() accel_deactivate_sub(TSRMLS_C) +#define accel_deactivate_now() accel_deactivate_sub() #endif /* ensures it is OK to read SHM @@ -2489,7 +2483,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC) if OK returns SUCCESS MUST call accelerator_shm_read_unlock after done lock operations */ -int accelerator_shm_read_lock(TSRMLS_D) +int accelerator_shm_read_lock(void) { if (ZCG(counted)) { /* counted means we are holding read lock for SHM, so that nothing bad can happen */ @@ -2497,7 +2491,7 @@ int accelerator_shm_read_lock(TSRMLS_D) } else { /* here accelerator is active but we do not hold SHM lock. This means restart was scheduled or is in progress now */ - accel_activate_add(TSRMLS_C); /* acquire usage lock */ + accel_activate_add(); /* acquire usage lock */ /* Now if we weren't inside restart, restart would not begin until we remove usage lock */ if (ZCSG(restart_in_progress)) { /* we already were inside restart this means it's not safe to touch shm */ @@ -2509,7 +2503,7 @@ int accelerator_shm_read_lock(TSRMLS_D) } /* must be called ONLY after SUCCESSFUL accelerator_shm_read_lock */ -void accelerator_shm_read_unlock(TSRMLS_D) +void accelerator_shm_read_unlock(void) { if (!ZCG(counted)) { /* counted is 0 - meaning we had to readlock manually, release readlock now */ |