From: Dmitry Stogov Date: Mon, 27 Jun 2016 07:36:41 +0000 (+0300) Subject: Fixed executor without global register variales (gcc warnings or clang errors) X-Git-Tag: php-7.1.0alpha3~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=044e2718fec8d74f8430e7bdf3a41cc29085fed6;p=php Fixed executor without global register variales (gcc warnings or clang errors) --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 670dcd2442..4a69cabded 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2075,6 +2075,12 @@ 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) * ================== diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index e68f8e4bed..f0ef140f78 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -398,6 +398,7 @@ typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_H # define ZEND_VM_LEAVE() return 2 #endif #define ZEND_VM_INTERRUPT() ZEND_VM_TAIL_CALL(zend_interrupt_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)); +#define ZEND_VM_LOOP_INTERRUPT() zend_interrupt_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); #define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_opcode_handler(opcode, opline))(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)); static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_interrupt_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS); @@ -418,7 +419,7 @@ ZEND_API void execute_ex(zend_execute_data *ex) LOAD_OPLINE(); - ZEND_VM_INTERRUPT_CHECK(); + ZEND_VM_LOOP_INTERRUPT_CHECK(); while (1) { #if !defined(ZEND_VM_FP_GLOBAL_REG) || !defined(ZEND_VM_IP_GLOBAL_REG) @@ -439,7 +440,7 @@ ZEND_API void execute_ex(zend_execute_data *ex) #else if (EXPECTED(ret > 0)) { execute_data = EG(current_execute_data); - ZEND_VM_INTERRUPT_CHECK(); + ZEND_VM_LOOP_INTERRUPT_CHECK(); } else { # ifdef ZEND_VM_IP_GLOBAL_REG opline = orig_opline; diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index ebc6474ae5..345d7bde7b 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -9,7 +9,7 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *ex) {%INTERNAL_LABELS%} LOAD_OPLINE(); - ZEND_VM_INTERRUPT_CHECK(); + 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 6086237c39..eb5bfe9106 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1620,6 +1620,7 @@ 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"); out($f,"#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_opcode_handler(opcode, opline))(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n"); out($f,"\n"); out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS);"); @@ -1652,6 +1653,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\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; @@ -1687,6 +1689,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\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; @@ -1787,7 +1790,7 @@ 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_INTERRUPT_CHECK();\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" .