com php-src: Avoid generation of dead jumps: ext/opcache/jit/ze nd_jit.c

From: Date: Tue, 02 Apr 2019 15:18:00 +0000
Subject: com php-src: Avoid generation of dead jumps: ext/opcache/jit/ze nd_jit.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-105489@lists.php.net to get a copy of this message
Commit: 278c8e7b59e9a7ab96901d7a0816d5226acb6363 Author: Dmitry Stogov <dmitry@zend.com> Tue, 2 Apr 2019 18:18:00 +0300 Parents: 0d6fce887b19e1b78778bf41421f18f5ffcdeb7f Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=278c8e7b59e9a7ab96901d7a0816d5226acb6363 Log: Avoid generation of dead jumps Changed paths: M ext/opcache/jit/zend_jit.c Diff: diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index d8e441c..a9d1671 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -1987,6 +1987,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op void *checkpoint = NULL; zend_lifetime_interval **ra = NULL; zend_bitset checked_this = NULL; + zend_bool is_terminated = 1; /* previous basic block is terminated by jump */ if (zend_jit_reg_alloc) { checkpoint = zend_arena_checkpoint(CG(arena)); @@ -2019,7 +2020,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op } #ifndef CONTEXT_THREADED_JIT if (ssa->cfg.blocks[b].flags & ZEND_BB_ENTRY) { - if (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET) { + if (!is_terminated && (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET)) { zend_jit_jmp(&dasm_state, b); } zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b); @@ -2055,6 +2056,8 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op } } + is_terminated = 0; + if (ssa->cfg.blocks[b].len == 1 && ssa->cfg.blocks[b].start != 0 && zend_is_smart_branch(&op_array->opcodes[ssa->cfg.blocks[b].start-1])) { @@ -2254,6 +2257,8 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op } goto done; case ZEND_DO_UCALL: + is_terminated = 1; + /* break missing intentionally */ case ZEND_DO_ICALL: case ZEND_DO_FCALL_BY_NAME: case ZEND_DO_FCALL: @@ -2402,6 +2407,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op if (!zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) { goto jit_failure; } + is_terminated = 1; break; case ZEND_CATCH: case ZEND_FAST_CALL: @@ -2417,6 +2423,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op if (!zend_jit_tail_handler(&dasm_state, opline)) { goto jit_failure; } + is_terminated = 1; break; /* stackless execution */ case ZEND_INCLUDE_OR_EVAL: @@ -2426,6 +2433,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op if (!zend_jit_call(&dasm_state, opline)) { goto jit_failure; } + is_terminated = 1; break; case ZEND_JMPZNZ: if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) || @@ -2433,6 +2441,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op !zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) { goto jit_failure; } + is_terminated = 1; break; case ZEND_JMPZ: case ZEND_JMPNZ:

« previous php.cvs (#105489) next »