[PATCH]APC php5.0.0 PATCH
| From: | Kamesh Jayachandran | Date: | Tue, 04 May 2004 13:27:21 +0000 |
| Subject: | [PATCH]APC php5.0.0 PATCH | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-28767@lists.php.net to get a copy of this message | ||
Hi,
Got APC 2.0.3 compiled with PHP 5.0.0.
But could not do much of the testing except the extension_loaded("apc")
(returns true).
I hereby attach the patches.
With regards
Kamesh Jayachandran
--- apc_cache.c 2004-05-04 16:37:15.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_cache.c 2004-03-12 07:18:09.000000000 +0530 @@ -173,7 +173,7 @@ int i; apc_class_t* classes = entry->classes; for (i=0; classes[i].class_entry != NULL; i++) { - classes[i].class_entry->refcount = BIG_VALUE; + classes[i].class_entry->refcount[0] = BIG_VALUE; } } } --- apc_compile.c 2004-05-04 18:03:51.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_compile.c 2003-08-05 00:32:31.000000000 +0530 @@ -103,6 +103,7 @@ type == IS_NULL || type == IS_CONSTANT || type == IS_STRING || + type == FLAG_IS_BC || type == IS_ARRAY || type == IS_CONSTANT_ARRAY || type == IS_OBJECT); @@ -136,7 +137,7 @@ for (i = 0; i < op_array->last; i++) { zend_op* op = &op_array->opcodes[i]; - if (((op->opcode == ZEND_DECLARE_CLASS)||(op->opcode == ZEND_DECLARE_FUNCTION)) && + if (op->opcode == ZEND_DECLARE_FUNCTION_OR_CLASS && op->extended_value == ZEND_DECLARE_INHERITED_CLASS) { if (op->op1.u.constant.value.str.len == key_size && @@ -200,6 +201,7 @@ case IS_CONSTANT: case IS_STRING: + case FLAG_IS_BC: if (src->value.str.val) CHECK(dst->value.str.val = apc_xmemcpy(src->value.str.val, src->value.str.len+1, @@ -217,12 +219,12 @@ break; case IS_OBJECT: - CHECK(dst->value.obj.handlers->get_class_entry = - my_copy_class_entry(NULL, src->value.obj.handlers->get_class_entry, allocate)); + CHECK(dst->value.obj.ce = + my_copy_class_entry(NULL, src->value.obj.ce, allocate)); - CHECK(dst->value.obj.handlers->get_properties = + CHECK(dst->value.obj.properties = my_copy_hashtable(NULL, - src->value.obj.handlers->get_properties, + src->value.obj.properties, (ht_copy_fun_t) my_copy_zval_ptr, 1, allocate)); @@ -317,11 +319,11 @@ CHECK(dst->fname = apc_xstrdup(src->fname, allocate)); } - /*if (src->func_arg_types) { + if (src->func_arg_types) { CHECK(dst->func_arg_types = apc_xmemcpy(src->func_arg_types, src->func_arg_types[0]+1, allocate)); - }*/ + } return dst; } @@ -343,7 +345,9 @@ CHECK(dst->name = apc_xstrdup(src->name, allocate)); } - CHECK(dst->refcount = src->refcount); + CHECK(dst->refcount = apc_xmemcpy(src->refcount, + sizeof(src->refcount[0]), + allocate)); CHECK(my_copy_hashtable(&dst->function_table, &src->function_table, @@ -489,12 +493,12 @@ memcpy(dst, src, sizeof(src[0])); /* copy the arg types array (if set) */ - /*if (src->arg_types) { + if (src->arg_types) { CHECK(dst->arg_types = apc_xmemcpy(src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1), allocate)); - }*/ + } if (src->function_name) { CHECK(dst->function_name = apc_xstrdup(src->function_name, allocate)); @@ -675,6 +679,7 @@ case IS_CONSTANT: case IS_STRING: + case FLAG_IS_BC: deallocate(src->value.str.val); break; @@ -686,9 +691,9 @@ break; case IS_OBJECT: - my_destroy_class_entry(src->value.obj.handlers->get_class_entry, deallocate); - deallocate(src->value.obj.handlers->get_class_entry); - my_free_hashtable(src->value.obj.handlers->get_properties, + my_destroy_class_entry(src->value.obj.ce, deallocate); + deallocate(src->value.obj.ce); + my_free_hashtable(src->value.obj.properties, (ht_free_fun_t) my_free_zval_ptr, deallocate); break; @@ -744,9 +749,9 @@ assert(src != NULL); deallocate(src->fname); - /*if (src->func_arg_types) { + if (src->func_arg_types) { deallocate(src->func_arg_types); - }*/ + } } /* }}} */ @@ -805,9 +810,9 @@ assert(src != NULL); - /*if (src->arg_types) { + if (src->arg_types) { deallocate(src->arg_types); - }*/ + } deallocate(src->function_name); deallocate(src->filename); --- apc_debug.c 2004-05-04 18:25:51.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_debug.c 2003-06-29 08:23:31.000000000 +0530 @@ -81,9 +81,6 @@ static const char S_ZEND_INCLUDE_OR_EVAL[] = "INCLUDE_OR_EVAL"; static const char S_ZEND_UNSET_VAR[] = "UNSET_VAR"; static const char S_ZEND_UNSET_DIM_OBJ[] = "UNSET_DIM_OBJ"; - static const char S_ZEND_ISSET_ISEMPTY_VAR[] = "ISSET_ISEMPTY_VAR"; - static const char S_ZEND_ISSET_ISEMPTY_DIM_OBJ[] = "ISSET_ISEMPTY_DIM_OBJ"; - static const char S_ZEND_ISSET_ISEMPTY_PROP_OBJ[] = "ISSET_ISEMPTY_PROP_OBJ"; static const char S_ZEND_ISSET_ISEMPTY[] = "ISSET_ISEMPTY"; static const char S_ZEND_FE_RESET[] = "FE_RESET"; static const char S_ZEND_FE_FETCH[] = "FE_FETCH"; @@ -108,8 +105,7 @@ static const char S_ZEND_FETCH_OBJ_UNSET[] = "FETCH_OBJ_UNSET"; static const char S_ZEND_FETCH_DIM_TMP_VAR[] = "FETCH_DIM_TMP_VAR"; static const char S_ZEND_FETCH_CONSTANT[] = "FETCH_CONSTANT"; - static const char S_ZEND_DECLARE_FUNCTION[] = "DECLARE_FUNCTION"; - static const char S_ZEND_DECLARE_CLASS[] = "DECLARE_CLASS"; + static const char S_ZEND_DECLARE_FUNCTION_OR_CLASS[] = "DECLARE_FUNCTION_OR_CLASS"; static const char S_ZEND_EXT_STMT[] = "EXT_STMT"; static const char S_ZEND_EXT_FCALL_BEGIN[] = "EXT_FCALL_BEGIN"; static const char S_ZEND_EXT_FCALL_END[] = "EXT_FCALL_END"; @@ -274,12 +270,8 @@ return S_ZEND_UNSET_VAR; case ZEND_UNSET_DIM_OBJ: return S_ZEND_UNSET_DIM_OBJ; - case ZEND_ISSET_ISEMPTY_VAR: - return S_ZEND_ISSET_ISEMPTY_VAR; - case ZEND_ISSET_ISEMPTY_DIM_OBJ: - return S_ZEND_ISSET_ISEMPTY_DIM_OBJ; - case ZEND_ISSET_ISEMPTY_PROP_OBJ: - return S_ZEND_ISSET_ISEMPTY_PROP_OBJ; + case ZEND_ISSET_ISEMPTY: + return S_ZEND_ISSET_ISEMPTY; case ZEND_FE_RESET: return S_ZEND_FE_RESET; case ZEND_FE_FETCH: @@ -326,10 +318,8 @@ return S_ZEND_FETCH_DIM_TMP_VAR; case ZEND_FETCH_CONSTANT: return S_ZEND_FETCH_CONSTANT; - case ZEND_DECLARE_FUNCTION: - return S_ZEND_DECLARE_FUNCTION; - case ZEND_DECLARE_CLASS: - return S_ZEND_DECLARE_CLASS; + case ZEND_DECLARE_FUNCTION_OR_CLASS: + return S_ZEND_DECLARE_FUNCTION_OR_CLASS; case ZEND_EXT_STMT: return S_ZEND_EXT_STMT; case ZEND_EXT_FCALL_BEGIN: --- apc_optimizer.c 2004-05-04 18:16:27.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_optimizer.c 2003-08-05 00:32:31.000000000 +0530 @@ -559,7 +559,8 @@ zend_op* incr_op = &ops[j]; zend_op* free_op = &ops[k]; - if( load_op->op1.u.constant.type == IS_STRING && + if (load_op->op2.u.fetch_type == ZEND_FETCH_LOCAL && + load_op->op1.u.constant.type == IS_STRING && load_op->op1.op_type == IS_CONST && load_op->result.op_type != IS_CONST && incr_op->op1.op_type != IS_CONST && @@ -603,7 +604,8 @@ zend_op* incr_op = &ops[j]; zend_op* free_op = &ops[k]; - if (load_op->op1.u.constant.type == IS_STRING && + if (load_op->op2.u.fetch_type == ZEND_FETCH_LOCAL && + load_op->op1.u.constant.type == IS_STRING && load_op->op1.op_type == IS_CONST && load_op->result.op_type != IS_CONST && incr_op->op1.op_type != IS_CONST && --- php_apc.c 2004-05-04 18:36:41.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/php_apc.c 2004-03-24 21:19:13.000000000 +0530 @@ -79,12 +79,12 @@ } PHP_INI_BEGIN() -STD_PHP_INI_ENTRY("apc.enabled", "1", PHP_INI_SYSTEM, OnUpdateLong, enabled, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.shm_segments", "1", PHP_INI_SYSTEM, OnUpdateLong, shm_segments, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.shm_size", "30", PHP_INI_SYSTEM, OnUpdateLong, shm_size, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.optimization", "0", PHP_INI_SYSTEM, OnUpdateLong, optimization, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateLong, num_files_hint, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateLong, gc_ttl, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.enabled", "1", PHP_INI_SYSTEM, OnUpdateInt, enabled, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.shm_segments", "1", PHP_INI_SYSTEM, OnUpdateInt, shm_segments, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.shm_size", "30", PHP_INI_SYSTEM, OnUpdateInt, shm_size, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.optimization", "0", PHP_INI_SYSTEM, OnUpdateInt, optimization, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateInt, num_files_hint, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateInt, gc_ttl, zend_apc_globals, apc_globals) #if APC_MMAP STD_PHP_INI_ENTRY("apc.mmap_file_mask", NULL, PHP_INI_SYSTEM, OnUpdateString, mmap_file_mask, zend_apc_globals, apc_globals) #endif
--- apc_cache.c 2004-05-04 16:37:15.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_cache.c 2004-03-12 07:18:09.000000000 +0530 @@ -173,7 +173,7 @@ int i; apc_class_t* classes = entry->classes; for (i=0; classes[i].class_entry != NULL; i++) { - classes[i].class_entry->refcount = BIG_VALUE; + classes[i].class_entry->refcount[0] = BIG_VALUE; } } } --- apc_compile.c 2004-05-04 18:03:51.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_compile.c 2003-08-05 00:32:31.000000000 +0530 @@ -103,6 +103,7 @@ type == IS_NULL || type == IS_CONSTANT || type == IS_STRING || + type == FLAG_IS_BC || type == IS_ARRAY || type == IS_CONSTANT_ARRAY || type == IS_OBJECT); @@ -136,7 +137,7 @@ for (i = 0; i < op_array->last; i++) { zend_op* op = &op_array->opcodes[i]; - if (((op->opcode == ZEND_DECLARE_CLASS)||(op->opcode == ZEND_DECLARE_FUNCTION)) && + if (op->opcode == ZEND_DECLARE_FUNCTION_OR_CLASS && op->extended_value == ZEND_DECLARE_INHERITED_CLASS) { if (op->op1.u.constant.value.str.len == key_size && @@ -200,6 +201,7 @@ case IS_CONSTANT: case IS_STRING: + case FLAG_IS_BC: if (src->value.str.val) CHECK(dst->value.str.val = apc_xmemcpy(src->value.str.val, src->value.str.len+1, @@ -217,12 +219,12 @@ break; case IS_OBJECT: - CHECK(dst->value.obj.handlers->get_class_entry = - my_copy_class_entry(NULL, src->value.obj.handlers->get_class_entry, allocate)); + CHECK(dst->value.obj.ce = + my_copy_class_entry(NULL, src->value.obj.ce, allocate)); - CHECK(dst->value.obj.handlers->get_properties = + CHECK(dst->value.obj.properties = my_copy_hashtable(NULL, - src->value.obj.handlers->get_properties, + src->value.obj.properties, (ht_copy_fun_t) my_copy_zval_ptr, 1, allocate)); @@ -317,11 +319,11 @@ CHECK(dst->fname = apc_xstrdup(src->fname, allocate)); } - /*if (src->func_arg_types) { + if (src->func_arg_types) { CHECK(dst->func_arg_types = apc_xmemcpy(src->func_arg_types, src->func_arg_types[0]+1, allocate)); - }*/ + } return dst; } @@ -343,7 +345,9 @@ CHECK(dst->name = apc_xstrdup(src->name, allocate)); } - CHECK(dst->refcount = src->refcount); + CHECK(dst->refcount = apc_xmemcpy(src->refcount, + sizeof(src->refcount[0]), + allocate)); CHECK(my_copy_hashtable(&dst->function_table, &src->function_table, @@ -489,12 +493,12 @@ memcpy(dst, src, sizeof(src[0])); /* copy the arg types array (if set) */ - /*if (src->arg_types) { + if (src->arg_types) { CHECK(dst->arg_types = apc_xmemcpy(src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1), allocate)); - }*/ + } if (src->function_name) { CHECK(dst->function_name = apc_xstrdup(src->function_name, allocate)); @@ -675,6 +679,7 @@ case IS_CONSTANT: case IS_STRING: + case FLAG_IS_BC: deallocate(src->value.str.val); break; @@ -686,9 +691,9 @@ break; case IS_OBJECT: - my_destroy_class_entry(src->value.obj.handlers->get_class_entry, deallocate); - deallocate(src->value.obj.handlers->get_class_entry); - my_free_hashtable(src->value.obj.handlers->get_properties, + my_destroy_class_entry(src->value.obj.ce, deallocate); + deallocate(src->value.obj.ce); + my_free_hashtable(src->value.obj.properties, (ht_free_fun_t) my_free_zval_ptr, deallocate); break; @@ -744,9 +749,9 @@ assert(src != NULL); deallocate(src->fname); - /*if (src->func_arg_types) { + if (src->func_arg_types) { deallocate(src->func_arg_types); - }*/ + } } /* }}} */ @@ -805,9 +810,9 @@ assert(src != NULL); - /*if (src->arg_types) { + if (src->arg_types) { deallocate(src->arg_types); - }*/ + } deallocate(src->function_name); deallocate(src->filename); --- apc_debug.c 2004-05-04 18:25:51.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_debug.c 2003-06-29 08:23:31.000000000 +0530 @@ -81,9 +81,6 @@ static const char S_ZEND_INCLUDE_OR_EVAL[] = "INCLUDE_OR_EVAL"; static const char S_ZEND_UNSET_VAR[] = "UNSET_VAR"; static const char S_ZEND_UNSET_DIM_OBJ[] = "UNSET_DIM_OBJ"; - static const char S_ZEND_ISSET_ISEMPTY_VAR[] = "ISSET_ISEMPTY_VAR"; - static const char S_ZEND_ISSET_ISEMPTY_DIM_OBJ[] = "ISSET_ISEMPTY_DIM_OBJ"; - static const char S_ZEND_ISSET_ISEMPTY_PROP_OBJ[] = "ISSET_ISEMPTY_PROP_OBJ"; static const char S_ZEND_ISSET_ISEMPTY[] = "ISSET_ISEMPTY"; static const char S_ZEND_FE_RESET[] = "FE_RESET"; static const char S_ZEND_FE_FETCH[] = "FE_FETCH"; @@ -108,8 +105,7 @@ static const char S_ZEND_FETCH_OBJ_UNSET[] = "FETCH_OBJ_UNSET"; static const char S_ZEND_FETCH_DIM_TMP_VAR[] = "FETCH_DIM_TMP_VAR"; static const char S_ZEND_FETCH_CONSTANT[] = "FETCH_CONSTANT"; - static const char S_ZEND_DECLARE_FUNCTION[] = "DECLARE_FUNCTION"; - static const char S_ZEND_DECLARE_CLASS[] = "DECLARE_CLASS"; + static const char S_ZEND_DECLARE_FUNCTION_OR_CLASS[] = "DECLARE_FUNCTION_OR_CLASS"; static const char S_ZEND_EXT_STMT[] = "EXT_STMT"; static const char S_ZEND_EXT_FCALL_BEGIN[] = "EXT_FCALL_BEGIN"; static const char S_ZEND_EXT_FCALL_END[] = "EXT_FCALL_END"; @@ -274,12 +270,8 @@ return S_ZEND_UNSET_VAR; case ZEND_UNSET_DIM_OBJ: return S_ZEND_UNSET_DIM_OBJ; - case ZEND_ISSET_ISEMPTY_VAR: - return S_ZEND_ISSET_ISEMPTY_VAR; - case ZEND_ISSET_ISEMPTY_DIM_OBJ: - return S_ZEND_ISSET_ISEMPTY_DIM_OBJ; - case ZEND_ISSET_ISEMPTY_PROP_OBJ: - return S_ZEND_ISSET_ISEMPTY_PROP_OBJ; + case ZEND_ISSET_ISEMPTY: + return S_ZEND_ISSET_ISEMPTY; case ZEND_FE_RESET: return S_ZEND_FE_RESET; case ZEND_FE_FETCH: @@ -326,10 +318,8 @@ return S_ZEND_FETCH_DIM_TMP_VAR; case ZEND_FETCH_CONSTANT: return S_ZEND_FETCH_CONSTANT; - case ZEND_DECLARE_FUNCTION: - return S_ZEND_DECLARE_FUNCTION; - case ZEND_DECLARE_CLASS: - return S_ZEND_DECLARE_CLASS; + case ZEND_DECLARE_FUNCTION_OR_CLASS: + return S_ZEND_DECLARE_FUNCTION_OR_CLASS; case ZEND_EXT_STMT: return S_ZEND_EXT_STMT; case ZEND_EXT_FCALL_BEGIN: --- apc_optimizer.c 2004-05-04 18:16:27.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/apc_optimizer.c 2003-08-05 00:32:31.000000000 +0530 @@ -559,7 +559,8 @@ zend_op* incr_op = &ops[j]; zend_op* free_op = &ops[k]; - if( load_op->op1.u.constant.type == IS_STRING && + if (load_op->op2.u.fetch_type == ZEND_FETCH_LOCAL && + load_op->op1.u.constant.type == IS_STRING && load_op->op1.op_type == IS_CONST && load_op->result.op_type != IS_CONST && incr_op->op1.op_type != IS_CONST && @@ -603,7 +604,8 @@ zend_op* incr_op = &ops[j]; zend_op* free_op = &ops[k]; - if (load_op->op1.u.constant.type == IS_STRING && + if (load_op->op2.u.fetch_type == ZEND_FETCH_LOCAL && + load_op->op1.u.constant.type == IS_STRING && load_op->op1.op_type == IS_CONST && load_op->result.op_type != IS_CONST && incr_op->op1.op_type != IS_CONST && --- php_apc.c 2004-05-04 18:36:41.000000000 +0530 +++ ../APC-2.0.3orig/APC-2.0.3/php_apc.c 2004-03-24 21:19:13.000000000 +0530 @@ -79,12 +79,12 @@ } PHP_INI_BEGIN() -STD_PHP_INI_ENTRY("apc.enabled", "1", PHP_INI_SYSTEM, OnUpdateLong, enabled, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.shm_segments", "1", PHP_INI_SYSTEM, OnUpdateLong, shm_segments, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.shm_size", "30", PHP_INI_SYSTEM, OnUpdateLong, shm_size, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.optimization", "0", PHP_INI_SYSTEM, OnUpdateLong, optimization, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateLong, num_files_hint, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateLong, gc_ttl, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.enabled", "1", PHP_INI_SYSTEM, OnUpdateInt, enabled, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.shm_segments", "1", PHP_INI_SYSTEM, OnUpdateInt, shm_segments, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.shm_size", "30", PHP_INI_SYSTEM, OnUpdateInt, shm_size, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.optimization", "0", PHP_INI_SYSTEM, OnUpdateInt, optimization, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateInt, num_files_hint, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateInt, gc_ttl, zend_apc_globals, apc_globals) #if APC_MMAP STD_PHP_INI_ENTRY("apc.mmap_file_mask", NULL, PHP_INI_SYSTEM, OnUpdateString, mmap_file_mask, zend_apc_globals, apc_globals) #endif