com php-src: Revert "Fixed invalid live-range detection": Zend/tests/temporary_cleaning_007.phpt Zend/zend _compile.c Zend/zend_compile.h
Zend/zend_opcode .c
| From: | Anatol Belski | Date: | Fri, 10 Jul 2015 10:05:26 +0000 |
| Subject: | com php-src: Revert "Fixed invalid live-range detection": Zend/tests/temporary_cleaning_007.phpt Zend/zend _compile.c Zend/zend_compile.h Zend/zend_opcode .c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87908@lists.php.net to get a copy of this message | ||
Commit: 5784b8f8e6b4a3b31a7e5529d7a55b98626c51e2
Author: Anatol Belski <ab@php.net> Fri, 10 Jul 2015 12:05:26 +0200
Parents: ee573eba67caf67289c72b0ca81976b72a76e0b9
Branches: PHP-7.0.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5784b8f8e6b4a3b31a7e5529d7a55b98626c51e2
Log:
Revert "Fixed invalid live-range detection"
This reverts commit 724e98498a3f2954e9ce2457f1c989be0ab3b552.
Changed paths:
D Zend/tests/temporary_cleaning_007.phpt
M Zend/zend_compile.c
M Zend/zend_compile.h
M Zend/zend_opcode.c
Diff:
diff --git a/Zend/tests/temporary_cleaning_007.phpt b/Zend/tests/temporary_cleaning_007.phpt
deleted file mode 100644
index 0e29ed6..0000000
--- a/Zend/tests/temporary_cleaning_007.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Exception inside a foreach loop with return
---FILE--
-<?php
-class saboteurTestController {
- public function isConsistent() { throw new \Exception(); }
-}
-
-$controllers = array(new saboteurTestController(),new saboteurTestController());
-foreach ($controllers as $controller) {
- try {
- if ($controller->isConsistent()) {
- return $controller;
- }
- } catch (\Exception $e) {
- echo "Exception\n";
- }
-}
-?>
---EXPECT--
-Exception
-Exception
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 53ff1ae..51eb0bc 100644
--- a/Zend/zend_compile..c
+++ b/Zend/zend_compile.c
@@ -872,7 +872,7 @@ static void str_dtor(zval *zv) /* {{{ */ {
static zend_bool zend_is_call(zend_ast *ast);
-static void generate_free_loop_var_ex(znode *var, uint32_t flags) /* {{{ */
+static void generate_free_loop_var(znode *var) /* {{{ */
{
if (var->op_type != IS_UNUSED) {
zend_op *opline = get_next_op(CG(active_op_array));
@@ -880,16 +880,10 @@ static void generate_free_loop_var_ex(znode *var, uint32_t flags) /* {{{ */
opline->opcode = var->flag ? ZEND_FE_FREE : ZEND_FREE;
SET_NODE(opline->op1, var);
SET_UNUSED(opline->op2);
- opline->extended_value = flags;
}
}
/* }}} */
-static void generate_free_loop_var(znode *var) /* {{{ */
-{
- generate_free_loop_var_ex(var, 0);
-}
-
static uint32_t zend_add_try_element(uint32_t try_op) /* {{{ */
{
zend_op_array *op_array = CG(active_op_array);
@@ -3447,12 +3441,12 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */
}
/* }}} */
-static void zend_free_foreach_and_switch_variables(uint32_t flags) /* {{{ */
+static void zend_free_foreach_and_switch_variables(void) /* {{{ */
{
int array_offset = CG(context).current_brk_cont;
while (array_offset != -1) {
zend_brk_cont_element *brk_cont = &CG(context).brk_cont_array[array_offset];
- generate_free_loop_var_ex(&brk_cont->loop_var, flags);
+ generate_free_loop_var(&brk_cont->loop_var);
array_offset = brk_cont->parent;
}
}
@@ -3476,12 +3470,7 @@ void zend_compile_return(zend_ast *ast) /* {{{ */
zend_compile_expr(&expr_node, expr_ast);
}
- /* Generator return types are handled separately */
- if (!(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) &&
CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
- zend_emit_return_type_check(expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info -
1);
- }
-
- zend_free_foreach_and_switch_variables(ZEND_FREE_ON_RETURN);
+ zend_free_foreach_and_switch_variables();
if (CG(context).in_finally) {
opline = zend_emit_op(NULL, ZEND_DISCARD_EXCEPTION, NULL, NULL);
@@ -3489,6 +3478,10 @@ void zend_compile_return(zend_ast *ast) /* {{{ */
opline->op1.var = CG(context).fast_call_var;
}
+ /* Generator return types are handled separately */
+ if (!(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) &&
CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_emit_return_type_check(expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info -
1);
+ }
opline = zend_emit_op(NULL, by_ref ? ZEND_RETURN_BY_REF : ZEND_RETURN,
&expr_node, NULL);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index b07f70e..3f9c091 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -882,9 +882,7 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name);
#define ZEND_FETCH_ARG_MASK 0x000fffff
-#define ZEND_FREE_ON_RETURN (1<<0)
-
-#define ZEND_MEMBER_FUNC_CALL (1<<0)
+#define ZEND_MEMBER_FUNC_CALL 1<<0
#define ZEND_ARG_SEND_BY_REF (1<<0)
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 64ba656...ae2b4bf 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -991,11 +991,7 @@ static zend_always_inline uint32_t
*generate_var_liveliness_info_ex(zend_op_arra
&& opline->opcode != ZEND_FETCH_LIST
&& opline->opcode != ZEND_CASE
&& opline->opcode != ZEND_FE_FETCH_R
- && opline->opcode != ZEND_FE_FETCH_RW
- /* the following opcodes are not the "final" */
- && (opline->opcode != ZEND_FREE || !(opline->extended_value &
ZEND_FREE_ON_RETURN))
- && (opline->opcode != ZEND_FE_FREE || !(opline->extended_value &
ZEND_FREE_ON_RETURN))
- ) {
+ && opline->opcode != ZEND_FE_FETCH_RW) {
op_live_total += liveliness_kill_var(op_array, opline, var, Tstart, opTs);
}
}
@@ -1011,7 +1007,7 @@ static zend_always_inline uint32_t
*generate_var_liveliness_info_ex(zend_op_arra
}
} while (++opline != end);
-#if 0
+#if ZEND_DEBUG
/* Check that all TMP variable live-ranges are closed */
for (i = 0; i < op_array->T; i++) {
ZEND_ASSERT(Tstart[i] == (uint32_t)-1);