diff options
| author | Dmitry Stogov <dmitry@php.net> | 2007-04-16 08:09:56 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2007-04-16 08:09:56 +0000 |
| commit | e1814f0dbe3037970966c82d5bf3e97fd5f6d5a8 (patch) | |
| tree | a49deb50f7f0c88fa52eb3c3ffa06ba1fcae69b8 /Zend | |
| parent | f088268f910a764ccbd2174cd3eb051c74dc82d5 (diff) | |
| download | php-git-e1814f0dbe3037970966c82d5bf3e97fd5f6d5a8.tar.gz | |
WIN64 support
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/zend_API.c | 14 | ||||
| -rw-r--r-- | Zend/zend_API.h | 2 | ||||
| -rw-r--r-- | Zend/zend_alloc.c | 18 | ||||
| -rw-r--r-- | Zend/zend_builtin_functions.c | 14 | ||||
| -rw-r--r-- | Zend/zend_compile.c | 2 | ||||
| -rw-r--r-- | Zend/zend_execute.c | 10 | ||||
| -rw-r--r-- | Zend/zend_execute.h | 4 | ||||
| -rw-r--r-- | Zend/zend_execute_API.c | 6 | ||||
| -rw-r--r-- | Zend/zend_ini.c | 2 | ||||
| -rw-r--r-- | Zend/zend_opcode.c | 2 | ||||
| -rw-r--r-- | Zend/zend_types.h | 8 | ||||
| -rw-r--r-- | Zend/zend_vm_def.h | 4 | ||||
| -rw-r--r-- | Zend/zend_vm_execute.h | 4 |
13 files changed, 54 insertions, 36 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index d3f58f660e..ad58ac4490 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -44,7 +44,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) TSRMLS_FETCH(); p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; @@ -82,7 +82,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument zval *param_ptr; p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; @@ -122,7 +122,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) TSRMLS_FETCH(); p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; @@ -145,7 +145,7 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr int arg_count; p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; @@ -187,7 +187,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS int arg_count; p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; @@ -698,7 +698,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl } p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (num_args > arg_count) { zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", @@ -878,7 +878,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC zend_update_class_constants(class_type->parent TSRMLS_CC); } #if ZTS - ALLOC_HASHTABLE(CG(static_members)[(long)(class_type->static_members)]); + ALLOC_HASHTABLE(CG(static_members)[(zend_intptr_t)(class_type->static_members)]); #else ALLOC_HASHTABLE(class_type->static_members); #endif diff --git a/Zend/zend_API.h b/Zend/zend_API.h index f4d5833fb2..861abc8a7d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -160,7 +160,7 @@ typedef struct _zend_function_entry { INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL) #ifdef ZTS -# define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(long)(ce)->static_members]) +# define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(zend_intptr_t)(ce)->static_members]) #else # define CE_STATIC_MEMBERS(ce) ((ce)->static_members) #endif diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index b9a10dc14d..5ac7f4ab22 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -50,6 +50,16 @@ # define ZEND_MM_COOKIES ZEND_DEBUG #endif +#ifdef _WIN64 +# define PTR_FMT "0x%0.16I64x" +/* +#elif sizeof(long) == 8 +# define PTR_FMT "0x%0.16lx" +*/ +#else +# define PTR_FMT "0x%0.8lx" +#endif + #if ZEND_DEBUG void zend_debug_alloc_output(char *format, ...) { @@ -1180,7 +1190,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) repeated = zend_mm_find_leaks(segment, p); total += 1 + repeated; if (repeated) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)repeated); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated); } #if ZEND_MM_CACHE } else if (p->magic == MEM_BLOCK_CACHED) { @@ -1221,7 +1231,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE if (!silent) { zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL); zend_debug_alloc_output("---------------------------------------\n"); - zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) ptr); + zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr); if (__zend_orig_filename) { zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC); } @@ -1253,7 +1263,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) { if (!silent) { - zend_debug_alloc_output("Invalid pointer: ((size=0x%0.8X) != (next.prev=0x%0.8X))\n", p->info._size, ZEND_MM_NEXT_BLOCK(p)->info._prev); + zend_debug_alloc_output("Invalid pointer: ((size="PTR_FMT") != (next.prev="PTR_FMT"))\n", p->info._size, ZEND_MM_NEXT_BLOCK(p)->info._prev); had_problems = 1; } else { return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); @@ -1262,7 +1272,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE if (p->info._prev != ZEND_MM_GUARD_BLOCK && ZEND_MM_PREV_BLOCK(p)->info._size != p->info._prev) { if (!silent) { - zend_debug_alloc_output("Invalid pointer: ((prev=0x%0.8X) != (prev.size=0x%0.8X))\n", p->info._prev, ZEND_MM_PREV_BLOCK(p)->info._size); + zend_debug_alloc_output("Invalid pointer: ((prev="PTR_FMT") != (prev.size="PTR_FMT"))\n", p->info._prev, ZEND_MM_PREV_BLOCK(p)->info._size); had_problems = 1; } else { return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index ed2ba749c4..0ce917d327 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -172,14 +172,14 @@ ZEND_FUNCTION(func_num_args) int arg_count; p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */ + arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_num_args(); */ p -= 1+arg_count; if (*p) { zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter"); } --p; if (p>=EG(argument_stack).elements) { - RETURN_LONG((ulong) *p); + RETURN_LONG((long)(zend_uintptr_t) *p); } else { zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); RETURN_LONG(-1); @@ -210,7 +210,7 @@ ZEND_FUNCTION(func_get_arg) } p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_arg(); */ + arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_arg(); */ p -= 1+arg_count; if (*p) { zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter"); @@ -220,7 +220,7 @@ ZEND_FUNCTION(func_get_arg) zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context"); RETURN_FALSE; } - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; if (requested_offset>=arg_count) { zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset); @@ -244,7 +244,7 @@ ZEND_FUNCTION(func_get_args) int i; p = EG(argument_stack).top_element-1-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_args(); */ + arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_args(); */ p -= 1+arg_count; if (*p) { zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter"); @@ -255,7 +255,7 @@ ZEND_FUNCTION(func_get_args) zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context"); RETURN_FALSE; } - arg_count = (ulong) *p; + arg_count = (int)(zend_uintptr_t) *p; array_init(return_value); @@ -1655,7 +1655,7 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) { void **p = *curpos - 2; zval *arg_array, **arg; - int arg_count = (ulong) *p; + int arg_count = (int)(zend_uintptr_t) *p; *curpos -= (arg_count+2); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index dee710318f..3d4afa8f81 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4189,7 +4189,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify CG(static_members) = realloc(CG(static_members), (n+1)*sizeof(HashTable*)); CG(static_members)[n] = NULL; } - ce->static_members = (HashTable*)n; + ce->static_members = (HashTable*)(zend_intptr_t)n; #else ce->static_members = NULL; #endif diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 86239fa44a..dd0faeb131 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -104,15 +104,15 @@ static inline void zend_pzval_unlock_free_func(zval *z) #define FREE_OP(should_free) \ if (should_free.var) { \ - if ((long)should_free.var & 1L) { \ - zval_dtor((zval*)((long)should_free.var & ~1L)); \ + if ((zend_uintptr_t)should_free.var & 1L) { \ + zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \ } else { \ zval_ptr_dtor(&should_free.var); \ } \ } #define FREE_OP_IF_VAR(should_free) \ - if (should_free.var != NULL && (((long)should_free.var & 1L) == 0)) { \ + if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \ zval_ptr_dtor(&should_free.var); \ } @@ -121,9 +121,9 @@ static inline void zend_pzval_unlock_free_func(zval *z) zval_ptr_dtor(&should_free.var); \ } -#define TMP_FREE(z) (zval*)(((long)(z)) | 1L) +#define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L) -#define IS_TMP_FREE(should_free) ((long)should_free.var & 1L) +#define IS_TMP_FREE(should_free) ((zend_uintptr_t)should_free.var & 1L) #define INIT_PZVAL_COPY(z,v) \ (z)->value = (v)->value; \ diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index a206f003ed..db68fe1c93 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -146,7 +146,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) { void **p = EG(argument_stack).top_element-2; - int delete_count = (ulong) *p; + int delete_count = (int)(zend_uintptr_t) *p; EG(argument_stack).top -= (delete_count+2); while (--delete_count>=0) { @@ -160,7 +160,7 @@ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) 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; + int arg_count = (int)(zend_uintptr_t) *p; if (requested_arg>arg_count) { return FAILURE; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 2fb02c421a..f51289a94c 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -451,7 +451,7 @@ ZEND_API int zend_is_true(zval *op) ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) { zval *p = *pp; - zend_bool inline_change = (zend_bool) (unsigned long) arg; + zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg; zval const_value; if (Z_TYPE_P(p) == IS_CONSTANT) { @@ -867,7 +867,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (fci->no_separation) { if(i) { /* hack to clean up the stack */ - zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) i, NULL); + zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (zend_uintptr_t) i, NULL); zend_ptr_stack_clear_multiple(TSRMLS_C); } @@ -908,7 +908,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS fci->param_count = 2; } - zend_ptr_stack_2_push(&EG(argument_stack), (void *) (long) fci->param_count, NULL); + zend_ptr_stack_2_push(&EG(argument_stack), (void *) (zend_uintptr_t) fci->param_count, NULL); original_function_state_ptr = EG(function_state_ptr); EG(function_state_ptr) = &EX(function_state); diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 89ab5bc412..4e05cec4d7 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -225,7 +225,7 @@ static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) { - zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC); + zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(zend_intptr_t) stage TSRMLS_CC); } #endif diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index e352deccdd..8621dc12b1 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -160,7 +160,7 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC) zend_hash_destroy(CE_STATIC_MEMBERS(*pce)); FREE_HASHTABLE(CE_STATIC_MEMBERS(*pce)); #ifdef ZTS - CG(static_members)[(long)((*pce)->static_members)] = NULL; + CG(static_members)[(zend_intptr_t)((*pce)->static_members)] = NULL; #else (*pce)->static_members = NULL; #endif diff --git a/Zend/zend_types.h b/Zend/zend_types.h index b357a2075f..dad2786009 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -28,6 +28,14 @@ typedef unsigned int zend_uint; typedef unsigned long zend_ulong; typedef unsigned short zend_ushort; +#ifdef _WIN64 +typedef unsigned __int64 zend_intptr_t; +typedef __int64 zend_uintptr_t; +#else +typedef long zend_intptr_t; +typedef unsigned long zend_uintptr_t; +#endif + typedef unsigned int zend_object_handle; typedef struct _zend_object_handlers zend_object_handlers; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e5edf1aaf1..2abcf6a434 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1857,7 +1857,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) } } - zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL); + zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; @@ -1900,7 +1900,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ulong arg_count; p = (zval **) EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (ulong)(zend_uintptr_t) *p; while (arg_count>0) { zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index cdbc4afe27..dc1758b175 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -145,7 +145,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) } } - zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL); + zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL); EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; @@ -188,7 +188,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) ulong arg_count; p = (zval **) EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (ulong)(zend_uintptr_t) *p; while (arg_count>0) { zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC); |
