summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h350
1 files changed, 225 insertions, 125 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index ec29f9e7d8..3a0a70e946 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -4198,11 +4198,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -4887,11 +4891,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -5904,11 +5912,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -6625,11 +6637,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -7373,11 +7389,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -9400,11 +9420,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -10091,11 +10115,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -11110,11 +11138,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -11690,11 +11722,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -12378,11 +12414,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -16265,11 +16305,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -18350,11 +18394,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -20818,11 +20866,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -21970,11 +22022,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -24104,11 +24160,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -25602,11 +25662,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -26916,11 +26980,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -28231,11 +28299,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -28653,11 +28725,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -29964,11 +30040,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -33449,11 +33529,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -35396,11 +35480,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -37725,11 +37813,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -38729,11 +38821,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */
@@ -40724,11 +40820,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_LONG(generator->key, generator->largest_used_integer_key);
}
- /* If a value is sent it should go into the result var */
- generator->send_target = &EX_T(opline->result.var);
-
- /* Initialize the sent value to NULL */
- EX_T(opline->result.var).tmp_var = EG(uninitialized_zval);
+ if (RETURN_VALUE_USED(opline)) {
+ /* If the return value of yield is used set the send
+ * target and initialize it to NULL */
+ generator->send_target = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF(EG(uninitialized_zval));
+ EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ } else {
+ generator->send_target = NULL;
+ }
/* We increment to the next op, so we are at the correct position when the
* generator is resumed. */