summaryrefslogtreecommitdiff
path: root/Zend/zend_generators.h
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2012-05-31 00:00:30 +0200
committerNikita Popov <nikic@php.net>2012-05-31 00:00:30 +0200
commitee89e228f6f684555dd219d8a46d173cfed3230a (patch)
tree206a718ab9d5e3ecaab562c5f604cc191ea486dd /Zend/zend_generators.h
parent0033a525213e68e6ae74b3c3d75fd6ea4beea5d6 (diff)
downloadphp-git-ee89e228f6f684555dd219d8a46d173cfed3230a.tar.gz
Allow yielding during function calls
During function calls arguments are pushed onto the stack. Now these are backed up on yield and restored on resume. This requires memcpy'ing them, but there doesn't seem to be any better way to do it. Also this fixes the issue with exceptions thrown during function calls.
Diffstat (limited to 'Zend/zend_generators.h')
-rw-r--r--Zend/zend_generators.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h
index b73557c715..89193bbe6e 100644
--- a/Zend/zend_generators.h
+++ b/Zend/zend_generators.h
@@ -28,6 +28,16 @@ typedef struct _zend_generator {
/* The suspended execution context. */
zend_execute_data *execute_data;
+
+ /* If the execution is suspended during a function call there may be
+ * arguments pushed to the stack, so it has to be backed up. */
+ void *backed_up_stack;
+ size_t backed_up_stack_size;
+
+ /* The original stack top before resuming the generator. This is required
+ * for proper cleanup during exception handling. */
+ void **original_stack_top;
+
/* Current value */
zval *value;
/* Current key */