diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-03-07 10:18:34 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-03-07 10:18:34 +0300 |
commit | d9231b16670cd450544cb0f050c72af9809e47e7 (patch) | |
tree | ad9dab7797576d6232e37590e8aede0645ee2c6b | |
parent | b273a8cbe44cf9ec13c6201c53eb52b9a66cc93b (diff) | |
download | php-git-d9231b16670cd450544cb0f050c72af9809e47e7.tar.gz |
Fixed pointer allignment
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 8 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_ssa.c | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 47f4337991..3bdc0310e6 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -1640,11 +1640,11 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{ ALLOCA_FLAG(use_heap); worklist = do_alloca( - sizeof(zend_ulong) * worklist_len + - sizeof(int) * ssa->vars_count + + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ulong) * worklist_len) + + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->vars_count) + sizeof(int) * ssa->sccs, use_heap); - next_scc_var = (int*)(worklist + worklist_len); - scc_var = next_scc_var + ssa->vars_count; + next_scc_var = (int*)((char*)worklist + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ulong) * worklist_len)); + scc_var = (int*)((char*)next_scc_var + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->vars_count)); LOG_SSA_RANGE("Range Inference\n"); diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 83b52707d8..c902e51766 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -77,12 +77,12 @@ static zend_ssa_phi *add_pi( } phi = zend_arena_calloc(arena, 1, - sizeof(zend_ssa_phi) + - sizeof(int) * ssa->cfg.blocks[to].predecessors_count + + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)) + + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[to].predecessors_count) + sizeof(void*) * ssa->cfg.blocks[to].predecessors_count); - phi->sources = (int*)(((char*)phi) + sizeof(zend_ssa_phi)); + phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi))); memset(phi->sources, 0xff, sizeof(int) * ssa->cfg.blocks[to].predecessors_count); - phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + sizeof(int) * ssa->cfg.blocks[to].predecessors_count); + phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[to].predecessors_count)); phi->pi = from; phi->var = var; @@ -947,13 +947,13 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_ if (!zend_bitset_empty(phi + j * set_size, set_size)) { ZEND_BITSET_REVERSE_FOREACH(phi + j * set_size, set_size, i) { zend_ssa_phi *phi = zend_arena_calloc(arena, 1, - sizeof(zend_ssa_phi) + - sizeof(int) * blocks[j].predecessors_count + + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi)) + + ZEND_MM_ALIGNED_SIZE(sizeof(int) * blocks[j].predecessors_count) + sizeof(void*) * blocks[j].predecessors_count); - phi->sources = (int*)(((char*)phi) + sizeof(zend_ssa_phi)); + phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi))); memset(phi->sources, 0xff, sizeof(int) * blocks[j].predecessors_count); - phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + sizeof(int) * ssa->cfg.blocks[j].predecessors_count); + phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa->cfg.blocks[j].predecessors_count)); phi->pi = -1; phi->var = i; |