com php-src: basic fixes to ext/opcache: ext/opcache/Optimizer/ block_pass.c ext/opcache/Optimizer/compact_literals.c
ext/opcache/Optimizer/optimize_func_calls.c ext/opca che/Optimizer/pass1_5.c ext/opcache/Optimizer/zend_ optimizer.c ext/opcache/ZendAccelerator.c
ext/opcache/Z endAccelerator.h ext/opcache/zend_accelerator_blacklist .h ext/opcache/zend_accelerator_hash.c ext/opcache/ zend_accelerator_hash.h
ext/opcache/zend_accelerator _module.c ext/opc

From: Date: Wed, 04 Dec 2013 11:04:07 +0000
Subject: com php-src: basic fixes to ext/opcache: ext/opcache/Optimizer/ block_pass.c ext/opcache/Optimizer/compact_literals.c
ext/opcache/Optimizer/optimize_func_calls.c ext/opca che/Optimizer/pass1_5.c ext/opcache/Optimizer/zend_ optimizer.c ext/opcache/ZendAccelerator.c
ext/opcache/Z endAccelerator.h ext/opcache/zend_accelerator_blacklist .h ext/opcache/zend_accelerator_hash.c ext/opcache/ zend_accelerator_hash.h
ext/opcache/zend_accelerator _module.c ext/opc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74237@lists.php.net to get a copy of this message
Commit: 3930766e796ce73ead9c006ddc075d9bad0229ba Author: Anatol Belski <ab@php.net> Wed, 4 Dec 2013 12:04:07 +0100 Parents: 55023a87b08763ac947d4b9c54b494e75dc91899 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3930766e796ce73ead9c006ddc075d9bad0229ba Log: basic fixes to ext/opcache Changed paths: M ext/opcache/Optimizer/block_pass.c M ext/opcache/Optimizer/compact_literals.c M ext/opcache/Optimizer/optimize_func_calls.c M ext/opcache/Optimizer/pass1_5.c M ext/opcache/Optimizer/zend_optimizer.c M ext/opcache/ZendAccelerator.c M ext/opcache/ZendAccelerator.h M ext/opcache/zend_accelerator_blacklist.h M ext/opcache/zend_accelerator_hash.c M ext/opcache/zend_accelerator_hash.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.h M ext/opcache/zend_persist_calc.c M ext/opcache/zend_shared_alloc.h

diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 0a7b1de..66baf7d 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -740,7 +740,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len; if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) { zval c; - if(zend_get_persistent_constant(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) { + if(zend_get_persistent_constant(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) { literal_dtor(arg); MAKE_NOP(sv); MAKE_NOP(fcall); @@ -751,7 +751,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, (flen == sizeof("is_callable")-1 && zend_binary_strcasecmp(fname, flen, "is_callable", sizeof("is_callable")-1) == 0) ) { zend_function *function; - if(zend_hash_find(EG(function_table), Z_STRVAL_P(arg), Z_STRLEN_P(arg)+1, (void **)&function) == SUCCESS) { + if(zend_hash_find(EG(function_table), Z_STRVAL_P(arg), Z_STRSIZE_P(arg)+1, (void **)&function) == SUCCESS) { literal_dtor(arg); MAKE_NOP(sv); MAKE_NOP(fcall); @@ -760,7 +760,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, } } else if(flen == sizeof("constant")-1 && zend_binary_strcasecmp(fname, flen, "constant", sizeof("constant")-1) == 0) { zval c; - if(zend_get_persistent_constant(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &c, 1 TSRMLS_CC ELS_CC) != 0) { + if(zend_get_persistent_constant(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &c, 1 TSRMLS_CC ELS_CC) != 0) { literal_dtor(arg); MAKE_NOP(sv); MAKE_NOP(fcall); @@ -769,7 +769,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, ZEND_OP1_TYPE(opline) = IS_CONST; } } else if(flen == sizeof("extension_loaded")-1 && zend_binary_strcasecmp(fname, flen, "extension_loaded", sizeof("extension_loaded")-1) == 0) { - if(zend_hash_exists(&module_registry, Z_STRVAL_P(arg), Z_STRLEN_P(arg)+1)) { + if(zend_hash_exists(&module_registry, Z_STRVAL_P(arg), Z_STRSIZE_P(arg)+1)) { literal_dtor(arg); MAKE_NOP(sv); MAKE_NOP(fcall); @@ -915,7 +915,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) { convert_to_string_safe(&ZEND_OP1_LITERAL(last_op)); } - l = Z_STRLEN(ZEND_OP1_LITERAL(opline)) + Z_STRLEN(ZEND_OP1_LITERAL(last_op)); + l = Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + Z_STRSIZE(ZEND_OP1_LITERAL(last_op)); if (IS_INTERNED(Z_STRVAL(ZEND_OP1_LITERAL(last_op)))) { char *tmp = emalloc(l + 1); memcpy(tmp, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), l + 1); @@ -923,7 +923,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, } else { Z_STRVAL(ZEND_OP1_LITERAL(last_op)) = erealloc(Z_STRVAL(ZEND_OP1_LITERAL(last_op)), l + 1); } - memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op))+Z_STRLEN(ZEND_OP1_LITERAL(last_op)), Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op))+Z_STRSIZE(ZEND_OP1_LITERAL(last_op)), Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO @@ -932,7 +932,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, #else Z_STRVAL(ZEND_OP1_LITERAL(opline)) = Z_STRVAL(ZEND_OP1_LITERAL(last_op)); #endif - Z_STRLEN(ZEND_OP1_LITERAL(opline)) = l; + Z_STRSIZE(ZEND_OP1_LITERAL(opline)) = l; MAKE_NOP(last_op); } else if (opline->opcode == ZEND_CONCAT && ZEND_OP2_TYPE(opline) == IS_CONST && @@ -959,7 +959,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, opline->opcode = ZEND_ADD_STRING; } COPY_NODE(opline->op1, src->op1); - l = Z_STRLEN(ZEND_OP2_LITERAL(opline)) + Z_STRLEN(ZEND_OP2_LITERAL(src)); + l = Z_STRSIZE(ZEND_OP2_LITERAL(opline)) + Z_STRSIZE(ZEND_OP2_LITERAL(src)); if (IS_INTERNED(Z_STRVAL(ZEND_OP2_LITERAL(src)))) { char *tmp = emalloc(l + 1); memcpy(tmp, Z_STRVAL(ZEND_OP2_LITERAL(src)), l + 1); @@ -967,7 +967,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, } else { Z_STRVAL(ZEND_OP2_LITERAL(src)) = erealloc(Z_STRVAL(ZEND_OP2_LITERAL(src)), l + 1); } - memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src))+Z_STRLEN(ZEND_OP2_LITERAL(src)), Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src))+Z_STRSIZE(ZEND_OP2_LITERAL(src)), Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; if (!IS_INTERNED(Z_STRVAL(ZEND_OP2_LITERAL(opline)))) { efree(Z_STRVAL(ZEND_OP2_LITERAL(opline))); @@ -978,7 +978,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, #else Z_STRVAL(ZEND_OP2_LITERAL(opline)) = Z_STRVAL(ZEND_OP2_LITERAL(src)); #endif - Z_STRLEN(ZEND_OP2_LITERAL(opline)) = l; + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) = l; MAKE_NOP(src); } else if ((opline->opcode == ZEND_ADD_STRING || opline->opcode == ZEND_ADD_VAR) && ZEND_OP1_TYPE(opline) == IS_CONST) { /* convert ADD_STRING(C1, C2) to CONCAT(C1, C2) */ @@ -1099,7 +1099,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT && ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { + Z_STRSIZE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { /* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */ zend_op *src = VAR_SOURCE(opline->op1); VAR_UNSET(opline->op1); diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index b292413..9352c13 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -91,7 +91,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) { zend_op *opline, *end; int i, j, n, *pos, *map, cache_slots; - ulong h; + zend_uint_t h; literal_info *info; int l_null = -1; int l_false = -1; @@ -271,7 +271,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; zend_make_printable_zval(&op_array->literals[i].constant, &zv, &use_copy); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } @@ -355,21 +355,21 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) case IS_CONSTANT: if (info[i].flags & LITERAL_MAY_MERGE) { if (info[i].flags & LITERAL_EX_OBJ) { - key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i].constant); + key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRSIZE(op_array->literals[i].constant); key = emalloc(key_len); key_len = snprintf(key, key_len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i].constant)); } else if (info[i].flags & LITERAL_EX_CLASS) { zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num].constant; - key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i].constant); + key_len = Z_STRSIZE_P(class_name) + sizeof("::") + Z_STRSIZE(op_array->literals[i].constant); key = emalloc(key_len); - memcpy(key, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); - memcpy(key + Z_STRLEN_P(class_name), "::", sizeof("::") - 1); - memcpy(key + Z_STRLEN_P(class_name) + sizeof("::") - 1, + memcpy(key, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); + memcpy(key + Z_STRSIZE_P(class_name), "::", sizeof("::") - 1); + memcpy(key + Z_STRSIZE_P(class_name) + sizeof("::") - 1, Z_STRVAL(op_array->literals[i].constant), - Z_STRLEN(op_array->literals[i].constant) + 1); + Z_STRSIZE(op_array->literals[i].constant) + 1); } else { key = Z_STRVAL(op_array->literals[i].constant); - key_len = Z_STRLEN(op_array->literals[i].constant)+1; + key_len = Z_STRSIZE(op_array->literals[i].constant)+1; } h = zend_hash_func(key, key_len); h += info[i].flags; @@ -406,7 +406,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) if (IS_INTERNED(Z_STRVAL(op_array->literals[j].constant))) { op_array->literals[j].hash_value = INTERNED_HASH(Z_STRVAL(op_array->literals[j].constant)); } else { - op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRLEN(op_array->literals[j].constant)+1); + op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRSIZE(op_array->literals[j].constant)+1); } } if (LITERAL_NUM_SLOTS(info[i].flags)) { @@ -422,7 +422,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) if (IS_INTERNED(Z_STRVAL(op_array->literals[j].constant))) { op_array->literals[j].hash_value = INTERNED_HASH(Z_STRVAL(op_array->literals[j].constant)); } else { - op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRLEN(op_array->literals[j].constant)+1); + op_array->literals[j].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[j].constant), Z_STRSIZE(op_array->literals[j].constant)+1); } } j++; @@ -468,7 +468,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; zend_make_printable_zval(&op_array->literals[i].constant, &zv, &use_copy); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c index 98bfc1e..e2c610c 100644 --- a/ext/opcache/Optimizer/optimize_func_calls.c +++ b/ext/opcache/Optimizer/optimize_func_calls.c @@ -27,7 +27,7 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script zend_function *func; zval *function_name = &op_array->literals[opline->op2.constant + 1].constant; if ((zend_hash_quick_find(&script->function_table, - Z_STRVAL_P(function_name), Z_STRLEN_P(function_name) + 1, + Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name) + 1, Z_HASH_P(function_name), (void **)&func) == SUCCESS)) { call_stack[call].func = func; } diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index bd8af47..474c074 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -181,12 +181,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->opcode = ZEND_ADD_STRING; ptr++; } else { /* ZEND_ADD_STRING */ - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); if (!IS_INTERNED(Z_STRVAL(ZEND_OP2_LITERAL(opline)))) { efree(Z_STRVAL(ZEND_OP2_LITERAL(opline))); } Z_STRVAL(ZEND_OP2_LITERAL(opline)) = ptr; - ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline)); + ptr += Z_STRSIZE(ZEND_OP2_LITERAL(opline)); } ZEND_OP2_LITERAL(opline).value.str.len = final_length; next_op = opline + 1; @@ -216,7 +216,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_bool orig_in_execution = EG(in_execution); @@ -244,7 +244,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { zend_uint tv = ZEND_RESULT(opline).var; zval c; - if (!zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) { + if (!zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) { if (!*constants || !zend_optimizer_get_collected_constant(*constants, &ZEND_OP2_LITERAL(opline), &c)) { break; } @@ -267,12 +267,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* for A::B */ if (op_array->scope && !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), - op_array->scope->name, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) { + op_array->scope->name, Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1)) { pce = &op_array->scope; } else { if (zend_hash_quick_find(EG(class_table), Z_STRVAL(op_array->literals[opline->op1.constant + 1].constant), - Z_STRLEN(op_array->literals[opline->op1.constant].constant) + 1, + Z_STRSIZE(op_array->literals[opline->op1.constant].constant) + 1, Z_HASH_P(&op_array->literals[opline->op1.constant + 1].constant), (void **)&pce) == FAILURE) { break; @@ -294,10 +294,10 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (zend_hash_find(&(*pce)->constants_table, Z_STRVAL(ZEND_OP2_LITERAL(opline)), - Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1, + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) + 1, (void **) &c) == SUCCESS) { if (ZEND_IS_CONSTANT_TYPE(Z_TYPE_PP(c))) { - if (!zend_get_persistent_constant(Z_STRVAL_PP(c), Z_STRLEN_PP(c), &t, 1 TSRMLS_CC) || + if (!zend_get_persistent_constant(Z_STRVAL_PP(c), Z_STRSIZE_PP(c), &t, 1 TSRMLS_CC) || ZEND_IS_CONSTANT_TYPE(Z_TYPE(t))) { break; } @@ -331,17 +331,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (opline->extended_value == 1 && (opline - 1)->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(opline - 1) == IS_CONST && ZEND_OP1_LITERAL(opline - 1).type == IS_STRING && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP1_LITERAL(opline).type == IS_STRING) { - if ((Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("function_exists")-1 && + if ((Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("function_exists")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "function_exists", sizeof("function_exists")-1)) || - (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("is_callable")-1 && + (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("is_callable")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "is_callable", sizeof("is_callable")))) { zend_internal_function *func; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline - 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1))); - if (zend_hash_find(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)) + 1, + if (zend_hash_find(EG(function_table), lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)&func) == SUCCESS && func->type == ZEND_INTERNAL_FUNCTION && func->module->type == MODULE_PERSISTENT) { @@ -355,16 +355,16 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } efree(lc_name); - } else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("extension_loaded")-1 && + } else if (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("extension_loaded")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "extension_loaded", sizeof("extension_loaded")-1)) { zval t; zend_module_entry *m; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline - 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1))); if (zend_hash_find(&module_registry, - lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)&m) == FAILURE) { + lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)&m) == FAILURE) { if (!PG(enable_dl)) { break; } else { @@ -385,13 +385,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline); } efree(lc_name); - } else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("defined")-1 && + } else if (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("defined")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "defined", sizeof("defined")-1)) { zval t; if (zend_get_persistent_constant(Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), - Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)), &t, 0 TSRMLS_CC)) { + Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)), &t, 0 TSRMLS_CC)) { ZVAL_BOOL(&t, 1); if (replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { @@ -401,13 +401,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline); } } - } else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("constant")-1 && + } else if (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("constant")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "constant", sizeof("constant")-1)) { zval t; if (zend_get_persistent_constant(Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), - Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)), &t, 0 TSRMLS_CC)) { + Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)), &t, 0 TSRMLS_CC)) { if (replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { literal_dtor(&ZEND_OP1_LITERAL(opline - 1)); MAKE_NOP((opline - 1)); @@ -415,12 +415,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline); } } - } else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("strlen")-1 && + } else if (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("strlen")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "strlen", sizeof("strlen")-1)) { zval t; - ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1))); + ZVAL_LONG(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1))); if (replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC)) { literal_dtor(&ZEND_OP1_LITERAL(opline - 1)); MAKE_NOP((opline - 1)); @@ -436,8 +436,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->extended_value == 2 && ZEND_OP1_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("define")-1 && - zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 && + Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof("define")-1 && + zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 && (opline-1)->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(opline-1) == IS_CONST && (Z_TYPE(ZEND_OP1_LITERAL(opline-1)) <= IS_BOOL || @@ -509,7 +509,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->op1_type == IS_CONST && opline->op2_type == IS_UNUSED && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || + (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this")) != 0)) { int var = opline->result.var; @@ -549,13 +549,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { use->op1_type = IS_CV; use->op1.var = zend_optimizer_lookup_cv(op_array, Z_STRVAL(ZEND_OP1_LITERAL(opline)), - Z_STRLEN(ZEND_OP1_LITERAL(opline))); + Z_STRSIZE(ZEND_OP1_LITERAL(opline))); MAKE_NOP(opline); } else if (use->op2_type == IS_VAR && use->op2.var == var) { use->op2_type = IS_CV; use->op2.var = zend_optimizer_lookup_cv(op_array, Z_STRVAL(ZEND_OP1_LITERAL(opline)), - Z_STRLEN(ZEND_OP1_LITERAL(opline))); + Z_STRSIZE(ZEND_OP1_LITERAL(opline))); MAKE_NOP(opline); } } diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 0426f63..2a95b34 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -45,14 +45,14 @@ static void zend_optimizer_collect_constant(HashTable **constants, zval *name, z } val = *value; zval_copy_ctor(&val); - zend_hash_add(*constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val, sizeof(zval), NULL); + zend_hash_add(*constants, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, (void**)&val, sizeof(zval), NULL); } static int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value) { zval *val; - if (zend_hash_find(constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val) == SUCCESS) { + if (zend_hash_find(constants, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, (void**)&val) == SUCCESS) { *value = *val; zval_copy_ctor(value); return 1; @@ -64,7 +64,7 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam static int zend_optimizer_lookup_cv(zend_op_array *op_array, char* name, int name_len) { int i = 0; - ulong hash_value = zend_inline_hash_func(name, name_len+1); + zend_uint_t hash_value = zend_inline_hash_func(name, name_len+1); while (i < op_array->last_var) { if (op_array->vars[i].name == name || @@ -155,21 +155,21 @@ static void update_op1_const(zend_op_array *op_array, case ZEND_CATCH: case ZEND_FETCH_CONSTANT: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1); op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1); + op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRSIZE(op_array->literals[opline->op1.constant+1].constant) + 1); break; case ZEND_DO_FCALL: - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1); op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; break; default: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1); + Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1); break; } } else { @@ -189,7 +189,7 @@ static void update_op2_const(zend_op_array *op_array, #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); if (Z_TYPE_P(val) == IS_STRING) { - Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1); + Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)) + 1); switch (opline->opcode) { case ZEND_FETCH_R: case ZEND_FETCH_W: @@ -205,15 +205,15 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_ADD_INTERFACE: case ZEND_ADD_TRAIT: op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); + op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRSIZE(op_array->literals[opline->op2.constant+1].constant) + 1); break; case ZEND_INIT_METHOD_CALL: case ZEND_INIT_STATIC_METHOD_CALL: - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1); + op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRSIZE(op_array->literals[opline->op2.constant+1].constant) + 1); /* break missing intentionally */ /*case ZEND_FETCH_CONSTANT:*/ case ZEND_ASSIGN_OBJ: @@ -279,10 +279,10 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_FETCH_DIM_TMP_VAR: check_numeric: { - ulong index; + zend_uint_t index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(val), Z_STRLEN_P(val)+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(val), Z_STRSIZE_P(val)+1, index, numeric = 1); if (numeric) { zval_dtor(val); ZVAL_LONG(val, index); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 9398b58..c40e886 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -103,13 +103,13 @@ 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); #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO -static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); +static char *(*accelerator_orig_zend_resolve_path)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); #endif static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO -static char *accel_php_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC); +static char *accel_php_resolve_path(const char *filename, zend_str_size_int filename_length, const char *path TSRMLS_DC); #endif #ifdef ZEND_WIN32 @@ -249,7 +249,7 @@ static ZEND_INI_MH(accel_include_path_on_modify) /* Interned strings support */ static char *orig_interned_strings_start; static char *orig_interned_strings_end; -static const char *(*orig_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); +static const char *(*orig_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); static void (*orig_interned_strings_snapshot)(TSRMLS_D); static void (*orig_interned_strings_restore)(TSRMLS_D); @@ -257,7 +257,7 @@ static void (*orig_interned_strings_restore)(TSRMLS_D); * it creates interned strings in shared memory when saves a script. * Such interned strings are shared across all PHP processes */ -static const char *accel_new_interned_string_for_php(const char *str, int len, int free_src TSRMLS_DC) +static const char *accel_new_interned_string_for_php(const char *str, zend_str_size_int len, int free_src TSRMLS_DC) { return str; } @@ -309,8 +309,8 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre { /* for now interned strings are supported only for non-ZTS build */ #ifndef ZTS - ulong h; - uint nIndex; + zend_uint_t h; + zend_str_size_uint nIndex; Bucket *p; if (arKey >= ZCSG(interned_strings_start) && arKey < ZCSG(interned_strings_end)) { @@ -637,7 +637,7 @@ static inline int accel_is_inactive(TSRMLS_D) return FAILURE; } -static int zend_get_stream_timestamp(const char *filename, struct stat *statbuf TSRMLS_DC) +static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf TSRMLS_DC) { php_stream_wrapper *wrapper; php_stream_statbuf stream_statbuf; @@ -720,7 +720,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size TSRMLS_DC) { - struct stat statbuf; + zend_stat_t statbuf; #ifdef ZEND_WIN32 accel_time_t res; #endif @@ -729,7 +729,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle !EG(opline_ptr) && file_handle->filename == SG(request_info).path_translated) { - struct stat *tmpbuf = sapi_module.get_stat(TSRMLS_C); + zend_stat_t *tmpbuf = sapi_module.get_stat(TSRMLS_C); if (tmpbuf) { if (size) { @@ -748,12 +748,12 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle switch (file_handle->type) { case ZEND_HANDLE_FD: - if (fstat(file_handle->handle.fd, &statbuf) == -1) { + if (zend_fstat(file_handle->handle.fd, &statbuf) == -1) { return 0; } break; case ZEND_HANDLE_FP: - if (fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { + if (zend_fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { return 0; } @@ -1832,7 +1832,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl int filename_len; if (opline->op1.op_type == IS_CONST) { - filename_len = Z_STRLEN(opline->op1.u.constant); + filename_len = Z_STRSIZE(opline->op1.u.constant); } else { filename_len = strlen(filename); } @@ -1971,7 +1971,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl } /* 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, zend_str_size_int filename_len TSRMLS_DC) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 487010b..57f3047 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -181,13 +181,13 @@ typedef enum _zend_accel_restart_reason { } zend_accel_restart_reason; typedef struct _zend_persistent_script { - ulong hash_value; + zend_uint_t hash_value; char *full_path; /* full real path with resolved symlinks */ - unsigned int full_path_len; + zend_str_size_uint full_path_len; zend_op_array main_op_array; HashTable function_table; HashTable class_table; - long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ + zend_int_t compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ int ping_auto_globals_mask; /* which autoglobals are used by the script */ accel_time_t timestamp; /* the script modification time */ zend_bool corrupted; @@ -203,7 +203,7 @@ typedef struct _zend_persistent_script { */ struct zend_persistent_script_dynamic_members { time_t last_used; - ulong hits; + zend_uint_t hits; unsigned int memory_consumption; unsigned int checksum; time_t revalidate; @@ -211,12 +211,12 @@ typedef struct _zend_persistent_script { } zend_persistent_script; typedef struct _zend_accel_directives { - long memory_consumption; - long max_accelerated_files; + zend_int_t memory_consumption; + zend_int_t max_accelerated_files; double max_wasted_percentage; char *user_blacklist_filename; - long consistency_checks; - long force_restart_timeout; + zend_int_t consistency_checks; + zend_int_t force_restart_timeout; zend_bool use_cwd; zend_bool ignore_dups; zend_bool validate_timestamps; @@ -228,19 +228,19 @@ typedef struct _zend_accel_directives { zend_bool file_override_enabled; zend_bool inherited_hack; zend_bool enable_cli; - unsigned long revalidate_freq; - unsigned long file_update_protection; + zend_uint_t revalidate_freq; + zend_uint_t file_update_protection; char *error_log; #ifdef ZEND_WIN32 char *mmap_base; #endif char *memory_model; - long log_verbosity_level; + zend_int_t log_verbosity_level; - long optimization_level; - long max_file_size; + zend_int_t optimization_level; + zend_int_t max_file_size; #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO - long interned_strings_buffer; + zend_int_t interned_strings_buffer; #endif char *restrict_api; } zend_accel_directives; @@ -274,12 +274,12 @@ typedef struct _zend_accel_globals { typedef struct _zend_accel_shared_globals { /* Cache Data Structures */ - unsigned long hits; - unsigned long misses; - unsigned long blacklist_misses; - unsigned long oom_restarts; /* number of restarts because of out of memory */ - unsigned long hash_restarts; /* number of restarts because of hash overflow */ - unsigned long manual_restarts; /* number of restarts scheduled by opcache_reset() */ + zend_uint_t hits; + zend_uint_t misses; + zend_uint_t blacklist_misses; + zend_uint_t oom_restarts; /* number of restarts because of out of memory */ + zend_uint_t hash_restarts; /* number of restarts because of hash overflow */ + zend_uint_t manual_restarts; /* number of restarts scheduled by opcache_reset() */ zend_accel_hash hash; /* hash table for cached scripts */ zend_accel_hash include_paths; /* used "include_path" values */ @@ -292,8 +292,8 @@ typedef struct _zend_accel_shared_globals { zend_accel_restart_reason restart_reason; zend_bool cache_status_before_restart; #ifdef ZEND_WIN32 - unsigned long mem_usage; - unsigned long restart_in; + zend_uint_t mem_usage; + zend_uint_t restart_in; #endif zend_bool restart_in_progress; time_t revalidate_at; diff --git a/ext/opcache/zend_accelerator_blacklist.h b/ext/opcache/zend_accelerator_blacklist.h index 626b8d2..d27ef9e 100644 --- a/ext/opcache/zend_accelerator_blacklist.h +++ b/ext/opcache/zend_accelerator_blacklist.h @@ -26,7 +26,7 @@ typedef struct _zend_regexp_list zend_regexp_list; typedef struct _zend_blacklist_entry { char *path; - int path_length; + zend_str_size_int path_length; int id; } zend_blacklist_entry; diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c index afd227c..29738e2 100644 --- a/ext/opcache/zend_accelerator_hash.c +++ b/ext/opcache/zend_accelerator_hash.c @@ -71,10 +71,10 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size) * Returns pointer the actual hash entry on success * key needs to be already allocated as it is not copied */ -zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, zend_uint key_length, zend_bool indirect, void *data) +zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, zend_str_size_uint key_length, zend_bool indirect, void *data) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; zend_accel_hash_entry *indirect_bucket = NULL; @@ -140,10 +140,10 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char /* Returns the data associated with key on success * Returns NULL if data doesn't exist */ -void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key_length) +void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_str_size_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -168,10 +168,10 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key /* Returns the hash entry associated with key on success * Returns NULL if it doesn't exist */ -zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, zend_uint key_length) +zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, zend_str_size_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -193,10 +193,10 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c return NULL; } -int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key_length) +int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_str_size_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry, *last_entry=NULL; hash_value = zend_inline_hash_func(key, key_length); diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h index fdfddb4..d39151a 100644 --- a/ext/opcache/zend_accelerator_hash.h +++ b/ext/opcache/zend_accelerator_hash.h @@ -45,9 +45,9 @@ typedef struct _zend_accel_hash_entry zend_accel_hash_entry; struct _zend_accel_hash_entry { - zend_ulong hash_value; + zend_uint_t hash_value; char *key; - zend_uint key_length; + zend_str_size_uint key_length; zend_accel_hash_entry *next; void *data; zend_bool indirect; @@ -67,24 +67,24 @@ void zend_accel_hash_clean(zend_accel_hash *accel_hash); zend_accel_hash_entry* zend_accel_hash_update( zend_accel_hash *accel_hash, char *key, - zend_uint key_length, + zend_str_size_uint key_length, zend_bool indirect, void *data); void* zend_accel_hash_find( zend_accel_hash *accel_hash, char *key, - zend_uint key_length); + zend_str_size_uint key_length); zend_accel_hash_entry* zend_accel_hash_find_entry( zend_accel_hash *accel_hash, char *key, - zend_uint key_length); + zend_str_size_uint key_length); int zend_accel_hash_unlink( zend_accel_hash *accel_hash, char *key, - zend_uint key_length); + zend_str_size_uint key_length); static inline zend_bool zend_accel_hash_is_full(zend_accel_hash *accel_hash) { diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index cd840fd..4303406 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -94,8 +94,8 @@ static int validate_api_restriction(TSRMLS_D) static ZEND_INI_MH(OnUpdateMemoryConsumption) { - long *p; - long memsize; + php_int_t *p; + php_int_t memsize; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -105,7 +105,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base + (size_t)mh_arg1); + p = (php_int_t *) (base + (size_t)mh_arg1); memsize = atoi(new_value); /* sanity check we must use at least 8 MB */ if (memsize < 8) { @@ -132,8 +132,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) { - long *p; - long size; + php_int_t *p; + php_int_t size; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -143,7 +143,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base + (size_t)mh_arg1); + p = (php_int_t *) (base + (size_t)mh_arg1); size = atoi(new_value); /* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */ @@ -179,7 +179,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) static ZEND_INI_MH(OnUpdateMaxWastedPercentage) { double *p; - long percentage; + php_int_t percentage; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -290,8 +290,8 @@ static int ZEND_DECLARE_INHERITED_CLASS_DELAYED_HANDLER(ZEND_OPCODE_HANDLER_ARGS { zend_class_entry **pce, **pce_orig; - if (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op2.u.constant), Z_STRLEN(EX(opline)->op2.u.constant) + 1, (void **)&pce) == FAILURE || - (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op1.u.constant), Z_STRLEN(EX(opline)->op1.u.constant), (void**)&pce_orig) == SUCCESS && + if (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op2.u.constant), Z_STRSIZE(EX(opline)->op2.u.constant) + 1, (void **)&pce) == FAILURE || + (zend_hash_find(EG(class_table), Z_STRVAL(EX(opline)->op1.u.constant), Z_STRSIZE(EX(opline)->op1.u.constant), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(opline), EG(class_table), EX_T(EX(opline)->extended_value).class_entry, 0 TSRMLS_CC); } @@ -332,10 +332,10 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, &zfilename) == FAILURE || Z_TYPE_PP(zfilename) != IS_STRING || - Z_STRLEN_PP(zfilename) == 0) { + Z_STRSIZE_PP(zfilename) == 0) { return 0; } - return filename_is_in_cache(Z_STRVAL_PP(zfilename), Z_STRLEN_PP(zfilename) TSRMLS_CC); + return filename_is_in_cache(Z_STRVAL_PP(zfilename), Z_STRSIZE_PP(zfilename) TSRMLS_CC); } static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS) @@ -512,7 +512,7 @@ static zval* accelerator_get_scripts(TSRMLS_D) add_assoc_stringl(persistent_script_report, "last_used", str, len, 1); add_assoc_long(persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); if (ZCG(accel_directives).validate_timestamps) { - add_assoc_long(persistent_script_report, "timestamp", (long)script->timestamp); + add_assoc_long(persistent_script_report, "timestamp", (php_int_t)script->timestamp); } timerclear(&exec_time); timerclear(&fetch_time); @@ -529,7 +529,7 @@ static zval* accelerator_get_scripts(TSRMLS_D) Obtain statistics information regarding code acceleration */ static ZEND_FUNCTION(opcache_get_status) { - long reqs; + php_int_t reqs; zval *memory_usage,*statistics,*scripts; zend_bool fetch_scripts = 1; @@ -699,10 +699,10 @@ static ZEND_FUNCTION(opcache_reset) static ZEND_FUNCTION(opcache_invalidate) { char *script_name; - int script_name_len; + zend_str_size_int script_name_len; zend_bool force = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &script_name, &script_name_len, &force) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &script_name, &script_name_len, &force) == FAILURE) { return; } @@ -720,12 +720,12 @@ static ZEND_FUNCTION(opcache_invalidate) static ZEND_FUNCTION(opcache_compile_file) { char *script_name; - int script_name_len; + zend_str_size_int script_name_len; zend_file_handle handle; zend_op_array *op_array = NULL; zend_execute_data *orig_execute_data = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script_name, &script_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &script_name, &script_name_len) == FAILURE) { return; } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index e958232..694cf29 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -31,11 +31,11 @@ static zend_uint zend_accel_refcount = ZEND_PROTECTED_REFCOUNT; #if SIZEOF_SIZE_T <= SIZEOF_LONG /* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */ -# define accel_xlat_set(old, new) zend_hash_index_update(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old), &(new), sizeof(void*), NULL) -# define accel_xlat_get(old, new) zend_hash_index_find(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old), (void**)&(new)) +# define accel_xlat_set(old, new) zend_hash_index_update(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old), &(new), sizeof(void*), NULL) +# define accel_xlat_get(old, new) zend_hash_index_find(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new)) #else -# define accel_xlat_set(old, new) zend_hash_quick_add(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (ulong)(zend_uintptr_t)(old), (void**)&(new), sizeof(void*), NULL) -# define accel_xlat_get(old, new) zend_hash_quick_find(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (ulong)(zend_uintptr_t)(old), (void**)&(new)) +# define accel_xlat_set(old, new) zend_hash_quick_add(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new), sizeof(void*), NULL) +# define accel_xlat_get(old, new) zend_hash_quick_find(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new)) #endif typedef int (*id_function_t)(void *, void *); @@ -238,7 +238,7 @@ static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC) switch ((Z_TYPE_P(ast->u.val) & IS_CONSTANT_TYPE_MASK)) { case IS_STRING: case IS_CONSTANT: - Z_STRVAL_P(node->u.val) = (char *) interned_estrndup(Z_STRVAL_P(ast->u.val), Z_STRLEN_P(ast->u.val)); + Z_STRVAL_P(node->u.val) = (char *) interned_estrndup(Z_STRVAL_P(ast->u.val), Z_STRSIZE_P(ast->u.val)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: @@ -296,7 +296,7 @@ static inline zval* zend_clone_zval(zval *src, int bind TSRMLS_DC) #endif case IS_STRING: case IS_CONSTANT: - Z_STRVAL_P(ret) = (char *) interned_estrndup(Z_STRVAL_P(ret), Z_STRLEN_P(ret)); + Z_STRVAL_P(ret) = (char *) interned_estrndup(Z_STRVAL_P(ret), Z_STRSIZE_P(ret)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: @@ -318,7 +318,7 @@ static inline zval* zend_clone_zval(zval *src, int bind TSRMLS_DC) static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) { Bucket *p, *q, **prev; - ulong nIndex; + zend_uint_t nIndex; zval *ppz; TSRMLS_FETCH(); @@ -418,7 +418,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) #endif case IS_STRING: case IS_CONSTANT: - Z_STRVAL_P(ppz) = (char *) interned_estrndup(Z_STRVAL_P((zval*)p->pDataPtr), Z_STRLEN_P((zval*)p->pDataPtr)); + Z_STRVAL_P(ppz) = (char *) interned_estrndup(Z_STRVAL_P((zval*)p->pDataPtr), Z_STRSIZE_P((zval*)p->pDataPtr)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: @@ -443,7 +443,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC) { Bucket *p, *q, **prev; - ulong nIndex; + zend_uint_t nIndex; zend_class_entry **new_ce; zend_function** new_prototype; zend_op_array *new_entry; @@ -555,7 +555,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC) { Bucket *p, *q, **prev; - ulong nIndex; + zend_uint_t nIndex; zend_class_entry **new_ce; zend_property_info *prop_info; @@ -978,7 +978,7 @@ static void zend_do_delayed_early_binding(zend_op_array *op_array, zend_uint ear CG(in_compilation) = 1; while ((int)opline_num != -1) { - if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num - 1].op2.u.constant), Z_STRLEN(op_array->opcodes[opline_num - 1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL(op_array->opcodes[opline_num - 1].op2.u.constant), Z_STRSIZE(op_array->opcodes[opline_num - 1].op2.u.constant), &pce TSRMLS_CC) == SUCCESS) { do_bind_inherited_class(&op_array->opcodes[opline_num], EG(class_table), *pce, 1 TSRMLS_CC); } opline_num = op_array->opcodes[opline_num].result.u.opline_num; diff --git a/ext/opcache/zend_accelerator_util_funcs.h b/ext/opcache/zend_accelerator_util_funcs.h index ddaae86..b82499d 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, uint len); +unsigned int zend_adler32(unsigned int checksum, signed char *buf, zend_str_size_uint len); #endif /* ZEND_ACCELERATOR_UTIL_FUNCS_H */ diff --git a/ext/opcache/zend_persist.h b/ext/opcache/zend_persist.h index cf3fb73..ed1028a 100644 --- a/ext/opcache/zend_persist.h +++ b/ext/opcache/zend_persist.h @@ -23,7 +23,7 @@ #define ZEND_PERSIST_H int zend_accel_script_persistable(zend_persistent_script *script); -uint zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length TSRMLS_DC); -zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length TSRMLS_DC); +uint zend_accel_script_persist_calc(zend_persistent_script *script, char *key, zend_str_size_uint key_length TSRMLS_DC); +zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, zend_str_size_uint key_length TSRMLS_DC); #endif /* ZEND_PERSIST_H */ diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 8947c72..e290a39 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -124,7 +124,7 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC) #endif case IS_STRING: case IS_CONSTANT: - ADD_INTERNED_STRING(Z_STRVAL_P(z), Z_STRLEN_P(z) + 1); + ADD_INTERNED_STRING(Z_STRVAL_P(z), Z_STRSIZE_P(z) + 1); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index e94ecab..766d2d7 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -130,7 +130,7 @@ int zend_shared_memdup_size(void *p, size_t size); typedef union _align_test { void *ptr; double dbl; - long lng; + zend_int_t lng; } align_test; #if ZEND_GCC_VERSION >= 2000
« previous php.cvs (#74237) next »