Lines Matching refs:fiber

465 	zend_fiber *fiber = zend_fiber_from_context(context);  in zend_fiber_cleanup()  local
468 EG(vm_stack) = fiber->vm_stack; in zend_fiber_cleanup()
471 fiber->execute_data = NULL; in zend_fiber_cleanup()
472 fiber->stack_bottom = NULL; in zend_fiber_cleanup()
473 fiber->caller = NULL; in zend_fiber_cleanup()
481 zend_fiber *fiber = EG(active_fiber); in zend_fiber_execute() local
499 fiber->execute_data = (zend_execute_data *) stack->top; in zend_fiber_execute()
500 fiber->stack_bottom = fiber->execute_data; in zend_fiber_execute()
502 memset(fiber->execute_data, 0, sizeof(zend_execute_data)); in zend_fiber_execute()
504 fiber->execute_data->func = &zend_fiber_function; in zend_fiber_execute()
505 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in zend_fiber_execute()
507 EG(current_execute_data) = fiber->execute_data; in zend_fiber_execute()
511 fiber->fci.retval = &fiber->result; in zend_fiber_execute()
513 zend_call_function(&fiber->fci, &fiber->fci_cache); in zend_fiber_execute()
516 zval_ptr_dtor(&fiber->fci.function_name); in zend_fiber_execute()
517 ZVAL_UNDEF(&fiber->fci.function_name); in zend_fiber_execute()
520 if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED) in zend_fiber_execute()
523 fiber->flags |= ZEND_FIBER_FLAG_THREW; in zend_fiber_execute()
532 fiber->flags |= ZEND_FIBER_FLAG_BAILOUT; in zend_fiber_execute()
536 fiber->context.cleanup = &zend_fiber_cleanup; in zend_fiber_execute()
537 fiber->vm_stack = EG(vm_stack); in zend_fiber_execute()
539 transfer->context = fiber->caller; in zend_fiber_execute()
580 static zend_always_inline zend_fiber_transfer zend_fiber_resume(zend_fiber *fiber, zval *value, boo… in zend_fiber_resume() argument
588 fiber->caller = EG(current_fiber_context); in zend_fiber_resume()
589 EG(active_fiber) = fiber; in zend_fiber_resume()
591 zend_fiber_transfer transfer = zend_fiber_switch_to(fiber->previous, value, exception); in zend_fiber_resume()
598 static zend_always_inline zend_fiber_transfer zend_fiber_suspend(zend_fiber *fiber, zval *value) in zend_fiber_suspend() argument
600 ZEND_ASSERT(fiber->caller != NULL); in zend_fiber_suspend()
602 zend_fiber_context *caller = fiber->caller; in zend_fiber_suspend()
603 fiber->previous = EG(current_fiber_context); in zend_fiber_suspend()
604 fiber->caller = NULL; in zend_fiber_suspend()
605 fiber->execute_data = EG(current_execute_data); in zend_fiber_suspend()
612 zend_fiber *fiber = emalloc(sizeof(zend_fiber)); in zend_fiber_object_create() local
614 memset(fiber, 0, sizeof(zend_fiber)); in zend_fiber_object_create()
616 zend_object_std_init(&fiber->std, ce); in zend_fiber_object_create()
617 fiber->std.handlers = &zend_fiber_handlers; in zend_fiber_object_create()
619 return &fiber->std; in zend_fiber_object_create()
624 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_destroy() local
626 if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED) { in zend_fiber_object_destroy()
636 fiber->flags |= ZEND_FIBER_FLAG_DESTROYED; in zend_fiber_object_destroy()
638 zend_fiber_transfer transfer = zend_fiber_resume(fiber, &graceful_exit, true); in zend_fiber_object_destroy()
663 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_free() local
665 zval_ptr_dtor(&fiber->fci.function_name); in zend_fiber_object_free()
666 zval_ptr_dtor(&fiber->result); in zend_fiber_object_free()
668 zend_object_std_dtor(&fiber->std); in zend_fiber_object_free()
673 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_gc() local
676 zend_get_gc_buffer_add_zval(buf, &fiber->fci.function_name); in zend_fiber_object_gc()
677 zend_get_gc_buffer_add_zval(buf, &fiber->result); in zend_fiber_object_gc()
679 if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL) { in zend_fiber_object_gc()
685 zend_execute_data *ex = fiber->execute_data; in zend_fiber_object_gc()
734 zend_fiber *fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD() local
736 …if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_INIT || Z_TYPE(fiber->fci.function_name)… in ZEND_METHOD()
741 fiber->fci = fci; in ZEND_METHOD()
742 fiber->fci_cache = fcc; in ZEND_METHOD()
745 Z_TRY_ADDREF(fiber->fci.function_name); in ZEND_METHOD()
750 zend_fiber *fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD() local
753 Z_PARAM_VARIADIC_WITH_NAMED(fiber->fci.params, fiber->fci.param_count, fiber->fci.named_params); in ZEND_METHOD()
761 if (fiber->context.status != ZEND_FIBER_STATUS_INIT) { in ZEND_METHOD()
766 …if (!zend_fiber_init_context(&fiber->context, zend_ce_fiber, zend_fiber_execute, EG(fiber_stack_si… in ZEND_METHOD()
770 fiber->previous = &fiber->context; in ZEND_METHOD()
772 zend_fiber_transfer transfer = zend_fiber_resume(fiber, NULL, false); in ZEND_METHOD()
786 zend_fiber *fiber = EG(active_fiber); in ZEND_METHOD() local
788 if (UNEXPECTED(!fiber)) { in ZEND_METHOD()
793 if (UNEXPECTED(fiber->flags & ZEND_FIBER_FLAG_DESTROYED)) { in ZEND_METHOD()
803 …ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_RUNNING || fiber->context.status == ZEND_FI… in ZEND_METHOD()
805 fiber->stack_bottom->prev_execute_data = NULL; in ZEND_METHOD()
807 zend_fiber_transfer transfer = zend_fiber_suspend(fiber, value); in ZEND_METHOD()
814 zend_fiber *fiber; in ZEND_METHOD() local
827 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
829 if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) { in ZEND_METHOD()
834 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in ZEND_METHOD()
836 zend_fiber_transfer transfer = zend_fiber_resume(fiber, value, false); in ZEND_METHOD()
843 zend_fiber *fiber; in ZEND_METHOD() local
855 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
857 if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) { in ZEND_METHOD()
862 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in ZEND_METHOD()
864 zend_fiber_transfer transfer = zend_fiber_resume(fiber, exception, true); in ZEND_METHOD()
871 zend_fiber *fiber; in ZEND_METHOD() local
875 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
877 RETURN_BOOL(fiber->context.status != ZEND_FIBER_STATUS_INIT); in ZEND_METHOD()
882 zend_fiber *fiber; in ZEND_METHOD() local
886 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
888 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_SUSPENDED && fiber->caller == NULL); in ZEND_METHOD()
893 zend_fiber *fiber; in ZEND_METHOD() local
897 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
899 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_RUNNING || fiber->caller != NULL); in ZEND_METHOD()
904 zend_fiber *fiber; in ZEND_METHOD() local
908 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
910 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_DEAD); in ZEND_METHOD()
915 zend_fiber *fiber; in ZEND_METHOD() local
920 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
922 if (fiber->context.status == ZEND_FIBER_STATUS_DEAD) { in ZEND_METHOD()
923 if (fiber->flags & ZEND_FIBER_FLAG_THREW) { in ZEND_METHOD()
925 } else if (fiber->flags & ZEND_FIBER_FLAG_BAILOUT) { in ZEND_METHOD()
928 RETURN_COPY_DEREF(&fiber->result); in ZEND_METHOD()
930 } else if (fiber->context.status == ZEND_FIBER_STATUS_INIT) { in ZEND_METHOD()
944 zend_fiber *fiber = EG(active_fiber); in ZEND_METHOD() local
946 if (!fiber) { in ZEND_METHOD()
950 RETURN_OBJ_COPY(&fiber->std); in ZEND_METHOD()