Lines Matching refs:fiber

49 static zend_fiber_transfer zend_test_fiber_resume(zend_test_fiber *fiber, zval *value, bool excepti…  in zend_test_fiber_resume()  argument
53 fiber->caller = EG(current_fiber_context); in zend_test_fiber_resume()
54 ZT_G(active_fiber) = fiber; in zend_test_fiber_resume()
56 zend_fiber_transfer transfer = zend_test_fiber_switch_to(fiber->previous, value, exception); in zend_test_fiber_resume()
63 static zend_fiber_transfer zend_test_fiber_suspend(zend_test_fiber *fiber, zval *value) in zend_test_fiber_suspend() argument
65 ZEND_ASSERT(fiber->caller != NULL); in zend_test_fiber_suspend()
67 zend_fiber_context *caller = fiber->caller; in zend_test_fiber_suspend()
68 fiber->previous = EG(current_fiber_context); in zend_test_fiber_suspend()
69 fiber->caller = NULL; in zend_test_fiber_suspend()
76 zend_test_fiber *fiber = ZT_G(active_fiber); in zend_test_fiber_execute() local
98 fiber->fci.retval = &retval; in zend_test_fiber_execute()
100 zend_call_function(&fiber->fci, &fiber->fci_cache); in zend_test_fiber_execute()
102 zval_ptr_dtor(&fiber->result); // Destroy param from symmetric coroutine. in zend_test_fiber_execute()
103 zval_ptr_dtor(&fiber->fci.function_name); in zend_test_fiber_execute()
106 if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED) in zend_test_fiber_execute()
109 fiber->flags |= ZEND_FIBER_FLAG_THREW; in zend_test_fiber_execute()
117 ZVAL_COPY_VALUE(&fiber->result, &retval); in zend_test_fiber_execute()
118 ZVAL_COPY(&transfer->value, &fiber->result); in zend_test_fiber_execute()
121 fiber->flags |= ZEND_FIBER_FLAG_BAILOUT; in zend_test_fiber_execute()
127 if (fiber->target) { in zend_test_fiber_execute()
128 zend_fiber_context *target = &fiber->target->context; in zend_test_fiber_execute()
132 ZVAL_COPY(&fiber->target->result, &fiber->result); in zend_test_fiber_execute()
133 fiber->target->fci.params = &fiber->target->result; in zend_test_fiber_execute()
134 fiber->target->fci.param_count = 1; in zend_test_fiber_execute()
136 fiber->target->caller = fiber->caller; in zend_test_fiber_execute()
137 ZT_G(active_fiber) = fiber->target; in zend_test_fiber_execute()
139 transfer->context = fiber->caller; in zend_test_fiber_execute()
142 fiber->caller = NULL; in zend_test_fiber_execute()
147 zend_test_fiber *fiber; in zend_test_fiber_object_create() local
149 fiber = emalloc(sizeof(zend_test_fiber)); in zend_test_fiber_object_create()
150 memset(fiber, 0, sizeof(zend_test_fiber)); in zend_test_fiber_object_create()
152 zend_object_std_init(&fiber->std, ce); in zend_test_fiber_object_create()
153 fiber->std.handlers = &zend_test_fiber_handlers; in zend_test_fiber_object_create()
155 return &fiber->std; in zend_test_fiber_object_create()
160 zend_test_fiber *fiber = (zend_test_fiber *) object; in zend_test_fiber_object_destroy() local
162 if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED) { in zend_test_fiber_object_destroy()
169 fiber->flags |= ZEND_FIBER_FLAG_DESTROYED; in zend_test_fiber_object_destroy()
171 zend_fiber_transfer transfer = zend_test_fiber_resume(fiber, NULL, false); in zend_test_fiber_object_destroy()
194 zend_test_fiber *fiber = (zend_test_fiber *) object; in zend_test_fiber_object_free() local
196 if (fiber->context.status == ZEND_FIBER_STATUS_INIT) { in zend_test_fiber_object_free()
198 zval_ptr_dtor(&fiber->fci.function_name); in zend_test_fiber_object_free()
201 if (fiber->target) { in zend_test_fiber_object_free()
202 OBJ_RELEASE(&fiber->target->std); in zend_test_fiber_object_free()
205 zval_ptr_dtor(&fiber->result); in zend_test_fiber_object_free()
207 zend_object_std_dtor(&fiber->std); in zend_test_fiber_object_free()
211 zend_test_fiber *fiber, zend_fiber_transfer *transfer, INTERNAL_FUNCTION_PARAMETERS in delegate_transfer_result() argument
218 if (fiber->context.status == ZEND_FIBER_STATUS_DEAD) { in delegate_transfer_result()
228 zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis()); in ZEND_METHOD() local
231 Z_PARAM_FUNC(fiber->fci, fiber->fci_cache) in ZEND_METHOD()
235 Z_TRY_ADDREF(fiber->fci.function_name); in ZEND_METHOD()
240 zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis()); in ZEND_METHOD() local
249 ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_INIT); in ZEND_METHOD()
251 if (fiber->previous != NULL) { in ZEND_METHOD()
256 fiber->fci.params = params; in ZEND_METHOD()
257 fiber->fci.param_count = param_count; in ZEND_METHOD()
258 fiber->fci.named_params = named_params; in ZEND_METHOD()
260 …zend_fiber_init_context(&fiber->context, zend_test_fiber_class, zend_test_fiber_execute, EG(fiber_… in ZEND_METHOD()
262 fiber->previous = &fiber->context; in ZEND_METHOD()
264 zend_fiber_transfer transfer = zend_test_fiber_resume(fiber, NULL, false); in ZEND_METHOD()
266 delegate_transfer_result(fiber, &transfer, INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_METHOD()
278 zend_test_fiber *fiber = ZT_G(active_fiber); in ZEND_METHOD() local
280 ZEND_ASSERT(fiber); in ZEND_METHOD()
282 zend_fiber_transfer transfer = zend_test_fiber_suspend(fiber, value); in ZEND_METHOD()
284 if (fiber->flags & ZEND_FIBER_FLAG_DESTROYED) { in ZEND_METHOD()
291 delegate_transfer_result(fiber, &transfer, INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_METHOD()
296 zend_test_fiber *fiber; in ZEND_METHOD() local
304 fiber = (zend_test_fiber *) Z_OBJ_P(getThis()); in ZEND_METHOD()
306 if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) { in ZEND_METHOD()
311 zend_fiber_transfer transfer = zend_test_fiber_resume(fiber, value, false); in ZEND_METHOD()
313 delegate_transfer_result(fiber, &transfer, INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_METHOD()
325 zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis()); in ZEND_METHOD() local
332 target->previous = &fiber->context; in ZEND_METHOD()
334 if (fiber->target) { in ZEND_METHOD()
335 OBJ_RELEASE(&fiber->target->std); in ZEND_METHOD()
338 fiber->target = target; in ZEND_METHOD()