Created
September 24, 2019 13:06
-
-
Save dstogov/9dd1c49c0d17056f26766d8f0ad3225e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c | |
index 9f499baf6f..860b4d0a85 100644 | |
--- a/Zend/zend_compile.c | |
+++ b/Zend/zend_compile.c | |
@@ -5914,6 +5914,8 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /* | |
zend_oparray_context_begin(&orig_oparray_context); | |
+ zend_emit_op(NULL, ZEND_ENTER, NULL, NULL); | |
+ | |
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) { | |
zend_op *opline_ext = zend_emit_op(NULL, ZEND_EXT_NOP, NULL, NULL); | |
opline_ext->lineno = decl->start_lineno; | |
@@ -5951,6 +5953,13 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /* | |
zend_do_extended_stmt(); | |
zend_emit_final_return(0); | |
+ ZEND_ASSERT(op_array->opcodes[0].opcode == ZEND_ENTER); | |
+ op_array->opcodes[0].lineno = decl->start_lineno; | |
+ op_array->opcodes[0].op1.num = op_array->num_args; | |
+ op_array->opcodes[0].op2.num = op_array->last_var; | |
+ op_array->opcodes[0].extended_value = | |
+ (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0; | |
+ | |
pass_two(CG(active_op_array)); | |
zend_oparray_context_end(&orig_oparray_context); | |
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c | |
index 2c3ed7e5ae..a5231d3793 100644 | |
--- a/Zend/zend_execute.c | |
+++ b/Zend/zend_execute.c | |
@@ -3347,12 +3347,6 @@ ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data) /* { | |
} \ | |
} while (0) | |
-#define ZEND_VM_LOOP_INTERRUPT_CHECK() do { \ | |
- if (UNEXPECTED(EG(vm_interrupt))) { \ | |
- ZEND_VM_LOOP_INTERRUPT(); \ | |
- } \ | |
- } while (0) | |
- | |
/* | |
* Stack Frame Layout (the whole stack frame is allocated at once) | |
* ================== | |
@@ -3392,16 +3386,6 @@ static zend_never_inline void zend_copy_extra_args(EXECUTE_DATA_D) | |
uint32_t count; | |
uint32_t type_flags = 0; | |
- if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) { | |
- /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */ | |
-#if defined(ZEND_VM_IP_GLOBAL_REG) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)) | |
- opline += first_extra_arg; | |
-#else | |
- EX(opline) += first_extra_arg; | |
-#endif | |
- | |
- } | |
- | |
/* move extra args into separate array after all CV and TMP vars */ | |
src = EX_VAR_NUM(num_args - 1); | |
delta = op_array->last_var + op_array->T - first_extra_arg; | |
@@ -3443,7 +3427,6 @@ static zend_always_inline void zend_init_cvs(uint32_t first, uint32_t last EXECU | |
static zend_always_inline void i_init_func_execute_data(zend_op_array *op_array, zval *return_value, zend_bool may_be_trampoline EXECUTE_DATA_DC) /* {{{ */ | |
{ | |
- uint32_t first_extra_arg, num_args; | |
ZEND_ASSERT(EX(func) == (zend_function*)op_array); | |
#if defined(ZEND_VM_IP_GLOBAL_REG) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)) | |
@@ -3453,28 +3436,7 @@ static zend_always_inline void i_init_func_execute_data(zend_op_array *op_array, | |
#endif | |
EX(call) = NULL; | |
EX(return_value) = return_value; | |
- | |
- /* Handle arguments */ | |
- first_extra_arg = op_array->num_args; | |
- num_args = EX_NUM_ARGS(); | |
- if (UNEXPECTED(num_args > first_extra_arg)) { | |
- if (!may_be_trampoline || EXPECTED(!(op_array->fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))) { | |
- zend_copy_extra_args(EXECUTE_DATA_C); | |
- } | |
- } else if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) { | |
- /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */ | |
-#if defined(ZEND_VM_IP_GLOBAL_REG) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)) | |
- opline += num_args; | |
-#else | |
- EX(opline) += num_args; | |
-#endif | |
- } | |
- | |
- /* Initialize CV variables (skip arguments) */ | |
- zend_init_cvs(num_args, op_array->last_var EXECUTE_DATA_CC); | |
- | |
EX(run_time_cache) = RUN_TIME_CACHE(op_array); | |
- | |
EG(current_execute_data) = execute_data; | |
} | |
/* }}} */ | |
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h | |
index 3b059f3920..58be481e1f 100644 | |
--- a/Zend/zend_vm_def.h | |
+++ b/Zend/zend_vm_def.h | |
@@ -3011,6 +3011,32 @@ ZEND_VM_HOT_HANDLER(42, ZEND_JMP, JMP_ADDR, ANY) | |
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op1), 0); | |
} | |
+ZEND_VM_HOT_HANDLER(195, ZEND_ENTER, NUM, NUM, NUM, SPEC(TYPE_HINTS)) | |
+{ | |
+ USE_OPLINE | |
+ uint32_t num_args = EX_NUM_ARGS(); | |
+ | |
+ /* Initialize CV variables (skip arguments) */ | |
+ zend_init_cvs(num_args, opline->op2.num /*EX(func)->op_array.last_var*/ EXECUTE_DATA_CC); | |
+ | |
+ /* Handle arguments */ | |
+ if (UNEXPECTED(num_args > opline->op1.num /*EX(func)->op_array.num_args*/)) { | |
+ zend_copy_extra_args(EXECUTE_DATA_C); | |
+ num_args = opline->op1.num; /*EX(func)->op_array.num_args*/ | |
+ } | |
+ | |
+ if (EXPECTED(!opline->extended_value /*(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0*/)) { | |
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */ | |
+ opline += num_args + 1; | |
+ } else { | |
+ opline++; | |
+ } | |
+ | |
+ ZEND_VM_SET_OPCODE(opline); | |
+ ZEND_VM_INTERRUPT_CHECK(); | |
+ ZEND_VM_CONTINUE(); | |
+} | |
+ | |
ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR) | |
{ | |
USE_OPLINE | |
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl | |
index 27aae16391..4a8daed7da 100644 | |
--- a/Zend/zend_vm_execute.skl | |
+++ b/Zend/zend_vm_execute.skl | |
@@ -14,7 +14,6 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *ex) | |
{%INTERNAL_LABELS%} | |
LOAD_OPLINE(); | |
- ZEND_VM_LOOP_INTERRUPT_CHECK(); | |
while (1) { | |
{%ZEND_VM_CONTINUE_LABEL%} | |
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php | |
index 24df28f586..ebfd3f6fa8 100755 | |
--- a/Zend/zend_vm_gen.php | |
+++ b/Zend/zend_vm_gen.php | |
@@ -831,6 +831,9 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp | |
"/opline->extended_value\s*&\s*~\s*ZEND_ISEMPTY/" => isset($extra_spec['ISSET']) ? | |
($extra_spec['ISSET'] == 0 ? "\\0" : "opline->extended_value") | |
: "\\0", | |
+ "/opline->extended_value/" => | |
+ isset($extra_spec['TYPE_HINTS']) ? | |
+ ($extra_spec['TYPE_HINTS'] ? "1" : "0") : "\\0", | |
); | |
$code = preg_replace(array_keys($specialized_replacements), array_values($specialized_replacements), $code); | |
@@ -1569,6 +1572,11 @@ function extra_spec_name($extra_spec) { | |
$s .= "_EMPTY"; | |
} | |
} | |
+ if (isset($extra_spec["TYPE_HINTS"])) { | |
+ if ($extra_spec["TYPE_HINTS"]) { | |
+ $s .= "_TYPE_HINTS"; | |
+ } | |
+ } | |
return $s; | |
} | |
@@ -1592,6 +1600,9 @@ function extra_spec_flags($extra_spec) { | |
if (isset($extra_spec["ISSET"])) { | |
$s[] = "SPEC_RULE_ISSET"; | |
} | |
+ if (isset($extra_spec["TYPE_HINTS"])) { | |
+ $s[] = "SPEC_RULE_TYPE_HINTS"; | |
+ } | |
return $s; | |
} | |
@@ -1788,6 +1799,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,"#define SPEC_RULE_RETVAL 0x00080000\n"); | |
out($f,"#define SPEC_RULE_QUICK_ARG 0x00100000\n"); | |
out($f,"#define SPEC_RULE_SMART_BRANCH 0x00200000\n"); | |
+ out($f,"#define SPEC_RULE_TYPE_HINTS 0x00400000\n"); | |
out($f,"#define SPEC_RULE_COMMUTATIVE 0x00800000\n"); | |
out($f,"#define SPEC_RULE_ISSET 0x01000000\n"); | |
out($f,"\n"); | |
@@ -1907,7 +1919,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n"); | |
out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n"); | |
out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG)\n"); | |
- out($f,"# define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n"); | |
+ out($f,"# define ZEND_VM_ENTER_EX() ZEND_VM_CONTINUE()\n"); | |
out($f,"# define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_ENTER_EX()\n"); | |
out($f,"# define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); | |
out($f,"#elif defined(ZEND_VM_IP_GLOBAL_REG)\n"); | |
@@ -1920,7 +1932,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,"# define ZEND_VM_LEAVE() return 2\n"); | |
out($f,"#endif\n"); | |
out($f,"#define ZEND_VM_INTERRUPT() ZEND_VM_TAIL_CALL(zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n"); | |
- out($f,"#define ZEND_VM_LOOP_INTERRUPT() zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n"); | |
if ($kind == ZEND_VM_KIND_HYBRID) { | |
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_opcode_handler_func(opcode, opline))(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n"); | |
} else { | |
@@ -1959,11 +1970,10 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n"); | |
out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n"); | |
out($f,"#define ZEND_VM_RETURN() return\n"); | |
- out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n"); | |
+ out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_CONTINUE()\n"); | |
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_ENTER_EX()\n"); | |
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); | |
out($f,"#define ZEND_VM_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";\n"); | |
- out($f,"#define ZEND_VM_LOOP_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";\n"); | |
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n"); | |
out($f,"\n"); | |
break; | |
@@ -2000,11 +2010,10 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
} | |
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n"); | |
out($f,"#define ZEND_VM_RETURN() return\n"); | |
- out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n"); | |
+ out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_CONTINUE()\n"); | |
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_ENTER_EX()\n"); | |
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n"); | |
out($f,"#define ZEND_VM_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";\n"); | |
- out($f,"#define ZEND_VM_LOOP_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";\n"); | |
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n"); | |
out($f,"\n"); | |
break; | |
@@ -2153,7 +2162,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
"#else\n" . | |
$m[1]."if (EXPECTED(ret > 0)) {\n" . | |
$m[1]."\texecute_data = EG(current_execute_data);\n". | |
- $m[1]."\tZEND_VM_LOOP_INTERRUPT_CHECK();\n". | |
$m[1]."} else {\n" . | |
"# ifdef ZEND_VM_IP_GLOBAL_REG\n" . | |
$m[1]."\topline = orig_opline;\n" . | |
@@ -2291,6 +2299,9 @@ function parse_spec_rules($def, $lineno, $str) { | |
case "ISSET": | |
$ret["ISSET"] = array(0, 1); | |
break; | |
+ case "TYPE_HINTS": | |
+ $ret["TYPE_HINTS"] = array(0, 1); | |
+ break; | |
default: | |
die("ERROR ($def:$lineno): Wrong specialization rules '$str'\n"); | |
} | |
@@ -2718,7 +2729,8 @@ function gen_vm($def, $skel) { | |
isset($used_extra_spec["RETVAL"]) || | |
isset($used_extra_spec["QUICK_ARG"]) || | |
isset($used_extra_spec["SMART_BRANCH"]) || | |
- isset($used_extra_spec["ISSET"])) { | |
+ isset($used_extra_spec["ISSET"]) || | |
+ isset($used_extra_spec["TYPE_HINTS"])) { | |
$else = ""; | |
out($f, "\tif (spec & SPEC_EXTRA_MASK) {\n"); | |
@@ -2753,6 +2765,14 @@ function gen_vm($def, $skel) { | |
out($f, "\t\t\t}\n"); | |
$else = "} else "; | |
} | |
+ if (isset($used_extra_spec["TYPE_HINTS"])) { | |
+ out($f, "\t\t{$else}if (spec & SPEC_RULE_TYPE_HINTS) {\n"); | |
+ out($f, "\t\t\toffset = offset * 2;\n"); | |
+ out($f, "\t\t\tif (op->extended_value) {\n"); | |
+ out($f, "\t\t\t\toffset += 1;\n"); | |
+ out($f, "\t\t\t}\n"); | |
+ $else = "} else "; | |
+ } | |
if ($else !== "") { | |
out($f, "\t\t}\n"); | |
} | |
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c | |
index 0a99ac4140..88dc164a59 100644 | |
--- a/ext/opcache/Optimizer/compact_literals.c | |
+++ b/ext/opcache/Optimizer/compact_literals.c | |
@@ -780,6 +780,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx | |
if (1) { | |
opline = op_array->opcodes; | |
+ if (opline->opcode == ZEND_ENTER) { | |
+ opline++; | |
+ } | |
while (1) { | |
if (opline->opcode == ZEND_RECV_INIT) { | |
zval *val = &op_array->literals[opline->op2.constant]; | |
diff --git a/ext/opcache/Optimizer/compact_vars.c b/ext/opcache/Optimizer/compact_vars.c | |
index bf7a005787..0e7827ccf2 100644 | |
--- a/ext/opcache/Optimizer/compact_vars.c | |
+++ b/ext/opcache/Optimizer/compact_vars.c | |
@@ -116,6 +116,9 @@ void zend_optimizer_compact_vars(zend_op_array *op_array) { | |
op_array->vars = NULL; | |
} | |
op_array->last_var = num_cvs; | |
+ if (op_array->opcodes[0].opcode == ZEND_ENTER) { | |
+ op_array->opcodes[0].op2.num = num_cvs; | |
+ } | |
} | |
op_array->T = num_tmps; | |
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c | |
index ae707a2409..dbf47fdb81 100644 | |
--- a/ext/opcache/Optimizer/optimize_func_calls.c | |
+++ b/ext/opcache/Optimizer/optimize_func_calls.c | |
@@ -98,9 +98,9 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o | |
/* TODO: function copied from trait may be inconsistent ??? */ | |
&& !(func->op_array.fn_flags & (ZEND_ACC_TRAIT_CLONE)) | |
&& fcall->extended_value >= func->op_array.required_num_args | |
- && func->op_array.opcodes[func->op_array.num_args].opcode == ZEND_RETURN) { | |
+ && func->op_array.opcodes[func->op_array.num_args + 1].opcode == ZEND_RETURN) { | |
- zend_op *ret_opline = func->op_array.opcodes + func->op_array.num_args; | |
+ zend_op *ret_opline = func->op_array.opcodes + func->op_array.num_args + 1; | |
if (ret_opline->op1_type == IS_CONST) { | |
uint32_t i, num_args = func->op_array.num_args; | |
@@ -123,7 +123,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o | |
if (fcall->extended_value < func->op_array.num_args) { | |
/* don't inline functions with named constants in default arguments */ | |
- i = fcall->extended_value; | |
+ i = fcall->extended_value + 1; | |
do { | |
if (Z_TYPE_P(RT_CONSTANT(&func->op_array.opcodes[i], func->op_array.opcodes[i].op2)) == IS_CONSTANT_AST) { | |
diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c | |
index 5e0f137024..9d18f76023 100644 | |
--- a/ext/opcache/Optimizer/zend_cfg.c | |
+++ b/ext/opcache/Optimizer/zend_cfg.c | |
@@ -59,12 +59,6 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc | |
succ->flags |= ZEND_BB_ENTRY; | |
} | |
} | |
- if ((cfg->flags & ZEND_CFG_RECV_ENTRY)) { | |
- if (opcode == ZEND_RECV || | |
- opcode == ZEND_RECV_INIT) { | |
- succ->flags |= ZEND_BB_RECV_ENTRY; | |
- } | |
- } | |
} | |
} else if (b->successors_count == 2) { | |
if (i == 0 || opcode == ZEND_JMPZNZ) { | |
@@ -279,7 +273,7 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b | |
zval *zv; | |
zend_bool extra_entry_block = 0; | |
- cfg->flags = build_flags & (ZEND_CFG_STACKLESS|ZEND_CFG_RECV_ENTRY); | |
+ cfg->flags = build_flags & ZEND_CFG_STACKLESS; | |
cfg->map = block_map = zend_arena_calloc(arena, op_array->last, sizeof(uint32_t)); | |
@@ -288,12 +282,6 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b | |
for (i = 0; i < op_array->last; i++) { | |
zend_op *opline = op_array->opcodes + i; | |
switch (opline->opcode) { | |
- case ZEND_RECV: | |
- case ZEND_RECV_INIT: | |
- if (build_flags & ZEND_CFG_RECV_ENTRY) { | |
- BB_START(i + 1); | |
- } | |
- break; | |
case ZEND_RETURN: | |
case ZEND_RETURN_BY_REF: | |
case ZEND_GENERATOR_RETURN: | |
diff --git a/ext/opcache/Optimizer/zend_cfg.h b/ext/opcache/Optimizer/zend_cfg.h | |
index 7d6ef25eee..afe9ea74db 100644 | |
--- a/ext/opcache/Optimizer/zend_cfg.h | |
+++ b/ext/opcache/Optimizer/zend_cfg.h | |
@@ -30,14 +30,13 @@ | |
#define ZEND_BB_FINALLY (1<<7) /* start of finally block */ | |
#define ZEND_BB_FINALLY_END (1<<8) /* end of finally block */ | |
#define ZEND_BB_UNREACHABLE_FREE (1<<11) /* unreachable loop free */ | |
-#define ZEND_BB_RECV_ENTRY (1<<12) /* RECV entry */ | |
#define ZEND_BB_LOOP_HEADER (1<<16) | |
#define ZEND_BB_IRREDUCIBLE_LOOP (1<<17) | |
#define ZEND_BB_REACHABLE (1U<<31) | |
-#define ZEND_BB_PROTECTED (ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY|ZEND_BB_TRY|ZEND_BB_CATCH|ZEND_BB_FINALLY|ZEND_BB_FINALLY_END|ZEND_BB_UNREACHABLE_FREE) | |
+#define ZEND_BB_PROTECTED (ZEND_BB_ENTRY|ZEND_BB_TRY|ZEND_BB_CATCH|ZEND_BB_FINALLY|ZEND_BB_FINALLY_END|ZEND_BB_UNREACHABLE_FREE) | |
typedef struct _zend_basic_block { | |
int *successors; /* successor block indices */ | |
@@ -98,7 +97,6 @@ typedef struct _zend_cfg { | |
#define ZEND_SSA_DEBUG_PHI_PLACEMENT (1<<28) | |
#define ZEND_SSA_RC_INFERENCE (1<<27) | |
#define ZEND_CFG_NO_ENTRY_PREDECESSORS (1<<25) | |
-#define ZEND_CFG_RECV_ENTRY (1<<24) | |
#define ZEND_CALL_TREE (1<<23) | |
#define ZEND_SSA_USE_CV_RESULTS (1<<22) | |
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c | |
index 8dcbd33b54..007732ea40 100644 | |
--- a/ext/opcache/Optimizer/zend_dump.c | |
+++ b/ext/opcache/Optimizer/zend_dump.c | |
@@ -726,9 +726,6 @@ static void zend_dump_block_info(const zend_cfg *cfg, int n, uint32_t dump_flags | |
if (b->flags & ZEND_BB_START) { | |
fprintf(stderr, " start"); | |
} | |
- if (b->flags & ZEND_BB_RECV_ENTRY) { | |
- fprintf(stderr, " recv"); | |
- } | |
if (b->flags & ZEND_BB_FOLLOW) { | |
fprintf(stderr, " follow"); | |
} | |
@@ -738,7 +735,7 @@ static void zend_dump_block_info(const zend_cfg *cfg, int n, uint32_t dump_flags | |
if (b->flags & ZEND_BB_EXIT) { | |
fprintf(stderr, " exit"); | |
} | |
- if (b->flags & (ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) { | |
+ if (b->flags & ZEND_BB_ENTRY) { | |
fprintf(stderr, " entry"); | |
} | |
if (b->flags & ZEND_BB_TRY) { | |
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c | |
index 3509c584c1..de0abc288c 100644 | |
--- a/ext/opcache/jit/zend_jit.c | |
+++ b/ext/opcache/jit/zend_jit.c | |
@@ -224,9 +224,9 @@ static void *dasm_link_and_encode(dasm_State **dasm_state, | |
int b = ssa->cfg.map[rt_opline - op_array->opcodes]; | |
//#ifdef CONTEXT_THREADED_JIT | |
-// if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY))) { | |
+// if (!(ssa->cfg.blocks[b].flags & ZEND_BB_START)) { | |
//#else | |
- if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY))) { | |
+ if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY))) { | |
//#endif | |
zend_jit_label(dasm_state, ssa->cfg.blocks_count + b); | |
zend_jit_prologue(dasm_state); | |
@@ -282,9 +282,9 @@ static void *dasm_link_and_encode(dasm_State **dasm_state, | |
for (b = 0; b < ssa->cfg.blocks_count; b++) { | |
//#ifdef CONTEXT_THREADED_JIT | |
-// if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) { | |
+// if (ssa->cfg.blocks[b].flags & ZEND_BB_START) { | |
//#else | |
- if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) { | |
+ if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY)) { | |
//#endif | |
zend_op *opline = op_array->opcodes + ssa->cfg.blocks[b].start; | |
int offset = dasm_getpclabel(dasm_state, ssa->cfg.blocks_count + b); | |
@@ -575,7 +575,7 @@ static int zend_jit_build_cfg(zend_op_array *op_array, zend_cfg *cfg) | |
{ | |
uint32_t flags; | |
- flags = ZEND_CFG_STACKLESS | ZEND_RT_CONSTANTS | ZEND_CFG_NO_ENTRY_PREDECESSORS | ZEND_SSA_RC_INFERENCE_FLAG | ZEND_SSA_USE_CV_RESULTS | ZEND_CFG_RECV_ENTRY; | |
+ flags = ZEND_CFG_STACKLESS | ZEND_RT_CONSTANTS | ZEND_CFG_NO_ENTRY_PREDECESSORS | ZEND_SSA_RC_INFERENCE_FLAG | ZEND_SSA_USE_CV_RESULTS; | |
if (zend_build_cfg(&CG(arena), op_array, flags, cfg) != SUCCESS) { | |
return FAILURE; | |
@@ -2037,8 +2037,9 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op | |
zend_jit_prologue(&dasm_state); | |
} else | |
//#endif | |
- if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) { | |
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_START) { | |
opline = op_array->opcodes + ssa->cfg.blocks[b].start; | |
+#if 0 | |
if (ssa->cfg.flags & ZEND_CFG_RECV_ENTRY) { | |
if (opline->opcode == ZEND_RECV_INIT) { | |
if (opline == op_array->opcodes || | |
@@ -2098,7 +2099,10 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op | |
zend_jit_prologue(&dasm_state); | |
recv_emitted = 1; | |
} | |
- } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE && | |
+ | |
+ } else | |
+#endif | |
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE && | |
ssa->cfg.blocks[b].len == 1 && | |
(ssa->cfg.blocks[b].flags & ZEND_BB_EXIT)) { | |
/* don't generate code for BB with single opcode */ | |
@@ -2136,7 +2140,7 @@ static int zend_jit(zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_op | |
if (!zend_jit_reset_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) { | |
goto jit_failure; | |
} | |
- } else if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY|ZEND_BB_ENTRY)) { | |
+ } else if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY)) { | |
if (!zend_jit_set_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) { | |
goto jit_failure; | |
} | |
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c | |
index 6bb0c6765c..f1c213e414 100644 | |
--- a/ext/opcache/jit/zend_jit_disasm_x86.c | |
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c | |
@@ -273,7 +273,7 @@ static int zend_jit_disasm(const char *name, | |
if (op_array && cfg) { | |
ZVAL_FALSE(&zv); | |
for (b = 0; b < cfg->blocks_count; b++) { | |
- if (cfg->blocks[b].flags & (ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) { | |
+ if (cfg->blocks[b].flags & ZEND_BB_ENTRY) { | |
addr = (uint64_t)(uintptr_t)op_array->opcodes[cfg->blocks[b].start].handler; | |
if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) { | |
zend_hash_index_add(&labels, addr, &zv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment