com php-src: finer fixes for ext/opcache: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_ module.c
ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_accelerator_util_funcs.h ext/opca che/zend_persist_calc.c
| From: | Anatol Belski | Date: | Wed, 04 Dec 2013 13:07:27 +0000 |
| Subject: | com php-src: finer fixes for ext/opcache: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_ module.c ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_accelerator_util_funcs.h ext/opca che/zend_persist_calc.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74238@lists.php.net to get a copy of this message | ||
Commit: 3142989a1469447163ba0c4e10db483b45c55c63
Author: Anatol Belski <ab@php.net> Wed, 4 Dec 2013 14:07:27 +0100
Parents: 3930766e796ce73ead9c006ddc075d9bad0229ba
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3142989a1469447163ba0c4e10db483b45c55c63
Log:
finer fixes for ext/opcache
Changed paths:
M ext/opcache/ZendAccelerator.c
M ext/opcache/ZendAccelerator.h
M ext/opcache/zend_accelerator_module.c
M ext/opcache/zend_accelerator_util_funcs.c
M ext/opcache/zend_accelerator_util_funcs.h
M ext/opcache/zend_persist_calc.c
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index c40e886..7ccf045 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -167,7 +167,7 @@ static ZEND_FUNCTION(accel_chdir) } } -static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) +static inline char* accel_getcwd(zend_str_size_int *cwd_len TSRMLS_DC) { if (ZCG(cwd)) { *cwd_len = ZCG(cwd_len); @@ -916,20 +916,20 @@ 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, zend_str_size_int path_length, zend_str_size_int *key_len TSRMLS_DC) { - int key_length; + zend_str_size_int key_length; /* CWD and include_path don't matter for absolute file names and streams */ if (ZCG(accel_directives).use_cwd && !IS_ABSOLUTE_PATH(file_handle->filename, path_length) && !is_stream_path(file_handle->filename)) { char *include_path = NULL; - int include_path_len = 0; + zend_str_size_int include_path_len = 0; const char *parent_script = NULL; - int parent_script_len = 0; - int cur_len = 0; - int cwd_len; + zend_str_size_int parent_script_len = 0; + zend_str_size_int cur_len = 0; + zend_str_size_int cwd_len; char *cwd; if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) == NULL) { @@ -1042,12 +1042,12 @@ 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, zend_str_size_int *key_len TSRMLS_DC) { return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len TSRMLS_CC); } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC) +int zend_accel_invalidate(const char *filename, zend_str_size_int filename_len, zend_bool force TSRMLS_DC) { char *realpath; zend_persistent_script *persistent_script; @@ -1101,7 +1101,7 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc } /* 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, zend_str_size_uint key_length, zend_accel_hash_entry *bucket TSRMLS_DC) { if (!zend_accel_hash_find(&ZCSG(hash), key, key_length + 1)) { if (zend_accel_hash_is_full(&ZCSG(hash))) { @@ -1120,7 +1120,7 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha } } -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, zend_str_size_uint key_length, int *from_shared_memory TSRMLS_DC) { zend_accel_hash_entry *bucket; uint memory_used; @@ -1271,7 +1271,7 @@ static void zend_accel_set_auto_globals(int mask 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 TSRMLS_DC) +static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_handle, int type, char *key, zend_str_size_uint key_length, zend_op_array **op_array_p, int *from_shared_memory TSRMLS_DC) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1465,7 +1465,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T { zend_persistent_script *persistent_script = NULL; char *key = NULL; - int key_length; + zend_str_size_int key_length; int from_shared_memory; /* if the script we've got is stored in SHM */ if (!file_handle->filename || @@ -1995,7 +1995,7 @@ static char* persistent_zend_resolve_path(const char *filename, zend_str_size_in /* we are in include_once or FastCGI request */ zend_file_handle handle; char *key = NULL; - int key_length; + zend_str_size_int key_length; char *resolved_path; zend_accel_hash_entry *bucket; zend_persistent_script *persistent_script; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 57f3047..94225a3 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -203,7 +203,11 @@ typedef struct _zend_persistent_script { */ struct zend_persistent_script_dynamic_members { time_t last_used; - zend_uint_t hits; +#ifndef ZEND_WIN32 + zend_uint_t hits; +#else + LONG hits; +#endif unsigned int memory_consumption; unsigned int checksum; time_t revalidate; @@ -256,10 +260,10 @@ typedef struct _zend_accel_globals { HashTable bind_hash; /* prototype and zval lookup table */ zend_accel_directives accel_directives; char *cwd; /* current working directory or NULL */ - int cwd_len; /* "cwd" string length */ + zend_str_size_int cwd_len; /* "cwd" string length */ char *include_path_key; /* one letter key of current "include_path" */ char *include_path; /* current section of "include_path" directive */ - int include_path_len; /* "include_path" string length */ + zend_str_size_int include_path_len; /* "include_path" string length */ int include_path_check; time_t request_time; /* preallocated shared-memory block to save current script */ @@ -268,13 +272,17 @@ typedef struct _zend_accel_globals { zend_op *cache_opline; zend_persistent_script *cache_persistent_script; /* preallocated buffer for keys */ - int key_len; + zend_str_size_int key_len; char key[MAXPATHLEN * 8]; } zend_accel_globals; typedef struct _zend_accel_shared_globals { /* Cache Data Structures */ - zend_uint_t hits; +#ifndef ZEND_WIN32 + zend_uint_t hits; +#else + LONG hits; +#endif zend_uint_t misses; zend_uint_t blacklist_misses; zend_uint_t oom_restarts; /* number of restarts because of out of memory */ @@ -292,8 +300,8 @@ typedef struct _zend_accel_shared_globals { zend_accel_restart_reason restart_reason; zend_bool cache_status_before_restart; #ifdef ZEND_WIN32 - zend_uint_t mem_usage; - zend_uint_t restart_in; + LONG mem_usage; + LONG restart_in; #endif zend_bool restart_in_progress; time_t revalidate_at; @@ -330,12 +338,12 @@ extern char *zps_api_failure_reason; void accel_shutdown(TSRMLS_D); void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC); +int zend_accel_invalidate(const char *filename, zend_str_size_int filename_len, zend_bool force TSRMLS_DC); int zend_accel_script_optimize(zend_persistent_script *persistent_script TSRMLS_DC); int accelerator_shm_read_lock(TSRMLS_D); void accelerator_shm_read_unlock(TSRMLS_D); -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, zend_str_size_int path_length, zend_str_size_int *key_len TSRMLS_DC); zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); #if !defined(ZEND_DECLARE_INHERITED_CLASS_DELAYED) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 4303406..2b98c3d 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -300,10 +300,10 @@ static int ZEND_DECLARE_INHERITED_CLASS_DELAYED_HANDLER(ZEND_OPCODE_HANDLER_ARGS } #endif -static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) +static int filename_is_in_cache(char *filename, zend_str_size_int filename_len TSRMLS_DC) { char *key; - int key_length; + zend_str_size_int key_length; zend_file_handle handle = {0}; zend_persistent_script *persistent_script; diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 694cf29..0059b45 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -1016,7 +1016,8 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, persistent_script->full_path) { char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; - int len, clen; + zend_str_size_int len; + int clen; cfilename = persistent_script->full_path; clen = strlen(cfilename); diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index b82499d..ddaae86 100644 --- a/ext/opcache/zend_accelerator_util_funcs.h +++ b/ext/opcache/zend_accelerator_util_funcs.h @@ -38,7 +38,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, #define ADLER32_INIT 1 /* initial Adler-32 value */ -unsigned int zend_adler32(unsigned int checksum, signed char *buf, zend_str_size_uint len); +unsigned int zend_adler32(unsigned int checksum, signed char *buf, uint len); #endif /* ZEND_ACCELERATOR_UTIL_FUNCS_H */ diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index e290a39..c721938 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -355,7 +355,7 @@ static uint zend_accel_persist_class_table_calc(HashTable *class_table TSRMLS_DC return zend_hash_persist_calc(class_table, (int (*)(void* TSRMLS_DC)) zend_persist_class_entry_calc, sizeof(zend_class_entry*) TSRMLS_CC); } -uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length TSRMLS_DC) +uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, zend_str_size_uint key_length TSRMLS_DC) { START_SIZE();
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index c40e886..7ccf045 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -167,7 +167,7 @@ static ZEND_FUNCTION(accel_chdir) } } -static inline char* accel_getcwd(int *cwd_len TSRMLS_DC) +static inline char* accel_getcwd(zend_str_size_int *cwd_len TSRMLS_DC) { if (ZCG(cwd)) { *cwd_len = ZCG(cwd_len); @@ -916,20 +916,20 @@ 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, zend_str_size_int path_length, zend_str_size_int *key_len TSRMLS_DC) { - int key_length; + zend_str_size_int key_length; /* CWD and include_path don't matter for absolute file names and streams */ if (ZCG(accel_directives).use_cwd && !IS_ABSOLUTE_PATH(file_handle->filename, path_length) && !is_stream_path(file_handle->filename)) { char *include_path = NULL; - int include_path_len = 0; + zend_str_size_int include_path_len = 0; const char *parent_script = NULL; - int parent_script_len = 0; - int cur_len = 0; - int cwd_len; + zend_str_size_int parent_script_len = 0; + zend_str_size_int cur_len = 0; + zend_str_size_int cwd_len; char *cwd; if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) == NULL) { @@ -1042,12 +1042,12 @@ 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, zend_str_size_int *key_len TSRMLS_DC) { return accel_make_persistent_key_ex(file_handle, strlen(file_handle->filename), key_len TSRMLS_CC); } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC) +int zend_accel_invalidate(const char *filename, zend_str_size_int filename_len, zend_bool force TSRMLS_DC) { char *realpath; zend_persistent_script *persistent_script; @@ -1101,7 +1101,7 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc } /* 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, zend_str_size_uint key_length, zend_accel_hash_entry *bucket TSRMLS_DC) { if (!zend_accel_hash_find(&ZCSG(hash), key, key_length + 1)) { if (zend_accel_hash_is_full(&ZCSG(hash))) { @@ -1120,7 +1120,7 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha } } -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, zend_str_size_uint key_length, int *from_shared_memory TSRMLS_DC) { zend_accel_hash_entry *bucket; uint memory_used; @@ -1271,7 +1271,7 @@ static void zend_accel_set_auto_globals(int mask 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 TSRMLS_DC) +static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_handle, int type, char *key, zend_str_size_uint key_length, zend_op_array **op_array_p, int *from_shared_memory TSRMLS_DC) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1465,7 +1465,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T { zend_persistent_script *persistent_script = NULL; char *key = NULL; - int key_length; + zend_str_size_int key_length; int from_shared_memory; /* if the script we've got is stored in SHM */ if (!file_handle->filename || @@ -1995,7 +1995,7 @@ static char* persistent_zend_resolve_path(const char *filename, zend_str_size_in /* we are in include_once or FastCGI request */ zend_file_handle handle; char *key = NULL; - int key_length; + zend_str_size_int key_length; char *resolved_path; zend_accel_hash_entry *bucket; zend_persistent_script *persistent_script; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 57f3047..94225a3 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -203,7 +203,11 @@ typedef struct _zend_persistent_script { */ struct zend_persistent_script_dynamic_members { time_t last_used; - zend_uint_t hits; +#ifndef ZEND_WIN32 + zend_uint_t hits; +#else + LONG hits; +#endif unsigned int memory_consumption; unsigned int checksum; time_t revalidate; @@ -256,10 +260,10 @@ typedef struct _zend_accel_globals { HashTable bind_hash; /* prototype and zval lookup table */ zend_accel_directives accel_directives; char *cwd; /* current working directory or NULL */ - int cwd_len; /* "cwd" string length */ + zend_str_size_int cwd_len; /* "cwd" string length */ char *include_path_key; /* one letter key of current "include_path" */ char *include_path; /* current section of "include_path" directive */ - int include_path_len; /* "include_path" string length */ + zend_str_size_int include_path_len; /* "include_path" string length */ int include_path_check; time_t request_time; /* preallocated shared-memory block to save current script */ @@ -268,13 +272,17 @@ typedef struct _zend_accel_globals { zend_op *cache_opline; zend_persistent_script *cache_persistent_script; /* preallocated buffer for keys */ - int key_len; + zend_str_size_int key_len; char key[MAXPATHLEN * 8]; } zend_accel_globals; typedef struct _zend_accel_shared_globals { /* Cache Data Structures */ - zend_uint_t hits; +#ifndef ZEND_WIN32 + zend_uint_t hits; +#else + LONG hits; +#endif zend_uint_t misses; zend_uint_t blacklist_misses; zend_uint_t oom_restarts; /* number of restarts because of out of memory */ @@ -292,8 +300,8 @@ typedef struct _zend_accel_shared_globals { zend_accel_restart_reason restart_reason; zend_bool cache_status_before_restart; #ifdef ZEND_WIN32 - zend_uint_t mem_usage; - zend_uint_t restart_in; + LONG mem_usage; + LONG restart_in; #endif zend_bool restart_in_progress; time_t revalidate_at; @@ -330,12 +338,12 @@ extern char *zps_api_failure_reason; void accel_shutdown(TSRMLS_D); void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC); +int zend_accel_invalidate(const char *filename, zend_str_size_int filename_len, zend_bool force TSRMLS_DC); int zend_accel_script_optimize(zend_persistent_script *persistent_script TSRMLS_DC); int accelerator_shm_read_lock(TSRMLS_D); void accelerator_shm_read_unlock(TSRMLS_D); -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, zend_str_size_int path_length, zend_str_size_int *key_len TSRMLS_DC); zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); #if !defined(ZEND_DECLARE_INHERITED_CLASS_DELAYED) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 4303406..2b98c3d 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -300,10 +300,10 @@ static int ZEND_DECLARE_INHERITED_CLASS_DELAYED_HANDLER(ZEND_OPCODE_HANDLER_ARGS } #endif -static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC) +static int filename_is_in_cache(char *filename, zend_str_size_int filename_len TSRMLS_DC) { char *key; - int key_length; + zend_str_size_int key_length; zend_file_handle handle = {0}; zend_persistent_script *persistent_script; diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 694cf29..0059b45 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -1016,7 +1016,8 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, persistent_script->full_path) { char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; - int len, clen; + zend_str_size_int len; + int clen; cfilename = persistent_script->full_path; clen = strlen(cfilename); diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index b82499d..ddaae86 100644 --- a/ext/opcache/zend_accelerator_util_funcs.h +++ b/ext/opcache/zend_accelerator_util_funcs.h @@ -38,7 +38,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, #define ADLER32_INIT 1 /* initial Adler-32 value */ -unsigned int zend_adler32(unsigned int checksum, signed char *buf, zend_str_size_uint len); +unsigned int zend_adler32(unsigned int checksum, signed char *buf, uint len); #endif /* ZEND_ACCELERATOR_UTIL_FUNCS_H */ diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index e290a39..c721938 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -355,7 +355,7 @@ static uint zend_accel_persist_class_table_calc(HashTable *class_table TSRMLS_DC return zend_hash_persist_calc(class_table, (int (*)(void* TSRMLS_DC)) zend_persist_class_entry_calc, sizeof(zend_class_entry*) TSRMLS_CC); } -uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length TSRMLS_DC) +uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, zend_str_size_uint key_length TSRMLS_DC) { START_SIZE();