From 58596897e97da0a3fae82a6a3b17bbfa1e7de689 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov <dmitry@zend.com>
Date: Tue, 4 Aug 2015 08:35:40 +0300
Subject: [PATCH] Get rid of ZEND_FAST_CALL_UNBOUND

---
 Zend/zend_compile.c |  3 +--
 Zend/zend_compile.h |  1 -
 Zend/zend_opcode.c  | 11 +++--------
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 6deea135d6..8fd71d0aaf 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3477,7 +3477,6 @@ static int zend_handle_loops_and_finally_ex(zend_long depth) /* {{{ */
 			SET_UNUSED(opline->op1);
 			SET_UNUSED(opline->op2);
 			opline->op1.num = loop_var->u.try_catch_offset;
-			opline->extended_value = ZEND_FAST_CALL_UNBOUND;
 		} else if (loop_var->opcode == ZEND_RETURN) {
 			/* Stack separator */
 			break;
@@ -4126,7 +4125,7 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
 		zend_stack_del_top(&CG(loop_var_stack));
 
 		opline = zend_emit_op(NULL, ZEND_FAST_CALL, NULL, NULL);
-		opline->op1.opline_num = opnum_jmp + 1;
+		opline->op1.num = try_catch_offset;
 		opline->result_type = IS_TMP_VAR;
 		opline->result.var = CG(context).fast_call_var;
 
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index ae9a2806ff..2db45e54fe 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -946,7 +946,6 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
 #define ZEND_FAST_RET_TO_FINALLY	2
 
 #define ZEND_FAST_CALL_FROM_FINALLY	1
-#define ZEND_FAST_CALL_UNBOUND      2
 
 #define ZEND_ARRAY_ELEMENT_REF		(1<<0)
 #define ZEND_ARRAY_NOT_PACKED		(1<<1)
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 237e7cd6f6..66ad24e98f 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -523,10 +523,8 @@ static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t op_num)
 	if (finally_op_num) {
 		/* Must be ZEND_FAST_CALL */
 		ZEND_ASSERT(op_array->opcodes[finally_op_num - 2].opcode == ZEND_FAST_CALL);
-		if (op_array->opcodes[op_num].extended_value == 0) {
-			op_array->opcodes[op_num].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
-			op_array->opcodes[op_num].op2.opline_num = finally_op_num - 2;
-		}
+		op_array->opcodes[op_num].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
+		op_array->opcodes[op_num].op2.opline_num = finally_op_num - 2;
 	}
 }
 
@@ -603,10 +601,7 @@ ZEND_API int pass_two(zend_op_array *op_array)
 	while (opline < end) {
 		switch (opline->opcode) {
 			case ZEND_FAST_CALL:
-				if (opline->extended_value == ZEND_FAST_CALL_UNBOUND) {
-					opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
-					opline->extended_value = 0;
-				}
+				opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
 				zend_resolve_fast_call(op_array, opline - op_array->opcodes);
 				ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
 				break;
-- 
2.40.0