diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/opcache/Optimizer/compact_literals.c | 4 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/zend_cfg.c | 2 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/zend_dfg.c | 3 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/zend_dump.c | 10 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/zend_func_info.c | 16 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 8 | ||||
| -rw-r--r-- | ext/opcache/ZendAccelerator.c | 17 | ||||
| -rw-r--r-- | ext/opcache/zend_accelerator_module.c | 4 | ||||
| -rw-r--r-- | ext/opcache/zend_persist.c | 16 | ||||
| -rw-r--r-- | ext/opcache/zend_persist_calc.c | 6 |
10 files changed, 41 insertions, 45 deletions
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 68178f5873..445b579f59 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -283,7 +283,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx break; case ZEND_RECV_INIT: LITERAL_INFO(opline->op2.constant, LITERAL_VALUE, 0, 0, 1); - if (Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) != -1) { + if (Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) != (uint32_t)-1) { Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = cache_size; cache_size += sizeof(void *); } @@ -297,7 +297,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx case ZEND_RECV: case ZEND_RECV_VARIADIC: case ZEND_VERIFY_RETURN_TYPE: - if (opline->op2.num != -1) { + if (opline->op2.num != (uint32_t)-1) { opline->op2.num = cache_size; cache_size += sizeof(void *); } diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c index e986ac0c20..335ad75827 100644 --- a/ext/opcache/Optimizer/zend_cfg.c +++ b/ext/opcache/Optimizer/zend_cfg.c @@ -112,7 +112,7 @@ static void zend_mark_reachable_blocks(const zend_op_array *op_array, zend_cfg * b->start++; b->len--; } - if (b->len == 0 && b->successors[0] == block_map[live_range->end]) { + if (b->len == 0 && (uint32_t)b->successors[0] == block_map[live_range->end]) { /* mark as removed (empty live range) */ live_range->var = (uint32_t)-1; continue; diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c index 97fc846d3c..1fc42e8fe8 100644 --- a/ext/opcache/Optimizer/zend_dfg.c +++ b/ext/opcache/Optimizer/zend_dfg.c @@ -26,7 +26,8 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg zend_basic_block *blocks = cfg->blocks; int blocks_count = cfg->blocks_count; zend_bitset tmp, def, use, in, out; - uint32_t k, var_num; + int k; + uint32_t var_num; int j; set_size = dfg->size; diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c index a2eeb886ee..a611b55cd5 100644 --- a/ext/opcache/Optimizer/zend_dump.c +++ b/ext/opcache/Optimizer/zend_dump.c @@ -887,10 +887,12 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons fprintf(stderr, " ; %s:%u-%u\n", op_array->filename->val, op_array->line_start, op_array->line_end); if (func_info && func_info->num_args > 0) { - for (i = 0; i < MIN(op_array->num_args, func_info->num_args ); i++) { - fprintf(stderr, " ; arg %d ", i); - zend_dump_type_info(func_info->arg_info[i].info.type, func_info->arg_info[i].info.ce, func_info->arg_info[i].info.is_instanceof, dump_flags); - zend_dump_range(&func_info->arg_info[i].info.range); + uint32_t j; + + for (j = 0; j < MIN(op_array->num_args, func_info->num_args ); j++) { + fprintf(stderr, " ; arg %d ", j); + zend_dump_type_info(func_info->arg_info[j].info.type, func_info->arg_info[j].info.ce, func_info->arg_info[j].info.is_instanceof, dump_flags); + zend_dump_range(&func_info->arg_info[j].info.range); fprintf(stderr, "\n"); } } diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 9a1a9e25d4..c53e042e9f 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -53,7 +53,7 @@ typedef struct _func_info_t { static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { uint32_t tmp = MAY_BE_RC1; @@ -83,7 +83,7 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { return MAY_BE_RC1 | MAY_BE_STRING; } else { @@ -94,7 +94,7 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && (call_info->num_args == 2 || call_info->num_args == 3)) { uint32_t t1 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -130,7 +130,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { return MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_TRUE | FUNC_MAY_INLINE; } else { @@ -140,7 +140,7 @@ static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ss static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 2) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -165,7 +165,7 @@ static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa * static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 3) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline); @@ -192,7 +192,7 @@ static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -1251,7 +1251,7 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa int zend_func_info_startup(void) { zend_extension dummy; - int i; + size_t i; if (zend_func_info_rid == -1) { zend_func_info_rid = zend_get_resource_handle(&dummy); diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index ee14e49b5c..1e6e50b3ef 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -85,7 +85,7 @@ if (ssa->ops[line-1].result_def >= 0) { \ MACRO(ssa->ops[line-1].result_def); \ } \ - } else if (line+1 < op_array->last && \ + } else if ((uint32_t)line+1 < op_array->last && \ op_array->opcodes[line+1].opcode == ZEND_OP_DATA) { \ if (ssa->ops[line+1].op1_def >= 0) { \ MACRO(ssa->ops[line+1].op1_def); \ @@ -3437,8 +3437,7 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script zend_ssa_var *ssa_vars = ssa->vars; zend_ssa_var_info *ssa_var_info = ssa->var_info; int ssa_vars_count = ssa->vars_count; - uint i; - int j; + int i, j; uint32_t tmp; while (!zend_bitset_empty(worklist, zend_bitset_len(ssa_vars_count))) { @@ -3674,8 +3673,7 @@ static int zend_type_narrowing(const zend_op_array *op_array, const zend_script ALLOCA_FLAG(use_heap); zend_bitset visited = ZEND_BITSET_ALLOCA(2 * bitset_len, use_heap); zend_bitset worklist = visited + bitset_len; - int i; - uint32_t v; + int i, v; zend_op *opline; zend_bool narrowed = 0; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index be8a57c341..bd141d5215 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1427,7 +1427,7 @@ static void zend_accel_init_auto_globals(void) } } -static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handle, int type, char *key, unsigned int key_length, zend_op_array **op_array_p) +static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handle, int type, char *key, zend_op_array **op_array_p) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1440,12 +1440,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl /* Try to open file */ if (file_handle->type == ZEND_HANDLE_FILENAME) { - if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == SUCCESS) { - /* key may be changed by zend_stream_open_function() */ - if (key == ZCG(key)) { - key_length = ZCG(key_len); - } - } else { + if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) != SUCCESS) { *op_array_p = NULL; if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); @@ -1484,7 +1479,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl /* check if file is too new (may be it's not written completely yet) */ if (ZCG(accel_directives).file_update_protection && - (ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) { + ((accel_time_t)(ZCG(request_time) - ZCG(accel_directives).file_update_protection) < timestamp)) { *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } @@ -1637,7 +1632,7 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type) return zend_accel_load_script(persistent_script, 1); } - persistent_script = opcache_compile_file(file_handle, type, NULL, 0, &op_array); + persistent_script = opcache_compile_file(file_handle, type, NULL, &op_array); if (persistent_script) { from_memory = 0; @@ -1834,7 +1829,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) * If it isn't compile_and_cache_file() changes the flag to 0 */ from_shared_memory = 0; - persistent_script = opcache_compile_file(file_handle, type, key, key ? key_length : 0, &op_array); + persistent_script = opcache_compile_file(file_handle, type, key, &op_array); if (persistent_script) { persistent_script = cache_script_in_shared_memory(persistent_script, key, key ? key_length : 0, &from_shared_memory); } @@ -2060,7 +2055,7 @@ static void accel_activate(void) ZCG(include_path_check) = 1; /* check if ZCG(function_table) wasn't somehow polluted on the way */ - if (ZCG(internal_functions_count) != zend_hash_num_elements(&ZCG(function_table))) { + if (ZCG(internal_functions_count) != (zend_long)zend_hash_num_elements(&ZCG(function_table))) { zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table))); } diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 0e1069836c..b8a3410895 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -80,13 +80,13 @@ static zend_function_entry accel_functions[] = { /* Private functions */ ZEND_FE(opcache_get_configuration, arginfo_opcache_none) ZEND_FE(opcache_get_status, arginfo_opcache_get_status) - { NULL, NULL, NULL, 0, 0 } + ZEND_FE_END }; static int validate_api_restriction(void) { if (ZCG(accel_directives).restrict_api && *ZCG(accel_directives).restrict_api) { - int len = strlen(ZCG(accel_directives).restrict_api); + size_t len = strlen(ZCG(accel_directives).restrict_api); if (!SG(request_info).path_translated || strlen(SG(request_info).path_translated) < len || diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 25a504575d..24a3d21ca2 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -89,21 +89,21 @@ static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement void *data = HT_GET_DATA_ADDR(ht); zend_accel_store(data, HT_USED_SIZE(ht)); HT_SET_DATA_ADDR(ht, data); - } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ void *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } } - ht->nTableMask = -hash_size; + ht->nTableMask = (uint32_t)(-(int32_t)hash_size); ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ HT_SET_DATA_ADDR(ht, ZCG(mem)); ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE((hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket)))); @@ -171,21 +171,21 @@ static void zend_hash_persist_immutable(HashTable *ht) } if (ht->u.flags & HASH_FLAG_PACKED) { HT_SET_DATA_ADDR(ht, zend_accel_memdup(HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht))); - } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ void *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } } - ht->nTableMask = -hash_size; + ht->nTableMask = (uint32_t)(-(int32_t)hash_size); ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ HT_SET_DATA_ADDR(ht, ZCG(mem)); ZCG(mem) = (void*)((char*)ZCG(mem) + (hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket))); diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 22e74d6b36..84cd417204 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -60,14 +60,14 @@ static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval * return; } - if (!(ht->u.flags & HASH_FLAG_PACKED) && ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + if (!(ht->u.flags & HASH_FLAG_PACKED) && ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } |
